public class LaneStructure extends Object implements Serializable
     (---- a ----)(---- b ----)(---- c ----)(---- d ----)(---- e ----)(---- f ----)(---- g ----)  
                                             __________                             __________
                                            / _________ 1                          / _________ 2
                                           / /                                    / /
                                __________/ /             _______________________/ /
  1  ____________ ____________ /_ _ _ _ _ _/____________ /_ _ _ _ _ _ _ _ _ _ _ _ /      
  0 |_ _X_ _ _ _ |_ _ _ _ _ _ |_ _ _ _ _ _ |_ _ _ _ _ _ |_ _ _ _ _ _ |_ _ _ _ _ _ \____________
 -1 |____________|_ _ _ _ _ _ |____________|____________|  __________|____________|____________| 3
 -2              / __________/                           \ \  
        ________/ /                                       \ \___________  
      5 _________/                                         \____________  4
 
 
 When the GTU is looking ahead, it needs to know that when it continues to destination 3, it needs to shift one lane to the
 right at some point, but not two lanes to the right in link b, and not later than at the end of link f. When it needs
 to go to destination 1, it needs to shift to the left in link c. When it has to go to destination 2, it has to shift to the
 left, but not earlier than at link e. At node [de], it is possible to leave the rightmost lane of link e, and go to
 destination 4. The rightmost lane just splits into two lanes at the end of link d, and the GTU can either continue driving to
 destination 3, turn right to destination 4. This means that the right lane of link d has two successor lanes.
 In the data structures, lanes are numbered laterally. Suppose that the lane where vehicle X resides would be number 0. Consistent with "left is positive" for angles, the lane right of X would have number -1, and entry 5 would have number -2.
In the data structure, this can be indicated as follows (N = next, P = previous, L = left, R = right, D = lane drop, . = continued but not in this structure). The merge lane in b is considered "off limits" for the GTUs on the "main" lane -1; the "main" lane 0 is considered off limits from the exit lanes on c, e, and f. Still, we need to maintain pointers to these lanes, as we are interested in the GTUs potentially driving next to us, feeding into our lane, etc.
       1                0               -1               -2
       
                       ROOT 
                   _____|_____      ___________      ___________            
                  |_-_|_._|_R_|----|_L_|_._|_-_|    |_-_|_._|_-_|  a           
                        |                |                |
                   _____V_____      _____V_____      _____V_____            
                  |_-_|_N_|_R_|----|_L_|_N_|_R_|<---|_L_|_D_|_-_|  b           
                        |                |                 
  ___________      _____V_____      _____V_____                 
 |_-_|_N_|_R_|<---|_L_|_N_|_R_|----|_L_|_N_|_-_|                   c
       |                |                |                 
  _____V_____      _____V_____      _____V_____                 
 |_-_|_._|_-_|    |_-_|_N_|_R_|----|_L_|_NN|_-_|                   d          
                        |                ||_______________ 
  ___________      _____V_____      _____V_____      _____V_____            
 |_-_|_N_|_R_|<---|_L_|_N_|_R_|----|_L_|_N_|_-_|    |_-_|_N_|_-_|  e          
       |                |                |                |
  _____V_____      _____V_____      _____V_____      _____V_____            
 |_-_|_N_|_R_|<---|_L_|_D_|_R_|----|_L_|_N_|_-_|    |_-_|_._|_-_|  f          
       |                                 |                 
  _____V_____                       _____V_____                             
 |_-_|_._|_-_|                     |_-_|_._|_-_|                   g
 
 
 Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. 
 BSD-style license. See OpenTrafficSim License.
 
| Modifier and Type | Class and Description | 
|---|---|
static class  | 
LaneStructure.Entry<T extends LaneBasedObject>
 Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. 
 | 
| Constructor and Description | 
|---|
LaneStructure(LaneStructureRecord rootLSR,
             org.djunits.value.vdouble.scalar.Length lookAhead)  | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addLaneStructureRecord(LaneStructureRecord lsr,
                      RelativeLane relativeLane)
