Class HistoricalVector<E>
- java.lang.Object
-
- org.opentrafficsim.core.perception.AbstractHistorical<E,AbstractHistoricalCollection.EventCollection<E,C>>
-
- org.opentrafficsim.core.perception.collections.AbstractHistoricalCollection<E,L>
-
- org.opentrafficsim.core.perception.collections.AbstractHistoricalList<E,Vector<E>>
-
- org.opentrafficsim.core.perception.collections.HistoricalVector<E>
-
- Type Parameters:
E- element type
- All Implemented Interfaces:
Iterable<E>,Collection<E>,List<E>,HistoricalCollection<E>,HistoricalList<E>,HistoryManager.HistoricalElement
public class HistoricalVector<E> extends AbstractHistoricalList<E,Vector<E>>
Vector-valued historical state. The current vector is always maintained, and past states of the vector are obtained by applying the events between now and the requested time in reverse.
This class does not implement allVectormethods, but only those shared withList. The returned argument is however aList.
TheIteratorreturned by this class does not support theremove(),add()andset()methods. Any returned sublist is unmodifiable.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.opentrafficsim.core.perception.collections.AbstractHistoricalList
AbstractHistoricalList.AddEvent<E,L extends List<E>>, AbstractHistoricalList.EventList<E,L extends List<E>>, AbstractHistoricalList.RemoveEvent<E,L extends List<E>>
-
Nested classes/interfaces inherited from class org.opentrafficsim.core.perception.collections.AbstractHistoricalCollection
AbstractHistoricalCollection.EventCollection<E,C extends Collection<E>>
-
Nested classes/interfaces inherited from class org.opentrafficsim.core.perception.AbstractHistorical
AbstractHistorical.EventValue<T>
-
-
Constructor Summary
Constructors Constructor Description HistoricalVector(HistoryManager historyManager)Construct a new, empty HistoricalVector.HistoricalVector(HistoryManager historyManager, Collection<? extends E> c)Construct a new HistoricalVector and fill it with the elements of the given collection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Vector<E>get()Retrieve the current, internal list.Vector<E>get(Time time)Retrieve a past list.StringtoString()-
Methods inherited from class org.opentrafficsim.core.perception.collections.AbstractHistoricalList
add, add, addAll, get, indexOf, lastIndexOf, listIterator, listIterator, remove, remove, set, subList
-
Methods inherited from class org.opentrafficsim.core.perception.collections.AbstractHistoricalCollection
addAll, clear, contains, containsAll, fill, fill, getCollection, isEmpty, iterator, removeAll, retainAll, size, toArray, toArray
-
Methods inherited from class org.opentrafficsim.core.perception.AbstractHistorical
addEvent, cleanUpHistory, getEvent, getEvents, getLastEvent, isLastState, now, removeEvent
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Methods inherited from interface org.opentrafficsim.core.perception.collections.HistoricalCollection
removeIf
-
Methods inherited from interface org.opentrafficsim.core.perception.collections.HistoricalList
replaceAll, sort
-
-
-
-
Constructor Detail
-
HistoricalVector
public HistoricalVector(HistoryManager historyManager)
Construct a new, empty HistoricalVector.- Parameters:
historyManager- HistoryManager; history manager
-
HistoricalVector
public HistoricalVector(HistoryManager historyManager, Collection<? extends E> c)
Construct a new HistoricalVector and fill it with the elements of the given collection.- Parameters:
historyManager- HistoryManager; history managerc- Collection<? extends E>; initial collection
-
-
Method Detail
-
get
public Vector<E> get()
Retrieve the current, internal list. TODO document what the caller may do with the result.- Returns:
- List<E>; current list
-
get
public Vector<E> get(Time time)
Retrieve a past list.- Parameters:
time- Time; time to obtain the list at- Returns:
- List<E>; past list
-
-