Class FixedTimeController.SignalGroup
java.lang.Object
org.opentrafficsim.trafficcontrol.FixedTimeController.SignalGroup
- All Implemented Interfaces:
Identifiable
- Enclosing class:
- FixedTimeController
public static class FixedTimeController.SignalGroup extends java.lang.Object implements Identifiable
Fixed time signal group.
Copyright (c) 2013-2019 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 21 feb. 2019
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Constructor Summary
Constructors Constructor Description SignalGroup(java.lang.String id, java.util.Set<java.lang.String> trafficLightIds, Duration offset, Duration green, Duration yellow)Constructor without pre-green duration.SignalGroup(java.lang.String id, java.util.Set<java.lang.String> trafficLightIds, Duration offset, Duration preGreen, Duration green, Duration yellow)Constructor with pre-green duration. -
Method Summary
Modifier and Type Method Description FixedTimeController.SignalGroupclone()Clones the object for a cloned simulation.booleanequals(java.lang.Object obj)TrafficLightColorgetCurrentColor()Retrieve the current color of this SignalGroup.DurationgetGreen()java.lang.StringgetId()Retrieve the id of this signal group.DurationgetOffset()DurationgetPreGreen()DurationgetRed()ImmutableSet<java.lang.String>getTrafficLightIds()ImmutableList<TrafficLight>getTrafficLights()DurationgetYellow()inthashCode()voidstartup(Duration controllerOffset, Duration cycleTime, OTSSimulatorInterface simulator, Network network)Connect to the traffic lights in the network, initialize the traffic lights to their initial color and schedule the first transitions.java.lang.StringtoString()
-
Constructor Details
-
SignalGroup
public SignalGroup(java.lang.String id, java.util.Set<java.lang.String> trafficLightIds, Duration offset, Duration green, Duration yellow)Constructor without pre-green duration.- Parameters:
id- String; idtrafficLightIds- Set<String>; traffic light idsoffset- Duration; offset from start of cyclegreen- Duration; green durationyellow- Duration; yellow duration
-
SignalGroup
public SignalGroup(java.lang.String id, java.util.Set<java.lang.String> trafficLightIds, Duration offset, Duration preGreen, Duration green, Duration yellow)Constructor with pre-green duration.- Parameters:
id- String; idtrafficLightIds- Set<String>; traffic light idsoffset- Duration; offset from start of cyclepreGreen- Duration; pre-green durationgreen- Duration; green durationyellow- Duration; yellow duration
-
-
Method Details
-
getId
public java.lang.String getId()Retrieve the id of this signal group.- Specified by:
getIdin interfaceIdentifiable- Returns:
- String
-
startup
public void startup(Duration controllerOffset, Duration cycleTime, OTSSimulatorInterface simulator, Network network) throws SimRuntimeExceptionConnect to the traffic lights in the network, initialize the traffic lights to their initial color and schedule the first transitions.- Parameters:
controllerOffset- Duration;cycleTime- Duration;simulator- OTSSimulatorInterface;network- Network;- Throws:
SimRuntimeException- when traffic light does not exist in the network
-
clone
Clones the object for a cloned simulation.- Overrides:
clonein classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
getTrafficLights
- Returns:
- trafficLights.
-
getRed
- Returns:
- red.
-
getTrafficLightIds
- Returns:
- trafficLightIds.
-
getOffset
- Returns:
- offset.
-
getPreGreen
- Returns:
- preGreen.
-
getGreen
- Returns:
- green.
-
getYellow
- Returns:
- yellow.
-
getCurrentColor
Retrieve the current color of this SignalGroup.- Returns:
- TrafficLightColor; the current color of this signal group.
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-