public abstract class AbstractTrafficLightController extends Object implements TrafficLightController
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 | Field and Description |
|---|---|
protected TrafficLightColor |
currentColor
the current light in the current phase.
|
protected int |
currentPhase
the current phase.
|
protected org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface |
simulator
the simulator.
|
| Constructor and Description |
|---|
AbstractTrafficLightController(String id,
org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface 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, waitgetClearanceDurationToNextPhaseprotected final org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface simulator
protected int currentPhase
protected TrafficLightColor currentColor
public AbstractTrafficLightController(String id, org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface simulator)
id - String; the controller idsimulator - OTSDEVSSimulatorInterface; the simulatorpublic final int getNumberOfPhases()
getNumberOfPhases in interface TrafficLightControllerpublic final int getCurrentPhase()
getCurrentPhase in interface TrafficLightControllerpublic final void addTrafficLightToPhase(int phaseId,
TrafficLight trafficLight)
throws TrafficLightException
addTrafficLightToPhase in interface TrafficLightControllerphaseId - 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 TrafficLightControllerCopyright © 2014–2016 Delft University of Technology. All rights reserved.