edu.rice.comp211.laundry.student
Class Student

java.lang.Object
  extended by edu.rice.comp211.laundry.student.Student
All Implemented Interfaces:
StudentEnvironment

public class Student
extends Object
implements StudentEnvironment

Represents a student and their environment


Field Summary
 
Fields inherited from interface edu.rice.comp211.laundry.student.StudentEnvironment
MAX_LOAD
 
Constructor Summary
Student(String name, Shirt shirt, Pants pants, Socks socks)
          Constructor for the class
Student(String name, Shirt shirt, Pants pants, Socks socks, BiListI<Garment> cleanShirts, BiListI<Garment> cleanPants, BiListI<Garment> cleanSocks, BiListI<Garment> dirtyPile, BiListI<BiListI<Garment>> laundryRoom)
          Constructor for the class
 
Method Summary
 BiListI<Garment> cleanPants()
          Accessor for the pile of clean pants
 BiListI<Garment> cleanShirts()
          Accessor for the pile of clean shirts
 BiListI<Garment> cleanSocks()
          Accessor for the pile of clean socks
 BiListI<Garment> dirtyPile()
          Accessor for the pile of dirty clothes
 boolean equals(Object o)
          Tests for equality with another object
 void execute(Command cmd, IOProcess io)
          Executes a single command cmd, updating the state of student and generating specified PrintStream output to System.out.
 CommandVisitor<String> getCommandVisitor()
          Factory method for a CommandVisitor<String> that can be used to process Commands for this student
 BiListI<BiListI<Garment>> laundryRoom()
          Accessor for the laundry room
 String name()
          Accessor for the student's name
 Pants pants()
          The current pants the student is wearing
 void pants(Pants pPants)
          Settor for the current pants the student is wearing
 Shirt shirt()
          The current shirt the student is wearing
 void shirt(Shirt pShirt)
          Settor for the current shirt the student is wearing
 void simulate(IOProcess io, boolean debug)
          Run a simulation (a series of commands) on the student
 Socks socks()
          The current socks the student is wearing
 void socks(Socks pSocks)
          Settor for the current socks the student is wearing
 String toString()
          a string representation of the student
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Student

public Student(String name,
               Shirt shirt,
               Pants pants,
               Socks socks)
Constructor for the class

Parameters:
name - the student's name
shirt - the initial shirt the student is wearing
pants - the initial pants the student is wearing
socks - the initial socks the student is wearing

Student

public Student(String name,
               Shirt shirt,
               Pants pants,
               Socks socks,
               BiListI<Garment> cleanShirts,
               BiListI<Garment> cleanPants,
               BiListI<Garment> cleanSocks,
               BiListI<Garment> dirtyPile,
               BiListI<BiListI<Garment>> laundryRoom)
Constructor for the class

Parameters:
name - the student's name
shirt - the initial shirt the student is wearing
pants - the initial pants the student is wearing
socks - the initial socks the student is wearing
cleanShirts - the list to use as the clean shirts pile
cleanPants - the list to use as the clean pants pile
cleanSocks - the list to use as the clean socks pile
dirtyPile - the list to use as the dirty clothes pile
laundryRoom - the list of lists to use as the laundry room
Method Detail

name

public String name()
Accessor for the student's name

Specified by:
name in interface StudentEnvironment
Returns:
the student's name

shirt

public Shirt shirt()
The current shirt the student is wearing

Specified by:
shirt in interface StudentEnvironment
Returns:
the student's current shirt

pants

public Pants pants()
The current pants the student is wearing

Specified by:
pants in interface StudentEnvironment
Returns:
the student's current pants

socks

public Socks socks()
The current socks the student is wearing

Specified by:
socks in interface StudentEnvironment
Returns:
the student's current socks

shirt

public void shirt(Shirt pShirt)
Settor for the current shirt the student is wearing

Parameters:
pShirt - the new shirt to wear

pants

public void pants(Pants pPants)
Settor for the current pants the student is wearing

Parameters:
pPants - the new pants to wear

socks

public void socks(Socks pSocks)
Settor for the current socks the student is wearing

Parameters:
pSocks - the new socks to wear

cleanShirts

public BiListI<Garment> cleanShirts()
Accessor for the pile of clean shirts

Specified by:
cleanShirts in interface StudentEnvironment
Returns:
the clean shirts pile

cleanPants

public BiListI<Garment> cleanPants()
Accessor for the pile of clean pants

Specified by:
cleanPants in interface StudentEnvironment
Returns:
the clean pants pile

cleanSocks

public BiListI<Garment> cleanSocks()
Accessor for the pile of clean socks

Specified by:
cleanSocks in interface StudentEnvironment
Returns:
the clean socks pile

dirtyPile

public BiListI<Garment> dirtyPile()
Accessor for the pile of dirty clothes

Specified by:
dirtyPile in interface StudentEnvironment
Returns:
the dirty clothes pile

laundryRoom

public BiListI<BiListI<Garment>> laundryRoom()
Accessor for the laundry room

Specified by:
laundryRoom in interface StudentEnvironment
Returns:
the laundry room list of lists.

equals

public boolean equals(Object o)
Tests for equality with another object

Overrides:
equals in class Object
Returns:
true if the other object is a student with equal name, clothes and all clothes piles. false otherwise.

toString

public String toString()
a string representation of the student

Overrides:
toString in class Object
Returns:
a string with the student's information

simulate

public void simulate(IOProcess io,
                     boolean debug)
              throws IOException
Run a simulation (a series of commands) on the student

Parameters:
io - the IOProcess that supplies commands as well as status display capabilities
debug - a flag used for debugging
Throws:
IOException - if an I/O error occurs.

execute

public void execute(Command cmd,
                    IOProcess io)
Executes a single command cmd, updating the state of student and generating specified PrintStream output to System.out.

Parameters:
cmd - the Command object to execute
io - used to print the resultant status string.

getCommandVisitor

public CommandVisitor<String> getCommandVisitor()
Factory method for a CommandVisitor<String> that can be used to process Commands for this student

Returns:
a DoCommandVisitor instance