|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Number
com.aliasi.util.Counter
public class Counter
A reassignable integer usable for counting. Counters do not
override Obect's methods hashCode() or
equals(), so two counters with the same value are not
necessarily equal.
The value of a counter is stored as an integer. No checks are done in the increment methods to ensure that the results remain within bounds.
| Constructor Summary | |
|---|---|
Counter()
Create a counter with initial count 0. |
|
Counter(int count)
Create a counter with the specified count value. |
|
| Method Summary | |
|---|---|
double |
doubleValue()
Returns the value of this counter as a double. |
float |
floatValue()
Returns the value of this counter as a float. |
void |
increment()
Increments the current count value. |
void |
increment(int n)
Increment the count value by the specified amount. |
int |
intValue()
Returns the value of this counter as an int. |
long |
longValue()
Returns the value of this counter as a long. |
void |
set(int count)
Sets the count to the specified value. |
String |
toString()
Return a string representation of this counter's value. |
int |
value()
Returns the current count value. |
| Methods inherited from class java.lang.Number |
|---|
byteValue, shortValue |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Counter()
0.
public Counter(int count)
count - Initial value of counter.| Method Detail |
|---|
public int value()
public void increment()
public void increment(int n)
n - Amount by which to increase the count value.public void set(int count)
count - New value of the counter.public double doubleValue()
doubleValue in class Numberpublic float floatValue()
floatValue in class Numberpublic int intValue()
intValue in class Numberpublic long longValue()
longValue in class Numberpublic String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||