org.apache.geronimo.common
Class LongCounter

java.lang.Object
  extended byorg.apache.geronimo.common.CloneableObject
      extended byorg.apache.geronimo.common.LongCounter
All Implemented Interfaces:
Cloneable, Serializable

public class LongCounter
extends CloneableObject
implements Serializable

A long integer counter class.

Version:
$Revision: 1.3 $ $Date: 2004/03/10 09:58:25 $
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.apache.geronimo.common.CloneableObject
CloneableObject.Cloneable
 
Constructor Summary
LongCounter()
          Construct a LongCounter.
LongCounter(long count)
          Construct a LongCounter with a starting value.
 
Method Summary
 long decrement()
          Decrement the counter.
 boolean equals(Object obj)
          Check if the given object is equal to this.
 long getCount()
          Return the current value of the counter.
 long increment()
          Increment the counter.
static LongCounter makeDirectional(LongCounter counter, boolean increasing)
          Returns a directional counter.
static LongCounter makeSynchronized(LongCounter counter)
          Return a synchronized counter.
 void reset()
          Reset the counter to zero.
 String toString()
          Return a string representation of this.
 
Methods inherited from class org.apache.geronimo.common.CloneableObject
clone
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LongCounter

public LongCounter(long count)
Construct a LongCounter with a starting value.

Parameters:
count - Starting value for counter.

LongCounter

public LongCounter()
Construct a LongCounter.

Method Detail

increment

public long increment()
Increment the counter. (Optional operation)

Returns:
The incremented value of the counter.

decrement

public long decrement()
Decrement the counter. (Optional operation)

Returns:
The decremented value of the counter.

getCount

public long getCount()
Return the current value of the counter.

Returns:
The current value of the counter.

reset

public void reset()
Reset the counter to zero. (Optional operation)


equals

public boolean equals(Object obj)
Check if the given object is equal to this.

Parameters:
obj - Object to test equality with.
Returns:
True if object is equal to this.

toString

public String toString()
Return a string representation of this.

Returns:
A string representation of this.

makeSynchronized

public static LongCounter makeSynchronized(LongCounter counter)
Return a synchronized counter.

Parameters:
counter - LongCounter to synchronize.
Returns:
Synchronized counter.

makeDirectional

public static LongCounter makeDirectional(LongCounter counter,
                                          boolean increasing)
Returns a directional counter.

Parameters:
counter - LongCounter to make directional.
increasing - True to create an increasing only or false to create a decreasing only.
Returns:
A directional counter.


Copyright © 2003-2005 Apache Software Foundation. All Rights Reserved.