Package org.quartz.utils.counter
Class CounterImpl
- java.lang.Object
-
- org.quartz.utils.counter.CounterImpl
-
- All Implemented Interfaces:
java.io.Serializable,Counter
- Direct Known Subclasses:
SampledCounterImpl
public class CounterImpl extends java.lang.Object implements Counter, java.io.Serializable
A simple counter implementation- Since:
- 1.8
- Author:
- Abhishek Sanoujam
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CounterImpl()Default ConstructorCounterImpl(long initialValue)Constructor with initial value
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longdecrement()Decrement the counter by 1longdecrement(long amount)Decrement the counter by given amountlonggetAndSet(long newValue)Returns the value of the counter and sets it to the new valuelonggetValue()Gets current value of the counterlongincrement()Increment the counter by 1longincrement(long amount)Increment the counter by given amountvoidsetValue(long newValue)Sets the value of the counter to the supplied value
-
-
-
Method Detail
-
increment
public long increment()
Increment the counter by 1
-
decrement
public long decrement()
Decrement the counter by 1
-
getAndSet
public long getAndSet(long newValue)
Returns the value of the counter and sets it to the new value
-
getValue
public long getValue()
Gets current value of the counter
-
increment
public long increment(long amount)
Increment the counter by given amount
-
decrement
public long decrement(long amount)
Decrement the counter by given amount
-
-