Package de.xima.fc.common.counter
Interface Counter.LongCounter
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface de.xima.fc.common.counter.Counter
Counter.LongCounter
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidchangeBy(long amount)Changes the counter by the specific amount of units.default LongchangeByAndGet(long amount)Changes the counter by the specific amount of units and returns the new value.default longchangeByAndGetLong(long amount)Changes the counter by the given amount and returns the new value as a primitivelong.default Longcurrent()Get the current value of the counter.longcurrentLong()Gets the current value of the counter as a primitivelong.default LongdecrementAndGet()Decrements the counter by a single unit and returns the new value.default longdecrementAndGetLong()Decrements the counter by a single unit and returns the new value as a primitivelong.default com.google.common.collect.DiscreteDomain<Long>domain()Gets the domain discrete domain to which the counter value belongs.default LonggetAndChangeBy(long amount)Gets the current value of the counter, then changes the counter by the specific amount of units.default longgetAndChangeByLong(long amount)Gets the current value of the counter as a primitivelong, then changes it by the given amount.default LonggetAndDecrement()Gets the current value of the counter, then decrements the counter by a single unit.default longgetAndDecrementLong()Gets the current value of the counter as a primitivelong, then decrements it by a single unit.default LonggetAndIncrement()Gets the current value of the counter, then increments the counter by a single unit.default longgetAndIncrementLong()Gets the current value of the counter as a primitivelong, then increments it by a single unit.default LongincrementAndGet()Increments the counter by a single unit and returns the new value.default longincrementAndGetLong()Increments the counter by a single unit and returns the new value as a primitivelong.default voidset(Long value)Sets the counter to a specific value.voidsetLong(long value)Sets the counter to a specific value, provided as a primitivelong.
-
-
-
Method Detail
-
changeBy
default void changeBy(long amount)
Description copied from interface:CounterChanges the counter by the specific amount of units. A positive amount increments the counter, a negative amount decrements the counter.The default implementation of this method is to increment or decrement the counter by repeatedly incrementing or decrementing the counter by a single unit via the domain until the desired amount is reached. Implementations are encouraged to override this method with a more efficient implementation if possible.
-
changeByAndGet
default Long changeByAndGet(long amount)
Description copied from interface:CounterChanges the counter by the specific amount of units and returns the new value.- Specified by:
changeByAndGetin interfaceCounter<Long>- Parameters:
amount- The amount to change the counter by.- Returns:
- The new value of the counter after it was changed.
-
changeByAndGetLong
default long changeByAndGetLong(long amount)
Changes the counter by the given amount and returns the new value as a primitivelong.- Parameters:
amount- The amount to change the counter by.- Returns:
- The new value of the counter after it was changed.
-
current
default Long current()
Description copied from interface:CounterGet the current value of the counter.
-
currentLong
long currentLong()
Gets the current value of the counter as a primitivelong.- Returns:
- The current value of the counter.
-
decrementAndGet
default Long decrementAndGet()
Description copied from interface:CounterDecrements the counter by a single unit and returns the new value.- Specified by:
decrementAndGetin interfaceCounter<Long>- Returns:
- The new value of the counter after decrementing.
-
decrementAndGetLong
default long decrementAndGetLong()
Decrements the counter by a single unit and returns the new value as a primitivelong.- Returns:
- The new value of the counter after decrementing.
-
domain
default com.google.common.collect.DiscreteDomain<Long> domain()
Description copied from interface:CounterGets the domain discrete domain to which the counter value belongs.
-
getAndChangeBy
default Long getAndChangeBy(long amount)
Description copied from interface:CounterGets the current value of the counter, then changes the counter by the specific amount of units.- Specified by:
getAndChangeByin interfaceCounter<Long>- Parameters:
amount- The amount to change the counter by.- Returns:
- The previous value of the counter.
-
getAndChangeByLong
default long getAndChangeByLong(long amount)
Gets the current value of the counter as a primitivelong, then changes it by the given amount.- Parameters:
amount- The amount to change the counter by.- Returns:
- The previous value of the counter.
-
getAndDecrement
default Long getAndDecrement()
Description copied from interface:CounterGets the current value of the counter, then decrements the counter by a single unit.- Specified by:
getAndDecrementin interfaceCounter<Long>- Returns:
- The previous value of the counter.
-
getAndDecrementLong
default long getAndDecrementLong()
Gets the current value of the counter as a primitivelong, then decrements it by a single unit.- Returns:
- The previous value of the counter.
-
getAndIncrement
default Long getAndIncrement()
Description copied from interface:CounterGets the current value of the counter, then increments the counter by a single unit.- Specified by:
getAndIncrementin interfaceCounter<Long>- Returns:
- The previous value of the counter.
-
getAndIncrementLong
default long getAndIncrementLong()
Gets the current value of the counter as a primitivelong, then increments it by a single unit.- Returns:
- The previous value of the counter.
-
incrementAndGet
default Long incrementAndGet()
Description copied from interface:CounterIncrements the counter by a single unit and returns the new value.- Specified by:
incrementAndGetin interfaceCounter<Long>- Returns:
- The new value of the counter after incrementing.
-
incrementAndGetLong
default long incrementAndGetLong()
Increments the counter by a single unit and returns the new value as a primitivelong.- Returns:
- The new value of the counter after incrementing.
-
set
default void set(Long value)
Description copied from interface:CounterSets the counter to a specific value.
-
setLong
void setLong(long value)
Sets the counter to a specific value, provided as a primitivelong.- Parameters:
value- The value to set the counter to.
-
-