jut.ref
Class SimpleCounter

java.lang.Object
  extended by jut.ref.SimpleCounter
All Implemented Interfaces:
ICount

public class SimpleCounter
extends Object
implements ICount

wrapper for a long value that is to be accessed and modified out of more than one context. SimpleCounter is not thread-safe.

Author:
Georg Dietrich

Field Summary
protected  long value
          the counter used internally.
 
Fields inherited from interface jut.ref.ICount
DUMMY
 
Constructor Summary
SimpleCounter()
           
 
Method Summary
 SimpleCounter add(long val)
          add a value to the counter.
 long get()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

protected long value
the counter used internally.

Constructor Detail

SimpleCounter

public SimpleCounter()
Method Detail

add

public SimpleCounter add(long val)
add a value to the counter.

Specified by:
add in interface ICount
Parameters:
val - - the value to add to this counter.
Returns:
a reference to the object itself.

get

public long get()

Specified by:
get in interface ICount
Returns:
the current value of the counter.