CounterImpl (Quartz Parent POM 2.0.1 API)

Quartz Java



org.quartz.utils.counter Class CounterImpl

java.lang.Object
  extended by org.quartz.utils.counter.CounterImpl
All Implemented Interfaces:
Serializable, Counter
Direct Known Subclasses:
SampledCounterImpl

public class CounterImpl
extends Object
implements Counter, Serializable

A simple counter implementation

Since:
1.8
Author:
Abhishek Sanoujam
See Also:
Serialized Form

Constructor Summary
CounterImpl()
          Default Constructor
CounterImpl(long initialValue)
          Constructor with initial value
 
Method Summary
 long decrement()
          Decrement the counter by 1
 long decrement(long amount)
          Decrement the counter by given amount
 long getAndSet(long newValue)
          Returns the value of the counter and sets it to the new value
 long getValue()
          Gets current value of the counter
 long increment()
          Increment the counter by 1
 long increment(long amount)
          Increment the counter by given amount
 void setValue(long newValue)
          Sets the value of the counter to the supplied value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CounterImpl

public CounterImpl()
Default Constructor


CounterImpl

public CounterImpl(long initialValue)
Constructor with initial value

Parameters:
initialValue -

Method Detail

increment

public long increment()
Increment the counter by 1

Specified by:
increment in interface Counter
Returns:
the value after incrementing

decrement

public long decrement()
Decrement the counter by 1

Specified by:
decrement in interface Counter
Returns:
the value after decrementing

getAndSet

public long getAndSet(long newValue)
Returns the value of the counter and sets it to the new value

Specified by:
getAndSet in interface Counter
Returns:
Returns the old value

getValue

public long getValue()
Gets current value of the counter

Specified by:
getValue in interface Counter
Returns:
current value of the counter

increment

public long increment(long amount)
Increment the counter by given amount

Specified by:
increment in interface Counter
Returns:
the value of the counter after incrementing

decrement

public long decrement(long amount)
Decrement the counter by given amount

Specified by:
decrement in interface Counter
Returns:
the value of the counter after decrementing

setValue

public void setValue(long newValue)
Sets the value of the counter to the supplied value

Specified by:
setValue in interface Counter


Copyright 2001-2011, Terracotta, Inc.