public final class SharedModuloCounterLight extends ModuloCounter
DEFAULT_MAX_VALUE, DEFAULT_MIN_VALUE
Constructor and Description |
---|
SharedModuloCounterLight(long maxValue)
Initializes counter with a specified maximum value.
|
SharedModuloCounterLight(long maxValue,
long minValue)
Initializes counter with a specified maximum value and minimum value.
|
Modifier and Type | Method and Description |
---|---|
long |
getValue()
Returns the counter value
|
long |
next()
Increments the counter and returns the next value
|
void |
reset()
Resets the counter to the minimum value
|
getMaxValue, getMinValue
public SharedModuloCounterLight(long maxValue)
maxValue
- The maximum counter value.java.lang.IllegalArgumentException
- When the maximum is less than or equal to minimum, or equal to Long.MAX_VALUEpublic SharedModuloCounterLight(long maxValue, long minValue)
maxValue
- The maximum counter value.minValue
- The minimum counter value.java.lang.IllegalArgumentException
- When the maximum is less than or equal to minimum, or equal to Long.MAX_VALUEpublic long next()
next
in interface ICounter
next
in class ModuloCounter
public void reset()
reset
in interface ICounter
reset
in class ModuloCounter
public long getValue()
getValue
in interface ICounter
getValue
in class ModuloCounter