Versions Compared

Key

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

...

When doing laundry, Acker removes fifteen (StudentEnvironment.MAX_LOAD) or fewer, if the pile isn't that large) , items from the top of the dirty clothes pile. In the simulation, a load of clothes is laundered and dried instantaneously and placed on a table for clean clothes reserved for Acker in the laundry room. Acker changes clothes so infrequently that the washing and drying time is negligible, so our simulation is a good approximation. The garments in each load of clean clothes are piled in exactly the same order they appeared in the dirty pile. Acker fills the washer and dryer so full that the clothing doesn't get jumbled up.

...

The course staff is providing a framework for writing this program that includes many classes and interfaces. The framework is packaged as a zipped DrJava project laundry.zip\. This file will unzip into a self-contained file tree with root directory laundry HW10. This directory contains the source tree for the laundry framework with root directory edu, a DrJava project file laundry.drjava and two text files sampleIn and sampleOut used by the sample laundry test class following:

  • hw10.drjava -- the DrJava project file for this assignment.   Everything should already be set properly in it.   Just start DrJava and go to the Project/Open... menu item to open it.
  • src folder - the root of the source tree.    The packages are edu.rice.comp211.laundry.XXX, so the actual Java files are quite a ways down.   This is the "Project Root" of the DrJava project.
  • classes folder- the root of the compiled code tree.   This is this is the "Build Directory" of the DrJava project.
  • data folder -- Test files ("xxxIn.txt) and expected output files (xxxOut.txt) that you can use to test your work.   This is the "Working Directory" of the DrJava project.
  • doc folder -- The Javadocs for the project.   Open the index.html file in your browser to see the Javadocs

After unzipping the laundry.zip file, you can open the DrJava laundry project by starting DrJava, setting the Language Level to Full Java, pulling down the Project menu and selecting the Open command. In the file chooser that pops up, select the project profile file laundry.drjava embedded in the file in the unzipped file tree for laundry.zip. You can save the project state at any point during a DrJava session using the Save command in the Project menu. You can also save individual files within the project tests.LaundryTest. Given the text input in sampleIn, your program should generate the text in sampleOut. The provided framework compiles but LaundryTest will fail because most of the members in the key class DoCommandVisitor have been stubbed out.After unzipping the laundry.zip file, you can open the DrJava laundry project by starting DrJava, setting the Language Level to Full Java, pulling down the Project menu and selecting the Open command. In the file chooser that pops up, select the project profile file laundry.drjava embedded in the file in the unzipped file tree for laundry.zip. You can save the project state at any point during a DrJava session using the Save command in the Project menu. You can also save individual files within the project using the Save button on command file or the File menu.

The Test Project commands runs all of the JUnit test files in the project.

Your assignment is to Your assignment is to fill in the stubbed out members of the DoCommandVisitor (members with degenerate bodies (either return; or return nullreturn "";). In the process you may choose to define some new classes to support your DoCommandVisitor class implementation. The Student class which repeatedly invokes DoCommandVisitor models the laundry habits of Acker. In our test simulations, we will typically only create a single instance of Student representing Acker, but your code should support multiple students (e.g., Acker and his brothers) at a time. Since these students do not interact with each other, supporting this form of multiplicity is a trivial consequence of OO coding style used in the framework.

The String return value of the cases of the DoCommandVisitor is the output of processing that Command.    For example, if the expected output of processing a Change command is "doffed blue shirt, donned red shirt"" then that is the String object that you should return from the appropriate case when processing that Change command object, i.e. it accepts your DoCommandVisitor visitor object.    

Testing

Complete testing of your DoCommandVisitor cases is required.

Test each case by creating a test cases that call each case explicitly with known host and Command parameters.   Then proceed to test the visitor as a whole.

See sample laundry test class edu.rice.comp211.laundry.tests.LaundryTest for examples of how to test an entire command both manually and by using an input test file and comparison output file.

The Test Project button in DrJava runs all of the JUnit test files in the project.

Use the test files in the data} folder as guides for inputs and expected outputs.  For example, given the text input in {{sampleIn.txt, your program should generate the text in sampleOut.txt.     testIn.txt is a fairly extensive test.   You'll probably want to start with something smaller such as sampleIn.txt} or {{tinyIn.txt though.

Initially, the provided framework should compile but LaundryTest will fail because most of the members in the key class DoCommandVisitor have been stubbed out.

The Student class includes:

...