public class Counter
extends java.lang.Object
Constructor and Description |
---|
Counter()
The default constructor for objects of class Counter.
|
Counter(int min,
int max)
The alternate constructor for objects of class Counter.
|
Modifier and Type | Method and Description |
---|---|
void |
decrease()
Decreases the counter by one
|
boolean |
equals(java.lang.Object otherObject)
Determine if two counters are in the same state
|
void |
increase()
Increases the counter by one
|
boolean |
rolledOver()
Accessor that allows the client to determine if the counter
rolled over on the last count
|
java.lang.String |
toString()
Override the toString method to provide a more informative
description of the counter
|
int |
value()
Get the value of the counter
|
public Counter()
public Counter(int min, int max)
min
- The minimum value that the counter can havemax
- The maximum value that the counter can havepublic boolean equals(java.lang.Object otherObject)
equals
in class java.lang.Object
otherObject
- the object to test against for equalitypublic void increase()
public void decrease()
public int value()
public boolean rolledOver()
public java.lang.String toString()
toString
in class java.lang.Object