public abstract class AbstractTrafficLightController extends Object implements TrafficLightController
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.
Modifier and Type | Field and Description |
---|---|
protected TrafficLightColor |
currentColor
the current light in the current phase.
|
protected int |
currentPhase
the current phase.
|
protected DEVSSimulatorInterface.TimeDoubleUnit |
simulator
the simulator.
|
Constructor and Description |
---|
AbstractTrafficLightController(String id,
DEVSSimulatorInterface.TimeDoubleUnit simulator)
Create a fixed time controller.
|
Modifier and Type | Method and Description |
---|---|
void |
addTrafficLightToPhase(int phaseId,
TrafficLight trafficLight)
Add a traffic light to a phase.
|
int |
getCurrentPhase() |
String |
getId() |
int |
getNumberOfPhases() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getClearanceDurationToNextPhase
protected final DEVSSimulatorInterface.TimeDoubleUnit simulator
protected int currentPhase
protected TrafficLightColor currentColor
public AbstractTrafficLightController(String id, DEVSSimulatorInterface.TimeDoubleUnit simulator)
id
- String; the controller idsimulator
- DEVSSimulatorInterface.TimeDoubleUnit; the simulatorpublic final int getNumberOfPhases()
getNumberOfPhases
in interface TrafficLightController
public final int getCurrentPhase()
getCurrentPhase
in interface TrafficLightController
public final void addTrafficLightToPhase(int phaseId, TrafficLight trafficLight) throws TrafficLightException
addTrafficLightToPhase
in interface TrafficLightController
phaseId
- int; the id of the phase.trafficLight
- TrafficLight; the traffic light to addTrafficLightException
- when the phase was not createdpublic final String getId()
getId
in interface Identifiable
getId
in interface TrafficLightController
Copyright © 2014–2019 Delft University of Technology. All rights reserved.