Interface LaneStructure

All Known Implementing Classes:
RollingLaneStructure

public interface LaneStructure
Interface for lane structures.

Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Method Details

    • update

      void update(LanePosition pos, Route route, GtuType gtuType) throws GtuException
      Updates the underlying structure shifting the root position to the input.
      Parameters:
      pos - LanePosition; current position of the GTU
      route - Route; current route of the GTU
      gtuType - 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 find
      gtu - LaneBasedGtu; gtu
      pos - 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; lane
      clazz - Class<T>; class of objects to find
      gtu - LaneBasedGtu; gtu
      pos - 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 find
      gtu - LaneBasedGtu; gtu
      pos - RelativePosition.TYPE; relative position to start search from
      route - 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; lane
      clazz - Class<T>; class of objects to find
      gtu - LaneBasedGtu; gtu
      pos - RelativePosition.TYPE; relative position to start search from
      route - 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; lane
      clazz - Class<T>; class of objects to find
      gtu - LaneBasedGtu; gtu
      pos - 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