|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectCounter
public class Counter
Class to represent an integer counter.
COMP 1600, Project 3, Spring 2014.
Field Summary | |
---|---|
static int |
MINIMUM
Minimum value of the counter (0). |
Constructor Summary | |
---|---|
Counter(int max)
Create Counter with initial value MINIMUM and specified maximum. |
|
Counter(int count,
int max)
Create Counter with specified initial value and maximum. |
Method Summary | |
---|---|
void |
decrement()
Decrement counter value. |
int |
getCount()
Retrieve current counter value. |
void |
increment()
Increment counter value. |
boolean |
isAtMaximum()
Test whether or not counter is at maximum value. |
boolean |
isAtMinimum()
Test whether or not counter is at minimum value (MINIMUM). |
void |
reset()
Reset counter to MINIMUM. |
java.lang.String |
toString()
Produce and return String representation of counter value. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MINIMUM
Constructor Detail |
---|
public Counter(int count, int max)
count
- Initial value. MINIMUM <= count <= maxmax
- Maximum value of the counter.public Counter(int max)
max
- Maximum value of the counter.Method Detail |
---|
public void increment()
public void decrement()
public int getCount()
public void reset()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isAtMaximum()
public boolean isAtMinimum()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |