H
- headway typeU
- underlying object typeC
- counter typepublic abstract class AbstractPerceptionIterable<H extends Headway,U,C> extends AbstractPerceptionReiterable<H,U>
Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractPerceptionIterable.Entry
Class of objects for subclasses to return.
|
AbstractPerceptionReiterable.PerceptionIterator, AbstractPerceptionReiterable.PrimaryIteratorEntry
PerceptionCollectable.Intermediate<I>, PerceptionCollectable.PerceptionAccumulator<U,I>, PerceptionCollectable.PerceptionCollector<C,U,I>, PerceptionCollectable.PerceptionFinalizer<C,I>
first, gtu, last
Constructor and Description |
---|
AbstractPerceptionIterable(LaneBasedGTU perceivingGtu,
LaneRecord<?> root,
org.djunits.value.vdouble.scalar.Length initialPosition,
boolean downstream,
org.djunits.value.vdouble.scalar.Length maxDistance,
org.opentrafficsim.core.gtu.RelativePosition relativePosition,
org.opentrafficsim.core.network.route.Route route)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract org.djunits.value.vdouble.scalar.Length |
getDistance(U object,
LaneRecord<?> record,
org.djunits.value.vdouble.scalar.Length position)
Returns the distance to the object.
|
protected org.djunits.value.vdouble.scalar.Length |
getDx()
Returns the longitudinal length of the relevant relative position such that distances to this points can be calculated.
|
protected abstract AbstractPerceptionIterable.Entry |
getNext(LaneRecord<?> record,
org.djunits.value.vdouble.scalar.Length position,
C counter)
Returns the next object(s) on the lane represented by the record.
|
(package private) boolean |
isOnRoute(LaneRecord<?> record)
Returns whether the record is on the route.
|
Iterator<AbstractPerceptionReiterable.PrimaryIteratorEntry> |
primaryIterator()
Returns the primary iterator.
|
addNext, assureNext, collect, first, getPrimaryIterator, isEmpty, iterator, perceive
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
collect
forEach, spliterator
public AbstractPerceptionIterable(LaneBasedGTU perceivingGtu, LaneRecord<?> root, org.djunits.value.vdouble.scalar.Length initialPosition, boolean downstream, org.djunits.value.vdouble.scalar.Length maxDistance, org.opentrafficsim.core.gtu.RelativePosition relativePosition, org.opentrafficsim.core.network.route.Route route)
perceivingGtu
- LaneBasedGTU; perceiving GTUroot
- R; root recordinitialPosition
- Length; initial positiondownstream
- boolean; search downstream (or upstream)maxDistance
- Length; max distance to searchrelativePosition
- RelativePosition; position to which distance are calculated by subclassesroute
- Route; route of the GTU, may be null
public Iterator<AbstractPerceptionReiterable.PrimaryIteratorEntry> primaryIterator()
primaryIterator
in class AbstractPerceptionReiterable<H extends Headway,U>
protected abstract AbstractPerceptionIterable.Entry getNext(LaneRecord<?> record, org.djunits.value.vdouble.scalar.Length position, C counter) throws org.opentrafficsim.core.gtu.GTUException
record
- R; record representing the lane and directionposition
- Length; position to look beyondcounter
- C; counternull
if noneorg.opentrafficsim.core.gtu.GTUException
- on any exception in the processprotected abstract org.djunits.value.vdouble.scalar.Length getDistance(U object, LaneRecord<?> record, org.djunits.value.vdouble.scalar.Length position)
Entry
returned
by getNext
. The two methods need to be consistent with each other.object
- U; underlying objectrecord
- R; record representing the lane and directionposition
- Length; position of the object on the laneprotected org.djunits.value.vdouble.scalar.Length getDx()
final boolean isOnRoute(LaneRecord<?> record)
record
- R; recordCopyright © 2014–2018 Delft University of Technology. All rights reserved.