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