Class LazyLoadingRoadPosition
java.lang.Object
org.eclipse.mosaic.lib.routing.database.LazyLoadingRoadPosition
- All Implemented Interfaces:
Serializable,IRoadPosition
Provides information about a road position. All missing information is gathered lazy by requesting the scenario-database as soon as the respective getter method is called. Those information is cached for later calls of the same method by storing the respective items from the scenario-database.
Note, a minimum knowledge about the road position is always needed:
- Previous node (id) and upcoming node (id), or
- Connection (id) and previous node (id)
For example, if the connection and the previous node is given, the upcoming node is calculated as soon as the
method getUpcomingNode() is called. The information gathered is then being cached in case the method
is called again.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionLazyLoadingRoadPosition(IRoadPosition currentRoadPosition, Database database) Creates anIRoadPositionobject which provides further values taken from the givenDatabase, based on the givenIRoadPositionwhich only provides little information.LazyLoadingRoadPosition(LazyLoadingConnection connection, LazyLoadingNode previousNode, LazyLoadingNode upcomingNode, double roadOffset) Creates anIRoadPositionwith all required information provided. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the connection the vehicle is currently driving on.Returns the ID of the connection the vehicle currently driving on.intReturns the index of the lane, where 0 is the rightmost lane.doubleReturns the lateral position of the vehicle on its current lane measured in m.doubleReturns the distance (in m) from the start node of the road segment to the current position of the vehicle.Returns the previously traversed node.Returns the node which will be traversed next.inthashCode()
-
Constructor Details
-
LazyLoadingRoadPosition
public LazyLoadingRoadPosition(LazyLoadingConnection connection, LazyLoadingNode previousNode, LazyLoadingNode upcomingNode, double roadOffset) Creates anIRoadPositionwith all required information provided.- Parameters:
connection- the connection this road position can be found onpreviousNode- the previous node which is part of the given connection and lies behind this road positionupcomingNode- the upcoming node which is part of the given connection and lies in front of this road positionroadOffset- the distance in meters from the previous node to the exact road position
-
LazyLoadingRoadPosition
Creates anIRoadPositionobject which provides further values taken from the givenDatabase, based on the givenIRoadPositionwhich only provides little information.- Parameters:
currentRoadPosition- theIRoadPositionwhich only contains little information, such as upcoming and previous node idsdatabase- a reference to the scenarioDatabasewhich is used to obtain missing information
-
-
Method Details
-
getConnectionId
Description copied from interface:IRoadPositionReturns the ID of the connection the vehicle currently driving on.- Specified by:
getConnectionIdin interfaceIRoadPosition
-
getLaneIndex
public int getLaneIndex()Description copied from interface:IRoadPositionReturns the index of the lane, where 0 is the rightmost lane.- Specified by:
getLaneIndexin interfaceIRoadPosition
-
getLateralLanePosition
public double getLateralLanePosition()Description copied from interface:IRoadPositionReturns the lateral position of the vehicle on its current lane measured in m.- Specified by:
getLateralLanePositionin interfaceIRoadPosition
-
getOffset
public double getOffset()Description copied from interface:IRoadPositionReturns the distance (in m) from the start node of the road segment to the current position of the vehicle.- Specified by:
getOffsetin interfaceIRoadPosition
-
getPreviousNode
Description copied from interface:IRoadPositionReturns the previously traversed node.- Specified by:
getPreviousNodein interfaceIRoadPosition
-
getUpcomingNode
Description copied from interface:IRoadPositionReturns the node which will be traversed next.- Specified by:
getUpcomingNodein interfaceIRoadPosition
-
getConnection
Description copied from interface:IRoadPositionReturns the connection the vehicle is currently driving on. A connection is defined as a link between two junctions. Returns the connection the vehicle is currently on.- Specified by:
getConnectionin interfaceIRoadPosition
-
hashCode
public int hashCode() -
equals
-