Class AbstractHistoricalCollection<E,​C extends Collection<E>>

java.lang.Object
org.opentrafficsim.core.perception.AbstractHistorical<E,​AbstractHistoricalCollection.EventCollection<E,​C>>
org.opentrafficsim.core.perception.collections.AbstractHistoricalCollection<E,​C>
Type Parameters:
E - element type
C - collection type
All Implemented Interfaces:
Iterable<E>, Collection<E>, HistoricalCollection<E>, HistoryManager.HistoricalElement
Direct Known Subclasses:
AbstractHistoricalList, AbstractHistoricalQueue, AbstractHistoricalSortedSet, HistoricalHashSet, HistoricalLinkedHashSet

public abstract class AbstractHistoricalCollection<E,​C extends Collection<E>>
extends AbstractHistorical<E,​AbstractHistoricalCollection.EventCollection<E,​C>>
implements HistoricalCollection<E>
Collection-valued historical state. The current collection is always maintained, and past states of the collection are obtained by applying the events between now and the requested time in reverse.

This implementation is suitable for sets, as add and remove events to retrieve historical states are only created if indeed the underlying collection is changed. Set introduces no new methods relative to Collection.

The Iterator returned by this class does not support the remove() method.

Copyright (c) 2013-2019 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 1 jan. 2018
Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel