net.lucidviews.util
Class Counter

java.lang.Object
  extended byjava.lang.Number
      extended bynet.lucidviews.util.VariableNumber
          extended bynet.lucidviews.util.VariableLong
              extended bynet.lucidviews.util.Counter
All Implemented Interfaces:
java.io.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

Field Summary
 
Fields inherited from class net.lucidviews.util.VariableLong
 
Fields inherited from class net.lucidviews.util.VariableNumber
 
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(java.lang.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
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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(java.lang.Number value)
Create a new counter with a given initial value.

Parameters:
value - the initial value
Throws:
java.lang.NullPointerException - if the initial value is null
Method Detail

increment

public void increment()
Increment the value of this counter.
If the number is secure an exception will be thrown.

Throws:
java.lang.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:
java.lang.IllegalStateException - if this number is no longer in a variable state
See Also:
VariableNumber.secure, VariableNumber.secure()