net.lucidviews.util
Class Counter
java.lang.Object
java.lang.Number
net.lucidviews.util.VariableNumber
net.lucidviews.util.VariableLong
net.lucidviews.util.Counter
- All Implemented Interfaces:
- Serializable
- public class Counter
- extends VariableLong
A number object used for counting.
- Since:
- 1.1
- Version:
- $Revision: 1.1 $
- Author:
- Stephen Battey
- See Also:
VariableLong,
Serialized Form
| Fields inherited from class net.lucidviews.util.VariableLong |
|
| Fields inherited from class java.lang.Number |
|
|
Constructor Summary |
Counter()
Create a new counter. |
Counter(long value)
Create a new counter with a given initial value. |
Counter(Number value)
Create a new counter with a given initial value. |
|
Method Summary |
void |
decrement()
Decrement the value of this counter. |
void |
increment()
Increment the value of this counter. |
| Methods inherited from class net.lucidviews.util.VariableLong |
doubleValue, equals, floatValue, hashCode, intValue, longValue, setValueInternal, setValueInternal, setValueInternal, setValueInternal, toString |
| Methods inherited from class net.lucidviews.util.VariableNumber |
isSecure, secure, setValue, setValue, setValue, setValue, setValue, setValue, setValueInternal, setValueInternal, verifyNotSecure |
Counter
public Counter()
- Create a new counter.
The counter is initialised with a zero value.
Counter
public Counter(long value)
- Create a new counter with a given initial value.
- Parameters:
value - the initial value
Counter
public Counter(Number value)
- Create a new counter with a given initial value.
- Parameters:
value - the initial value
- Throws:
NullPointerException - if the initial value is null
increment
public void increment()
- Increment the value of this counter.
If the number is secure an exception will be thrown.
- Throws:
IllegalStateException - if this number is no longer in a variable
state- See Also:
VariableNumber.secure,
VariableNumber.secure()
decrement
public void decrement()
- Decrement the value of this counter.
If the number is secure an exception will be thrown.
- Throws:
IllegalStateException - if this number is no longer in a variable
state- See Also:
VariableNumber.secure,
VariableNumber.secure()