edu.rice.comp211.laundry.garment
Class AGarmentVisitor<R>

java.lang.Object
  extended by edu.rice.comp211.laundry.garment.AGarmentVisitor<R>
Type Parameters:
R - the return type of the visitor
All Implemented Interfaces:
GarmentVisitor<R>

public abstract class AGarmentVisitor<R>
extends Object
implements GarmentVisitor<R>

Abstract GarmentVisitor that provides default behavior for non-overridden methods. Sub-classes merely have to supply a default return value and override only the methods that they need. This is just a convenience class to simply coding under specific situations. There is NO requirement that Garment visitors be subclasses of this class!

Author:
swong

Constructor Summary
AGarmentVisitor(R defaultReturn)
          Constructor for the class
 
Method Summary
 R forNullGarment(NullGarment g)
          NullGarment case of the visitor
 R forPants(Pants p)
          Pants case of the visitor
 R forShirt(Shirt s)
          Shirt case of the visitor
 R forSocks(Socks s)
          Socks case of the visitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AGarmentVisitor

public AGarmentVisitor(R defaultReturn)
Constructor for the class

Parameters:
defaultReturn - the default value to return if a method is not overridden.
Method Detail

forShirt

public R forShirt(Shirt s)
Description copied from interface: GarmentVisitor
Shirt case of the visitor

Specified by:
forShirt in interface GarmentVisitor<R>
Parameters:
s - The Shirt host
Returns:
The return value of the visitor

forPants

public R forPants(Pants p)
Description copied from interface: GarmentVisitor
Pants case of the visitor

Specified by:
forPants in interface GarmentVisitor<R>
Parameters:
p - The Pants host
Returns:
The return value of the visitor

forSocks

public R forSocks(Socks s)
Description copied from interface: GarmentVisitor
Socks case of the visitor

Specified by:
forSocks in interface GarmentVisitor<R>
Parameters:
s - The Socks host
Returns:
The return value of the visitor

forNullGarment

public R forNullGarment(NullGarment g)
Description copied from interface: GarmentVisitor
NullGarment case of the visitor

Specified by:
forNullGarment in interface GarmentVisitor<R>
Parameters:
g - The NullGarment host
Returns:
The return value of the visitor