Class Counter

java.lang.Object
  extended by Counter

public class Counter
extends java.lang.Object

A simple class for counting things

Author:
Tim Bahls

Constructor Summary
Counter()
          This constructor creates and returns a default counter that starts at zero.
Counter(int startCount)
          This constructor creates and returns a counter that starts at the specified time.
 
Method Summary
 Counter createEquivalentCounter()
          Creates a brand new Counter that has the same counter as this Counter.
 int getCount()
          Returns the current count of this counter.
 void increment()
          Add one to the count.
 void reset()
          Start the count over at zero
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Counter

public Counter()
This constructor creates and returns a default counter that starts at zero.


Counter

public Counter(int startCount)
This constructor creates and returns a counter that starts at the specified time.

Parameters:
startCount - The number at which the counter starts
Method Detail

increment

public void increment()
Add one to the count.


reset

public void reset()
Start the count over at zero


getCount

public int getCount()
Returns the current count of this counter.

Returns:
The current count

createEquivalentCounter

public Counter createEquivalentCounter()
Creates a brand new Counter that has the same counter as this Counter.

Returns:
A new Counter that starts at getCount()