Class Sequencer
java.lang.Object
|
+--Sequencer
- public class Sequencer
- extends Object
A Sequencer controls a TrafficLight. It maintains fields
for the light itself and the current state of the light.
Each time it receives a "next" message, it advances to the
next state and sends the light an appropriate message.
- Version:
- 1
Constructor Summary |
Sequencer(TrafficLight light)
Construct a sequencer to control a TrafficLight. |
Method Summary |
void |
next()
How the light changes when a next Button is pressed
depends on the current state. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Sequencer
public Sequencer(TrafficLight light)
- Construct a sequencer to control a TrafficLight.
- Parameters:
light
- the TrafficLight we wish to control.
next
public void next()
- How the light changes when a next Button is pressed
depends on the current state. The sequence is
GO -> CAUTION -> STOP -> GO.