public class WaitableChar extends SynchronizedChar
value_lock_| Constructor and Description |
|---|
WaitableChar(char initialValue)
Make a new WaitableChar with the given initial value,
and using its own internal lock.
|
WaitableChar(char initialValue,
java.lang.Object lock)
Make a new WaitableChar with the given initial value,
and using the supplied lock.
|
| Modifier and Type | Method and Description |
|---|---|
char |
add(char amount)
Add amount to value (i.e., set value += amount)
|
boolean |
commit(char assumedValue,
char newValue)
Set value to newValue only if it is currently assumedValue.
|
char |
divide(char factor)
Divide value by factor (i.e., set value /= factor)
|
char |
multiply(char factor)
Multiply value by factor (i.e., set value *= factor)
|
char |
set(char newValue)
Set to newValue.
|
char |
subtract(char amount)
Subtract amount from value (i.e., set value -= amount)
|
void |
whenEqual(char c,
java.lang.Runnable action)
Wait until value equals c, then run action if nonnull.
|
void |
whenGreater(char c,
java.lang.Runnable action)
wait until value greater than c, then run action if nonnull.
|
void |
whenGreaterEqual(char c,
java.lang.Runnable action)
wait until value greater than or equal to c, then run action if nonnull.
|
void |
whenLess(char c,
java.lang.Runnable action)
wait until value less than c, then run action if nonnull.
|
void |
whenLessEqual(char c,
java.lang.Runnable action)
wait until value less than or equal to c, then run action if nonnull.
|
void |
whenNotEqual(char c,
java.lang.Runnable action)
wait until value not equal to c, then run action if nonnull.
|
compareTo, compareTo, compareTo, equals, get, hashCode, swap, toStringexecute, getLockpublic WaitableChar(char initialValue)
public WaitableChar(char initialValue,
java.lang.Object lock)
public char set(char newValue)
SynchronizedCharset in class SynchronizedCharpublic boolean commit(char assumedValue,
char newValue)
SynchronizedCharcommit in class SynchronizedCharpublic char add(char amount)
SynchronizedCharadd in class SynchronizedCharpublic char subtract(char amount)
SynchronizedCharsubtract in class SynchronizedCharpublic char multiply(char factor)
SynchronizedCharmultiply in class SynchronizedCharpublic char divide(char factor)
SynchronizedChardivide in class SynchronizedCharpublic void whenEqual(char c,
java.lang.Runnable action)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void whenNotEqual(char c,
java.lang.Runnable action)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void whenLessEqual(char c,
java.lang.Runnable action)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void whenLess(char c,
java.lang.Runnable action)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void whenGreaterEqual(char c,
java.lang.Runnable action)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void whenGreater(char c,
java.lang.Runnable action)
throws java.lang.InterruptedException
java.lang.InterruptedException