models
Class Clock

java.lang.Object
  extended by models.Clock
All Implemented Interfaces:
ClockSpecification, HasInvariant

public class Clock
extends java.lang.Object
implements ClockSpecification


Constructor Summary
Clock()
           
Clock(int numberOfTicks)
           
 
Method Summary
 int getTime()
          Tested by JUnit_ClockSpecification.test_getTime()
 boolean invariant()
          Tested by JUnit_ClockSpecification.test_invariant()
 void resetClock()
          Set the clock timer to 0
Tested by JUnit_ClockSpecification.test_resetClock()
 void setClock(int x)
          Set the clock to a specific value
Tested by tests.JUnit_ClockSpecification#test_setClock(int)
 void tick()
          Increment the clock by 1 unit
Tested by JUnit_ClockSpecification.test_tick()
 void tick(int x)
          Increment the clock
Tested by JUnit_ClockSpecification.test_tick_int()
 java.lang.String toString()
          Typical string format: Clock ticks = 0
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Clock

public Clock()

Clock

public Clock(int numberOfTicks)
      throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException
Method Detail

getTime

public int getTime()
Description copied from interface: ClockSpecification
Tested by JUnit_ClockSpecification.test_getTime()

Specified by:
getTime in interface ClockSpecification
Returns:
the time value representing a number of ticks

invariant

public boolean invariant()
Description copied from interface: ClockSpecification
Tested by JUnit_ClockSpecification.test_invariant()

Specified by:
invariant in interface ClockSpecification
Specified by:
invariant in interface HasInvariant
Returns:
true iff the number of ticks is non-negative

resetClock

public void resetClock()
Description copied from interface: ClockSpecification
Set the clock timer to 0
Tested by JUnit_ClockSpecification.test_resetClock()

Specified by:
resetClock in interface ClockSpecification

setClock

public void setClock(int x)
              throws java.lang.IllegalArgumentException
Description copied from interface: ClockSpecification
Set the clock to a specific value
Tested by tests.JUnit_ClockSpecification#test_setClock(int)

Specified by:
setClock in interface ClockSpecification
Throws:
java.lang.IllegalArgumentException - when x is negative

tick

public void tick()
Description copied from interface: ClockSpecification
Increment the clock by 1 unit
Tested by JUnit_ClockSpecification.test_tick()

Specified by:
tick in interface ClockSpecification

tick

public void tick(int x)
          throws java.lang.IllegalArgumentException
Description copied from interface: ClockSpecification
Increment the clock
Tested by JUnit_ClockSpecification.test_tick_int()

Specified by:
tick in interface ClockSpecification
Parameters:
x - is the number of time units by which the clock should be incremented
Throws:
java.lang.IllegalArgumentException - when x is negative

toString

public java.lang.String toString()
Typical string format:
 Clock ticks = 0
 

Overrides:
toString in class java.lang.Object