public final class ThreadSafeCounter extends java.lang.Object implements Counter
This class is thread safe!
Counter.CreatorSIMPLE, THREAD_SAFE| Constructor and Description |
|---|
ThreadSafeCounter()
Default constructor.
|
ThreadSafeCounter(Counter count)
Copy constructor.
|
ThreadSafeCounter(int val)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
add(Counter counter)
Add something to the counter.
|
int |
add(int add)
Add something to the counter.
|
int |
add1()
Add 1 to counter.
|
int |
getValue()
Get the value.
|
void |
setValue(int val)
Set the value.
|
int |
subtract(Counter counter)
Subtract something from the counter.
|
int |
subtract(int sub)
Subtract something from the counter.
|
int |
subtract1()
Subtract 1 from counter.
|
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitadd, simple, simple, substract, substract, substract1, subtract, threadSafe, threadSafepublic ThreadSafeCounter()
public ThreadSafeCounter(int val)
val.val - init valuepublic int add(int add)
public int add1()
public int subtract(int sub)
public int subtract1()
public int getValue()
public void setValue(int val)
public java.lang.String toString()
toString in class java.lang.Object