public final class ThreadSafeLongCounter extends java.lang.Object implements LongCounter
This class is thread safe!
LongCounter.CreatorSIMPLE, THREAD_SAFE| Constructor and Description |
|---|
ThreadSafeLongCounter()
Default constructor.
|
ThreadSafeLongCounter(int val)
Constructor.
|
ThreadSafeLongCounter(LongCounter count)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
long |
add(long add)
Add something to the counter.
|
long |
add(LongCounter counter)
Add something to the counter.
|
long |
add1()
Add 1 to counter.
|
long |
getValue()
Get the value.
|
void |
setValue(long val)
Set the value.
|
long |
subtract(long sub)
Subtract something from the counter.
|
long |
subtract(LongCounter counter)
Subtract something from the counter.
|
long |
subtract1()
Subtract 1 from counter.
|
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitadd, add, subtract, subtractpublic ThreadSafeLongCounter()
public ThreadSafeLongCounter(int val)
val.val - init valuepublic ThreadSafeLongCounter(@NotNull LongCounter count)
count - counter to be copiedpublic long add(long add)
LongCounteradd in interface LongCounteradd - value to addpublic long add(@NotNull LongCounter counter)
LongCounteradd in interface LongCountercounter - counter which value is addedpublic long add1()
LongCounteradd1 in interface LongCounterpublic long subtract(long sub)
LongCountersubtract in interface LongCountersub - value to subtractpublic long subtract(@NotNull LongCounter counter)
LongCountersubtract in interface LongCountercounter - counter which value is subtractedpublic long subtract1()
LongCountersubtract1 in interface LongCounterpublic long getValue()
LongCountergetValue in interface LongCounterpublic void setValue(long val)
LongCountersetValue in interface LongCounterval - new value@NotNull public java.lang.String toString()
toString in class java.lang.Object