EDU.oswego.cs.dl.util.concurrent
Class WaitableByte
public
class
WaitableByte
extends SynchronizedByte
Constructor Summary |
| WaitableByte(byte initialValue)
Make a new WaitableByte with the given initial value,
and using its own internal lock.
|
| WaitableByte(byte initialValue, Object lock)
Make a new WaitableByte with the given initial value,
and using the supplied lock.
|
Method Summary |
byte | add(byte amount) |
byte | and(byte b)
Set value to value & b. |
boolean | commit(byte assumedValue, byte newValue) |
byte | complement()
Set the value to its complement |
byte | decrement() |
byte | divide(byte factor) |
byte | increment() |
byte | multiply(byte factor) |
byte | or(byte b)
Set value to value | b. |
byte | set(byte newValue) |
byte | subtract(byte amount) |
void | whenEqual(byte c, Runnable action)
Wait until value equals c, then run action if nonnull.
|
void | whenGreater(byte c, Runnable action)
wait until value greater than c, then run action if nonnull.
|
void | whenGreaterEqual(byte c, Runnable action)
wait until value greater than or equal to c, then run action if nonnull.
|
void | whenLess(byte c, Runnable action)
wait until value less than c, then run action if nonnull.
|
void | whenLessEqual(byte c, Runnable action)
wait until value less than or equal to c, then run action if nonnull.
|
void | whenNotEqual(byte c, Runnable action)
wait until value not equal to c, then run action if nonnull.
|
byte | xor(byte b)
Set value to value ^ b. |
public WaitableByte(byte initialValue)
Make a new WaitableByte with the given initial value,
and using its own internal lock.
public WaitableByte(byte initialValue, Object lock)
Make a new WaitableByte with the given initial value,
and using the supplied lock.
public byte add(byte amount)
public byte and(byte b)
Set value to value & b.
Returns: the new value
public boolean commit(byte assumedValue, byte newValue)
public byte complement()
Set the value to its complement
Returns: the new value
public byte decrement()
public byte divide(byte factor)
public byte increment()
public byte multiply(byte factor)
public byte or(byte b)
Set value to value | b.
Returns: the new value
public byte set(byte newValue)
public byte subtract(byte amount)
public void whenEqual(byte c, Runnable action)
Wait until value equals c, then run action if nonnull.
The action is run with the synchronization lock held.
public void whenGreater(byte c, Runnable action)
wait until value greater than c, then run action if nonnull.
The action is run with the synchronization lock held.
public void whenGreaterEqual(byte c, Runnable action)
wait until value greater than or equal to c, then run action if nonnull.
The action is run with the synchronization lock held.
public void whenLess(byte c, Runnable action)
wait until value less than c, then run action if nonnull.
The action is run with the synchronization lock held.
public void whenLessEqual(byte c, Runnable action)
wait until value less than or equal to c, then run action if nonnull.
The action is run with the synchronization lock held.
public void whenNotEqual(byte c, Runnable action)
wait until value not equal to c, then run action if nonnull.
The action is run with the synchronization lock held.
public byte xor(byte b)
Set value to value ^ b.
Returns: the new value