public class DownstreamNeighborsIterable extends AbstractPerceptionIterable<HeadwayGTU,LaneBasedGTU,Integer>
boolean ignoreIfUpstream. This is to deal with the following
situations in case a GTU with it's rear upstream of the considered lane is found:ignoreIfUpstream = true)
ignoreIfUpstream = false)
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.
AbstractPerceptionIterable.EntryAbstractPerceptionReiterable.PerceptionIterator, AbstractPerceptionReiterable.PrimaryIteratorEntryPerceptionCollectable.Intermediate<I>, PerceptionCollectable.PerceptionAccumulator<U,I>, PerceptionCollectable.PerceptionCollector<C,U,I>, PerceptionCollectable.PerceptionFinalizer<C,I>, PerceptionCollectable.UnderlyingDistance<U>| Constructor and Description |
|---|
DownstreamNeighborsIterable(LaneBasedGTU perceivingGtu,
LaneRecord<?> root,
Length initialPosition,
Length maxDistance,
RelativePosition relativePosition,
HeadwayGtuType headwayGtuType,
RelativeLane lane,
boolean ignoreIfUpstream)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected Length |
getDistance(LaneBasedGTU object,
LaneRecord<?> record,
Length position)
Returns the distance to the object.
|
protected AbstractPerceptionIterable.Entry |
getNext(LaneRecord<?> record,
Length position,
Integer counter)
Returns the next object(s) on the lane represented by the record.
|
HeadwayGTU |
perceive(LaneBasedGTU perceivingGtu,
LaneBasedGTU object,
Length distance)
Returns a perceived version of the underlying object.
|
getDx, isDownstream, primaryIteratorcollect, first, getGtu, isEmpty, iterator, underlying, underlyingWithDistanceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcollectforEach, spliteratorpublic DownstreamNeighborsIterable(LaneBasedGTU perceivingGtu, LaneRecord<?> root, Length initialPosition, Length maxDistance, RelativePosition relativePosition, HeadwayGtuType headwayGtuType, RelativeLane lane, boolean ignoreIfUpstream)
perceivingGtu - LaneBasedGTU; perceiving GTUroot - LaneRecord<?>; root recordinitialPosition - Length; position on the root recordmaxDistance - Length; maximum distance to searchrelativePosition - RelativePosition; position to which distance are calculated by subclassesheadwayGtuType - HeadwayGtuType; type of HeadwayGTU to returnlane - RelativeLane; relative lane (used for a left/right distinction to prevent dead-locks)ignoreIfUpstream - boolean; whether to ignore GTU that are partially upstream of a recordprotected AbstractPerceptionIterable.Entry getNext(LaneRecord<?> record, Length position, Integer counter) throws GTUException
null for
the first object(s). For following object(s) it is whatever value is given with the previous output Entry. Hence,
this method maintains its own counting system.getNext in class AbstractPerceptionIterable<HeadwayGTU,LaneBasedGTU,Integer>record - LaneRecord<?>; record representing the lane and directionposition - Length; position to look beyondcounter - C; counternull if noneGTUException - on any exception in the processprotected Length getDistance(LaneBasedGTU object, LaneRecord<?> record, Length position)
Entry returned
by getNext. The two methods need to be consistent with each other.getDistance in class AbstractPerceptionIterable<HeadwayGTU,LaneBasedGTU,Integer>object - U; underlying objectrecord - LaneRecord<?>; record representing the lane and directionposition - Length; position of the object on the lanepublic HeadwayGTU perceive(LaneBasedGTU perceivingGtu, LaneBasedGTU object, Length distance) throws GTUException, ParameterException
perceive in class AbstractPerceptionReiterable<HeadwayGTU,LaneBasedGTU>perceivingGtu - LaneBasedGTU; perceiving GTUobject - U; underlying objectdistance - Length; distance to the objectGTUException - on exceptionParameterException - on invalid parameter value or missing parameterCopyright © 2014–2019 Delft University of Technology. All rights reserved.