Class Platoon
- java.lang.Object
-
- org.opentrafficsim.road.gtu.lane.tactical.cacc.Platoon
-
public class Platoon extends Object
Platoon meta data.Copyright (c) 2013-2017 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 22 okt. 2018
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Constructor Summary
Constructors Constructor Description Platoon()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddGtu(String id)Adds a GTU to the platoon.voidaddLaneChange(GTU gtu)Add a lane change as it's finished.booleancanInitiateLaneChangeProcess()Returns whether the platoon is ready for a lane change (i.e.StringgetId(int index)Returns the GTU id of the indexintgetIndex(String gtuId)Returns the index of the GTU in the platoon, with the leader0.voidinitiateLaneChange(LateralDirectionality laneChangeDirection)Initiates a lane change.booleanisInPlatoon(String gtuId)Returns whether the GTU is the platoon.booleanlaneChangeInProgress()Returns true when a lane change is in progressintnumberOfChanged()Number of gtus that have changed lanesLateralDirectionalityshouldChangeLane(String gtuId)Returns the direction in which the GTU should change lane.intsize()Returns the size of the platoon.
-
-
-
Method Detail
-
addGtu
public void addGtu(String id)
Adds a GTU to the platoon. This is done by a generator listener.- Parameters:
id- String; GTU id
-
size
public int size()
Returns the size of the platoon.- Returns:
- int; size of the platoon
-
getId
public String getId(int index)
Returns the GTU id of the index- Parameters:
index- int; index position of gtuList- Returns:
- String; id of gtu on index position; NULL is none?
-
addLaneChange
public void addLaneChange(GTU gtu)
Add a lane change as it's finished. This will reset the lane change when all GTUs in the platoon changed lane.- Parameters:
gtu- GTU; gtu
-
canInitiateLaneChangeProcess
public boolean canInitiateLaneChangeProcess()
Returns whether the platoon is ready for a lane change (i.e. not in the process of a lane change).- Returns:
- boolean; whether the platoon is ready for a lane change (i.e. not in the process of a lane change)
-
initiateLaneChange
public void initiateLaneChange(LateralDirectionality laneChangeDirection)
Initiates a lane change.- Parameters:
laneChangeDirection- LateralDirectionality; direction of the lane change
-
getIndex
public int getIndex(String gtuId)
Returns the index of the GTU in the platoon, with the leader0.- Parameters:
gtuId- String; GTU id- Returns:
- int; index of the GTU in the platoon, with the leader
0
-
isInPlatoon
public boolean isInPlatoon(String gtuId)
Returns whether the GTU is the platoon.- Parameters:
gtuId- String; GTU id- Returns:
- boolean; whether the GTU is the platoon
-
shouldChangeLane
public LateralDirectionality shouldChangeLane(String gtuId)
Returns the direction in which the GTU should change lane.- Parameters:
gtuId- String; GTU id- Returns:
- LateralDirectionality; direction to change to, or
NONE
-
laneChangeInProgress
public boolean laneChangeInProgress()
Returns true when a lane change is in progress- Returns:
- boolean; whether a lane change is currently in progress
-
numberOfChanged
public int numberOfChanged()
Number of gtus that have changed lanes- Returns:
- int; number of gtus changed lanes currently
-
-