Java Reference
In-Depth Information
Figure 22.1. A carousel door provides one-touch control with a single button that changes
the door's state.
The diagram in Figure 22.1 is a UML
state machine.
Such diagrams can be much more
informative than a corresponding textual description.
CHALLENGE 22.1
Suppose that you open the door and place a material bin in the doorway. Is there
a way to make the door begin closing without waiting for it to time out?
You can supply a
Door_1
object that the carousel software will update with state changes in
the carousel. (The underscore in the class name is a hint that we will soon refactor this class.)
Figure 22.2 shows the
Door_1
class.