public class Counter
extends java.lang.Object
Constructor and Description |
---|
Counter()
Initializes a new counter starting at 0
|
Counter(int seed)
Initializes a new counter starting at seed
|
Modifier and Type | Method and Description |
---|---|
int |
getCount()
Returns the current value of this counter.
|
int |
getCountThenIncrement()
Returns the current value of this counter and then increase the count.
|
void |
increment()
Increments the counter by 1.
|
void |
increment(int cnt)
Increments the counter by cnt.
|
void |
reset()
Reset counter to 0.
|
java.lang.String |
toString()
Returns a string representation of this counter.
|
public Counter()
public Counter(int seed)
public void reset()
public void increment()
public void increment(int cnt)
public int getCount()
public int getCountThenIncrement()
public java.lang.String toString()
toString
in class java.lang.Object