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 class
LaneStructure.Entry<T extends LaneBasedObject>
Wrapper to hold lane-based object and it's distance.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T extends LaneBasedObject>
Map<RelativeLane,SortedSet<LaneStructure.Entry<T>>>getDownstreamObjects(Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos)
Retrieve objects of a specific type.<T extends LaneBasedObject>
SortedSet<LaneStructure.Entry<T>>getDownstreamObjects(RelativeLane lane, Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos)
Retrieve objects on a lane of a specific type.<T extends LaneBasedObject>
Map<RelativeLane,SortedSet<LaneStructure.Entry<T>>>getDownstreamObjectsOnRoute(Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos, Route route)
Retrieve objects of a specific type.<T extends LaneBasedObject>
SortedSet<LaneStructure.Entry<T>>getDownstreamObjectsOnRoute(RelativeLane lane, Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos, Route route)
Retrieve objects on a lane of a specific type.SortedSet<RelativeLane>
getExtendedCrossSection()
Returns the extended cross-section, which includes all lanes for which a first record is present.LaneStructureRecord
getFirstRecord(RelativeLane lane)
Returns the first record on the given lane.LaneStructureRecord
getRootRecord()
Returns the root record.<T extends LaneBasedObject>
SortedSet<LaneStructure.Entry<T>>getUpstreamObjects(RelativeLane lane, Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos)
Retrieve objects on a lane of a specific type.void
update(DirectedLanePosition pos, Route route, GTUType gtuType)
Updates the underlying structure shifting the root position to the input.
-
-
-
Method Detail
-
update
void update(DirectedLanePosition pos, Route route, GTUType gtuType) throws GTUException
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
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
LaneStructureRecord getFirstRecord(RelativeLane lane)
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
null
if no such record
-
getDownstreamObjects
<T extends LaneBasedObject> Map<RelativeLane,SortedSet<LaneStructure.Entry<T>>> getDownstreamObjects(Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos) throws GTUException
Retrieve 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> SortedSet<LaneStructure.Entry<T>> getDownstreamObjects(RelativeLane lane, Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos) throws GTUException
Retrieve 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> Map<RelativeLane,SortedSet<LaneStructure.Entry<T>>> getDownstreamObjectsOnRoute(Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos, Route route) throws GTUException
Retrieve 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> SortedSet<LaneStructure.Entry<T>> getDownstreamObjectsOnRoute(RelativeLane lane, Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos, Route route) throws GTUException
Retrieve 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> SortedSet<LaneStructure.Entry<T>> getUpstreamObjects(RelativeLane lane, Class<T> clazz, LaneBasedGTU gtu, RelativePosition.TYPE pos) throws GTUException
Retrieve 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
-
-