java.lang.Object | +--Counter
Class Counter implements a simple counter.
Constructor Summary | |
Counter()
Set the initial value of the counter to zero |
|
Counter(int initialValue)
Set the initial value of the counter to a given value |
Method Summary | |
void |
decrement()
Decrements the counter by one |
void |
decrementBy(int dec)
Decrements the counter by a given value |
int |
getValue()
Provides access to the value of the counter |
void |
increment()
Increments the counter by one |
void |
incrementBy(int inc)
Increments the counter by a given value |
void |
reset()
Resets the counter to Zero |
void |
setValue(int newValue)
Sets the counter to a new value |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
public Counter()
public Counter(int initialValue)
initialValue
- the initial value of the counterMethod Detail |
public void decrement()
public void decrementBy(int dec)
dec
- The value the counter is decremented by.public int getValue()
public void increment()
public void incrementBy(int inc)
inc
- The value the counter is incremented by.public void reset()
public void setValue(int newValue)
newValue
- The new value of the counter