Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

HW10 Code Details

  •  Most of the supplied code is support code that you do not have to worry about.   You are certainly free to use whatever you wish, but only the classes listed here should be needed.    
  • You WILL need to make anonymous inner classes and possibly some named classes if you feel you need them.   The staff's solution only uses anonymous inner classes, so it definitely can be done that way.
  •  In viewing the UML diagrams below, keep in mind that a class or interface always inherits all of the methods of its parents, i.e. everything above it.   Just because a class or interface only shows 2 methods in its little box in the UML diagram doesn't mean that's all the methods it has--look at all the methods in its superclasses/superinterfaces too!
  • Don't forget to import a package before attempting to use any of its classes.
  • Check the Javadoc comments of each class to learn more about what each class does.

Student Package

A student is wearing a shirt, pants and socks.   The student also has references to several lists (ordered piles) of garments:  clean shirts, clean pants, clean socks, a dirty clothes pile and a laundry room which is a list of list of garments because it represents the collection of multiple loads of laundered garments that have been cleaned, but not yet folded and returned to the individual clean garment piles.

...

Garments support a visitor, GarmentVisitor, which has cases for each type of visitor.   NEVER test for the type of a Garment object!   Always delegate to it by having the garment object accept a visitor whose different cases provide the garment-type-dependent processing you desire.

...

  • BiList<Garment> is a pile of clothes.
  • insertFront() and remFront() are the methods to insert and remove from the top of the pile respectively.
  • insertRear() and remRear() are the methods to insert and remove from the bottom of the pile respectively.
  • newIterator() is a factory method that will create an iterator for you specifically for that list, initialized to point at the first (top) element of the list.   Do NOT try to make an iterator by instantiating one yourself!
  • Wiki Markup{\[BiLists}}&nbsp; ({{the   (the super-interface BiListI&nbsp;actually}})&nbsp;accept {{BiListIVisitors}} that can be used to perform operations that depend on whether the list is empty or not.&nbsp;&nbsp; That is, {{BiListIVisitor}} has 2 cases, {{forEmpty}} and {{forNonEmpty}}.&nbsp;&nbsp;BiListI actually) accept BiListIVisitors that can be used to perform operations that depend on whether the list is empty or not.   That is, BiListIVisitor has 2 cases, forEmpty and forNonEmpty.  
  • BiLists also have an isEmpty() method that can be used for imperative/procedural-style conditional processing based on the list's emptiness.   Using a delegation-style processing using the BiListIVisitor is recommended however and will result in cleaner code in some cases. 

...