All Packages Class Hierarchy This Package Previous Next Index
Class ninja.xset.Counter
java.lang.Object
|
+----ninja.xset.Counter
- public class Counter
- extends Object
- implements Serializable
-
Counter()
- Counter() **
Constructor method, creates new counter variable
-
Counter(long)
- Counter(long) **
Constructor method starting with an initial value.
-
currCount()
- long currCount() **
Get the current counter without incrementing the value
Useful for getting the number of counter values given out
-
getNextCount()
- long getNextCount() **
Method to return a new counter value.
-
reset()
- void reset() **
Resets the counter value to 0
-
setValue(long)
-
Counter
public Counter()
- Counter() **
Constructor method, creates new counter variable
Counter
public Counter(long initialValue)
- Counter(long) **
Constructor method starting with an initial value.
This is useful for recovering to a previous state and
creating a counter with the correct sequence #.
It will not accept a negative initial value, and sets
the value to 0 in that case.
getNextCount
public synchronized long getNextCount()
- long getNextCount() **
Method to return a new counter value. It also internally
increments the value after making a copy of the current counter
for being returned.
- Returns:
- The next counter value
currCount
public long currCount()
- long currCount() **
Get the current counter without incrementing the value
Useful for getting the number of counter values given out
- Returns:
- The number of counter values given out = next new value
reset
public synchronized void reset()
- void reset() **
Resets the counter value to 0
setValue
public synchronized void setValue(long newValue)
All Packages Class Hierarchy This Package Previous Next Index