Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The program includes two class definitions defining unions (composites without recursion): Garment, specifying the representation of garments that appear in the input stream, and Command, specifying the representation of event description commands. Both classes include the hooks required to support the visitor pattern. The data definition for Garment is important because the GUI IOProcess graphical version of the user interface included in the framework animates the state of your implementation before each command. This IOProcess graphical user interface (GUI) expects the garments that appear as elements in lists (as revealed by the EnumI and ReadIteratorI interfaces) to be instances of the Garment class. Hence, you must use the representation of garments that our class Garment provides.

...

Each call on nextCommand returns the next command in the stream provided by the IOProcess object, until it reaches an end-of-file ({<control>-d} from the keyboard). End-of-file is reported as a null reference of type Command.

...

The program passes a boolean debug flag to (TerminalIO). The value of the flag is true iff the command line argument -d or -debug is passed to main .

The Graphical User Interface (GUI

...

)

The initialization of the GUI creates an Acker Student object and associated DoCommandVisitor. Each GUI event triggers the execution of DoCommandVisitor; in some cases, such as reading input from a file, it triggers the execution of DoCommandVisitor on a stream of Commands. In essence, the event-handling loop built-in to the Java Swing framework is used to drive the computation rather than a separate loop in the main thread such as the one in the simulate method in Student.

...