Class AbstractPerceptionReiterable<P extends LaneBasedObject,H extends Headway,U>

java.lang.Object
org.opentrafficsim.road.gtu.lane.perception.AbstractPerceptionReiterable<P,H,U>
Type Parameters:
P - perceiving object type
H - headway type
U - underlying object type
All Implemented Interfaces:
Iterable<H>, PerceptionCollectable<H,U>, PerceptionIterable<H>
Direct Known Subclasses:
MultiLanePerceptionIterable

public abstract class AbstractPerceptionReiterable<P extends LaneBasedObject,H extends Headway,U> extends Object implements PerceptionCollectable<H,U>
This class uses a single primary iterator which a subclass defines, and makes sure that all elements are only looked up and created once. It does so by storing the elements in a linked list. All calls to iterator() return an iterator which iterates over the linked list. If an iterator runs to the end of the linked list, the primary iterator is requested to add an element if it has one.

Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel