public interface LongCounter
Depending on the usage it comes in a
thread-safe implementation
and a non thread-safe implementation.
There are also factories for both counters:
SIMPLE and THREAD_SAFE.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
LongCounter.Creator
Interface for counter creation.
|
| Modifier and Type | Field and Description |
|---|---|
static LongCounter.Creator |
SIMPLE
Simple counter creator.
|
static LongCounter.Creator |
THREAD_SAFE
Thread safe counter creator.
|
| Modifier and Type | Method and Description |
|---|---|
default long |
add(Counter counter)
Add the value of an integer counter.
|
long |
add(long add)
Add something to the counter.
|
long |
add(LongCounter counter)
Add something to the counter.
|
default long |
add(java.lang.Number number)
Add a number to the counter.
|
long |
add1()
Add 1 to counter.
|
long |
getValue()
Get the value.
|
void |
setValue(long value)
Set the value.
|
default long |
subtract(Counter counter)
Subtract the value of an integer counter.
|
long |
subtract(long sub)
Subtract something from the counter.
|
long |
subtract(LongCounter counter)
Subtract something from the counter.
|
default long |
subtract(java.lang.Number number)
Subtract a number to the counter.
|
long |
subtract1()
Subtract 1 from counter.
|
static final LongCounter.Creator SIMPLE
SimpleCounterstatic final LongCounter.Creator THREAD_SAFE
ThreadSafeCounterlong add(long add)
add - value to addlong add(@NotNull LongCounter counter)
counter - counter which value is addeddefault long add(@NotNull java.lang.Number number)
number - number to add, treated as a long valuedefault long add(@NotNull Counter counter)
counter - integer counterlong add1()
long subtract(long sub)
sub - value to subtractlong subtract(@NotNull LongCounter counter)
counter - counter which value is subtracteddefault long subtract(@NotNull java.lang.Number number)
number - number to add, treated as a long valuedefault long subtract(@NotNull Counter counter)
counter - integer counterlong subtract1()
long getValue()
void setValue(long value)
value - new value