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-2020 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FixedTimeController.SignalGroup
clone()
Clones the object for a cloned simulation.boolean
equals(java.lang.Object obj)
TrafficLightColor
getCurrentColor()
Retrieve the current color of this SignalGroup.Duration
getGreen()
java.lang.String
getId()
Retrieve the id of this signal group.Duration
getOffset()
Duration
getPreGreen()
Duration
getRed()
ImmutableSet<java.lang.String>
getTrafficLightIds()
ImmutableList<TrafficLight>
getTrafficLights()
Duration
getYellow()
int
hashCode()
void
startup(Duration controllerOffset, Duration cycleTime, OTSSimulatorInterface theSimulator, 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.String
toString()
-
-
-
Constructor Detail
-
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 Detail
-
getId
public java.lang.String getId()
Retrieve the id of this signal group.- Specified by:
getId
in interfaceIdentifiable
- Returns:
- String
-
startup
public void startup(Duration controllerOffset, Duration cycleTime, OTSSimulatorInterface theSimulator, Network network) throws SimRuntimeException
Connect 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;theSimulator
- OTSSimulatorInterface;network
- Network;- Throws:
SimRuntimeException
- when traffic light does not exist in the network
-
clone
public FixedTimeController.SignalGroup clone()
Clones the object for a cloned simulation.- Overrides:
clone
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
getTrafficLights
public final ImmutableList<TrafficLight> getTrafficLights()
- Returns:
- trafficLights.
-
getRed
public final Duration getRed()
- Returns:
- red.
-
getTrafficLightIds
public final ImmutableSet<java.lang.String> getTrafficLightIds()
- Returns:
- trafficLightIds.
-
getOffset
public final Duration getOffset()
- Returns:
- offset.
-
getPreGreen
public final Duration getPreGreen()
- Returns:
- preGreen.
-
getGreen
public final Duration getGreen()
- Returns:
- green.
-
getYellow
public final Duration getYellow()
- Returns:
- yellow.
-
getCurrentColor
public TrafficLightColor getCurrentColor()
Retrieve the current color of this SignalGroup.- Returns:
- TrafficLightColor; the current color of this signal group.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-