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

Constructor Index

 o Counter()
Counter() ** Constructor method, creates new counter variable
 o Counter(long)
Counter(long) ** Constructor method starting with an initial value.

Method Index

 o currCount()
long currCount() ** Get the current counter without incrementing the value Useful for getting the number of counter values given out
 o getNextCount()
long getNextCount() ** Method to return a new counter value.
 o reset()
void reset() ** Resets the counter value to 0
 o setValue(long)

Constructors

 o Counter
 public Counter()
Counter() ** Constructor method, creates new counter variable

 o 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.

Methods

 o 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
 o 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
 o reset
 public synchronized void reset()
void reset() ** Resets the counter value to 0

 o setValue
 public synchronized void setValue(long newValue)

All Packages  Class Hierarchy  This Package  Previous  Next  Index