Adds a lane structure record in a mapping from relative lanes. 
 | 
SortedSet<RelativeLane> | 
getCrossSection()
Returns the cross section. 
 | 
<T extends LaneBasedObject> | 
getDownstreamObjects(RelativeLane lane,
                    Class<T> clazz,
                    org.opentrafficsim.core.gtu.GTU gtu,
                    org.opentrafficsim.core.gtu.RelativePosition.TYPE pos)
Retrieve objects on a lane of a specific type. 
 | 
<T extends LaneBasedObject> | 
getDownstreamObjectsOnRoute(RelativeLane lane,
                           Class<T> clazz,
                           org.opentrafficsim.core.gtu.GTU gtu,
                           org.opentrafficsim.core.gtu.RelativePosition.TYPE pos,
                           org.opentrafficsim.core.network.route.Route route)
Retrieve objects on a lane of a specific type. 
 | 
LaneStructureRecord | 
getLaneLSR(RelativeLane lane)  | 
LaneStructureRecord | 
getRootLSR()  | 
<T extends LaneBasedObject> | 
getUpstreamObjects(RelativeLane lane,
                  Class<T> clazz,
                  org.opentrafficsim.core.gtu.GTU gtu,
                  org.opentrafficsim.core.gtu.RelativePosition.TYPE pos)
Retrieve objects on a lane of a specific type. 
 | 
void | 
removeInvalidMappings(Map<RelativeLane,?> map)
Removes all mappings to relative lanes that are not in the most recent cross section. 
 | 
String | 
toString() | 
public LaneStructure(LaneStructureRecord rootLSR, org.djunits.value.vdouble.scalar.Length lookAhead)
rootLSR - the root record.lookAhead - look ahead distancepublic final LaneStructureRecord getRootLSR()
public final SortedSet<RelativeLane> getCrossSection()
public final LaneStructureRecord getLaneLSR(RelativeLane lane) throws org.opentrafficsim.core.gtu.GTUException
lane - lane to checkorg.opentrafficsim.core.gtu.GTUException - if the lane is not in the cross sectionpublic final void removeInvalidMappings(Map<RelativeLane,?> map)
map - map to clear mappings frompublic final void addLaneStructureRecord(LaneStructureRecord lsr, RelativeLane relativeLane)
lsr - lane structure recordrelativeLane - relative lanepublic final <T extends LaneBasedObject> SortedSet<LaneStructure.Entry<T>> getDownstreamObjects(RelativeLane lane, Class<T> clazz, org.opentrafficsim.core.gtu.GTU gtu, org.opentrafficsim.core.gtu.RelativePosition.TYPE pos) throws org.opentrafficsim.core.gtu.GTUException
T - type of objects to findlane - laneclazz - class of objects to findgtu - gtupos - relative position to start search fromorg.opentrafficsim.core.gtu.GTUException - if lane is not in current setpublic final <T extends LaneBasedObject> SortedSet<LaneStructure.Entry<T>> getDownstreamObjectsOnRoute(RelativeLane lane, Class<T> clazz, org.opentrafficsim.core.gtu.GTU gtu, org.opentrafficsim.core.gtu.RelativePosition.TYPE pos, org.opentrafficsim.core.network.route.Route route) throws org.opentrafficsim.core.gtu.GTUException
T - type of objects to findlane - laneclazz - class of objects to findgtu - gtupos - relative position to start search fromroute - the routeorg.opentrafficsim.core.gtu.GTUException - if lane is not in current setpublic final <T extends LaneBasedObject> SortedSet<LaneStructure.Entry<T>> getUpstreamObjects(RelativeLane lane, Class<T> clazz, org.opentrafficsim.core.gtu.GTU gtu, org.opentrafficsim.core.gtu.RelativePosition.TYPE pos) throws org.opentrafficsim.core.gtu.GTUException
T - type of objects to findlane - laneclazz - class of objects to findgtu - gtupos - relative position to start search fromorg.opentrafficsim.core.gtu.GTUException - if lane is not in current setCopyright © 2014–2017 Delft University of Technology. All rights reserved.