Interface LaneStructure
- All Known Implementing Classes:
RollingLaneStructure
public interface LaneStructure
Interface for lane structures.
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 13 aug. 2018
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classLaneStructure.Entry<T extends LaneBasedObject>Wrapper to hold lane-based object and it's distance. -
Method Summary
Modifier and Type Method Description <T extends LaneBasedObject>
java.util.Map<RelativeLane,java.util.SortedSet<LaneStructure.Entry<T>>>getDownstreamObjects(java.lang.Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos)Retrieve objects of a specific type.<T extends LaneBasedObject>
java.util.SortedSet<LaneStructure.Entry<T>>getDownstreamObjects(RelativeLane lane, java.lang.Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos)Retrieve objects on a lane of a specific type.<T extends LaneBasedObject>
java.util.Map<RelativeLane,java.util.SortedSet<LaneStructure.Entry<T>>>getDownstreamObjectsOnRoute(java.lang.Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos, Route route)Retrieve objects of a specific type.<T extends LaneBasedObject>
java.util.SortedSet<LaneStructure.Entry<T>>getDownstreamObjectsOnRoute(RelativeLane lane, java.lang.Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos, Route route)Retrieve objects on a lane of a specific type.java.util.SortedSet<RelativeLane>getExtendedCrossSection()Returns the extended cross-section, which includes all lanes for which a first record is present.LaneStructureRecordgetFirstRecord(RelativeLane lane)Returns the first record on the given lane.LaneStructureRecordgetRootRecord()Returns the root record.<T extends LaneBasedObject>
java.util.SortedSet<LaneStructure.Entry<T>>getUpstreamObjects(RelativeLane lane, java.lang.Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos)Retrieve objects on a lane of a specific type.voidupdate(DirectedLanePosition pos, Route route, GTUType gtuType)Updates the underlying structure shifting the root position to the input.
-
Method Details
-
update
Updates the underlying structure shifting the root position to the input.- Parameters:
pos- DirectedLanePosition; current position of the GTUroute- Route; current route of the GTUgtuType- GTUType; GTU type- Throws:
GTUException- on a problem while updating the structure
-
getRootRecord
LaneStructureRecord getRootRecord()Returns the root record.- Returns:
- LaneRecord; root record
-
getExtendedCrossSection
java.util.SortedSet<RelativeLane> getExtendedCrossSection()Returns the extended cross-section, which includes all lanes for which a first record is present.- Returns:
- SortedSet; the cross-section
-
getFirstRecord
Returns the first record on the given lane. This is often a record in the current cross section, but it may be one downstream for a lane that starts further downstream.- Parameters:
lane- RelativeLane; lane- Returns:
- first record on the given lane, or
nullif no such record
-
getDownstreamObjects
<T extends LaneBasedObject> java.util.Map<RelativeLane,java.util.SortedSet<LaneStructure.Entry<T>>> getDownstreamObjects(java.lang.Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos) throws GTUExceptionRetrieve objects of a specific type. Returns objects over a maximum length of the look ahead distance downstream from the relative position, or as far as the lane structure goes.- Type Parameters:
T- type of objects to find- Parameters:
clazz- Class<T>; class of objects to findgtu- LaneBasedGTU; gtupos- RelativePosition.TYPE; relative position to start search from- Returns:
- Map; sorted set of objects of requested type per lane
- Throws:
GTUException- if lane is not in current set
-
getDownstreamObjects
<T extends LaneBasedObject> java.util.SortedSet<LaneStructure.Entry<T>> getDownstreamObjects(RelativeLane lane, java.lang.Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos) throws GTUExceptionRetrieve objects on a lane of a specific type. Returns objects over a maximum length of the look ahead distance downstream from the relative position, or as far as the lane structure goes.- Type Parameters:
T- type of objects to find- Parameters:
lane- RelativeLane; laneclazz- Class<T>; class of objects to findgtu- LaneBasedGTU; gtupos- RelativePosition.TYPE; relative position to start search from- Returns:
- SortedSet; sorted set of objects of requested type
- Throws:
GTUException- if lane is not in current set
-
getDownstreamObjectsOnRoute
<T extends LaneBasedObject> java.util.Map<RelativeLane,java.util.SortedSet<LaneStructure.Entry<T>>> getDownstreamObjectsOnRoute(java.lang.Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos, Route route) throws GTUExceptionRetrieve objects of a specific type. Returns objects over a maximum length of the look ahead distance downstream from the relative position, or as far as the lane structure goes. Objects on links not on the route are ignored.- Type Parameters:
T- type of objects to find- Parameters:
clazz- Class<T>; class of objects to findgtu- LaneBasedGTU; gtupos- RelativePosition.TYPE; relative position to start search fromroute- Route; the route- Returns:
- SortedSet; sorted set of objects of requested type per lane
- Throws:
GTUException- if lane is not in current set
-
getDownstreamObjectsOnRoute
<T extends LaneBasedObject> java.util.SortedSet<LaneStructure.Entry<T>> getDownstreamObjectsOnRoute(RelativeLane lane, java.lang.Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos, Route route) throws GTUExceptionRetrieve objects on a lane of a specific type. Returns objects over a maximum length of the look ahead distance downstream from the relative position, or as far as the lane structure goes. Objects on links not on the route are ignored.- Type Parameters:
T- type of objects to find- Parameters:
lane- RelativeLane; laneclazz- Class<T>; class of objects to findgtu- LaneBasedGTU; gtupos- RelativePosition.TYPE; relative position to start search fromroute- Route; the route- Returns:
- SortedSet; sorted set of objects of requested type
- Throws:
GTUException- if lane is not in current set
-
getUpstreamObjects
<T extends LaneBasedObject> java.util.SortedSet<LaneStructure.Entry<T>> getUpstreamObjects(RelativeLane lane, java.lang.Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos) throws GTUExceptionRetrieve objects on a lane of a specific type. Returns upstream objects from the relative position for as far as the lane structure goes. Distances to upstream objects are given as positive values.- Type Parameters:
T- type of objects to find- Parameters:
lane- RelativeLane; laneclazz- Class<T>; class of objects to findgtu- LaneBasedGTU; gtupos- RelativePosition.TYPE; relative position to start search from- Returns:
- SortedSet; sorted set of objects of requested type
- Throws:
GTUException- if lane is not in current set
-