edu.colorado.simulations
Class Washer

java.lang.Object
  extended by edu.colorado.simulations.Washer

public class Washer
extends java.lang.Object

An Washer simulates a simple washing machine.

Java Source Code for this class:
http://www.cs.colorado.edu/~main/edu/colorado/simulations/Washer.java


Constructor Summary
Washer(int s)
          Initialize a washer.
 
Method Summary
 boolean isBusy()
          Determine whether this washer is currently busy.
 void reduceRemainingTime()
          Reduce the remaining time in the current wash cycle by one second.
 void startWashing()
          Start a wash cycle going for this washer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Washer

public Washer(int s)
Initialize a washer. param s the number of seconds required for one wash cyle of this washer
Postcondition:
This washer has been initialized so that it takes s
Method Detail

isBusy

public boolean isBusy()
Determine whether this washer is currently busy.

Parameters:
- - none
Returns:
true if this washer is busy (in a wash cycle); otherwise false

reduceRemainingTime

public void reduceRemainingTime()
Reduce the remaining time in the current wash cycle by one second.

Parameters:
- - none
Postcondition:
If a car is being washed, then the remaining time in the current wash cycle has been reduced by one second.

startWashing

public void startWashing()
Start a wash cycle going for this washer.

Parameters:
- - none
Precondition:
isBusy() is false.
Postcondition:
This washer has started simulating one wash cycle. Therefore, isBusy() will return true until the required number of simulated seonds have passed.
Throws:
java.lang.IllegalStateException - Indicates that this washer is busy.