Package org.opentrafficsim.core.perception.collections
Historical versions of almost all java non-concurrent collections.
This package adds to each of the collections a
There is no backing-up of provided views on collections. Subsets, key sets, value sets, etc. are hence unmodifiable. Also iterators do not allow the collection to be altered. The reason for these actions not being supported is that there is no way to trigger events upon changes to these sets and by iterators. All changes must be made directly on the collection.
Implementations in this package use 1 or 2 event types, generally for adding and removing an element. More advanced operations, such as
Some of the interface (
ArrayDeque is not supported as it does not allow
reversal of it's state. No implementation for IdentityHashMap is provided as it only has very specific use-cases that
are not in line with historical states. Of the legacy collections only Vector has an implementation.This package adds to each of the collections a
get() and a get(Time) method. The get() returns a
shallow copy of the current contents, while get(Time) constructs past contents by working from the current content
backwards in time. To be able to do this, events are maintained for each change to the collection. This means that all
changes have to go through a specific process.There is no backing-up of provided views on collections. Subsets, key sets, value sets, etc. are hence unmodifiable. Also iterators do not allow the collection to be altered. The reason for these actions not being supported is that there is no way to trigger events upon changes to these sets and by iterators. All changes must be made directly on the collection.
Implementations in this package use 1 or 2 event types, generally for adding and removing an element. More advanced operations, such as
addAll() are translated into events per individual element.Some of the interface (
HistoricalCollection, HistoricalList, HistoricalMap) override default
implementations with other default implementations, as the original default methods use unsupported features
(Iterator.remove(), ListIterator.set(E), Map.Entry.setValue(V)).
Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version 3 feb. 2018
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Interface Summary Interface Description HistoricalCollection<E> Interface for historical collections.HistoricalDeque<E> Interface for historical deques.HistoricalList<E> Interface for historical lists.HistoricalMap<K,V> Interface for historical maps.HistoricalNavigableMap<K,V> Interface for historical navigable maps.HistoricalNavigableSet<E> Interface for historical navigable sets.HistoricalQueue<E> Interface for historical queues.HistoricalSet<E> Interface for historical sets.HistoricalSortedMap<K,V> Interface for historical sorted maps.HistoricalSortedSet<E> Interface for historical sorted sets. -
Class Summary Class Description AbstractHistoricalCollection<E,C extends java.util.Collection<E>> Collection-valued historical state.AbstractHistoricalCollection.AddEvent<E,C extends java.util.Collection<E>> Event for adding value to the collection.AbstractHistoricalCollection.EventCollection<E,C extends java.util.Collection<E>> Abstract super class for events that add or remove a value from the collection.AbstractHistoricalCollection.RemoveEvent<E,C extends java.util.Collection<E>> Event for removing value from the collection.AbstractHistoricalList<E,L extends java.util.List<E>> List-valued historical state.AbstractHistoricalList.AddEvent<E,L extends java.util.List<E>> Class for events that add a value to the list.AbstractHistoricalList.EventList<E,L extends java.util.List<E>> Abstract super class for events that add or remove a value from the list.AbstractHistoricalList.RemoveEvent<E,L extends java.util.List<E>> Class for events that remove a value from the list.AbstractHistoricalMap<K,V,M extends java.util.Map<K,V>> Map-valued historical state.AbstractHistoricalMap.EventMap<K,V,M extends java.util.Map<K,V>> Abstract super class for events that add or remove a value from the map.AbstractHistoricalNavigableMap<K,V,M extends java.util.NavigableMap<K,V>> NavigableMap-valued historical state.AbstractHistoricalNavigableSet<E,S extends java.util.NavigableSet<E>> NavigableSet-valued historical state.AbstractHistoricalQueue<E,Q extends java.util.Queue<E>> Queue-valued historical state.AbstractHistoricalSortedMap<K,V,M extends java.util.SortedMap<K,V>> SortedMap-valued historical state.AbstractHistoricalSortedSet<E,S extends java.util.SortedSet<E>> SortedSet-valued historical state.HistoricalArrayList<E> ArrayList-valued historical state.HistoricalEnumMap<K extends java.lang.Enum<K>,V> EnumMap-valued historical state.HistoricalHashMap<K,V> LinkedHashMap-valued historical state.HistoricalHashSet<E> LinkedHashSet-valued historical state.HistoricalLinkedHashMap<K,V> LinkedHashMap-valued historical state.HistoricalLinkedHashSet<E> LinkedHashSet-valued historical state.HistoricalLinkedList<E> LinkedList-valued historical state.HistoricalPriorityQueue<E> PriorityQueue-valued historical state.HistoricalTreeMap<K,V> TreeMap-valued historical state.HistoricalTreeSet<E> TreeSet-valued historical state.HistoricalVector<E> Vector-valued historical state.