EDU.oswego.cs.dl.util.concurrent

Class WaitableChar

public class WaitableChar extends SynchronizedChar

A class useful for offloading waiting and signalling operations on single char variables.

[ Introduction to this package. ]

Constructor Summary
WaitableChar(char initialValue)
Make a new WaitableChar with the given initial value, and using its own internal lock.
WaitableChar(char initialValue, Object lock)
Make a new WaitableChar with the given initial value, and using the supplied lock.
Method Summary
charadd(char amount)
booleancommit(char assumedValue, char newValue)
chardivide(char factor)
charmultiply(char factor)
charset(char newValue)
charsubtract(char amount)
voidwhenEqual(char c, Runnable action)
Wait until value equals c, then run action if nonnull.
voidwhenGreater(char c, Runnable action)
wait until value greater than c, then run action if nonnull.
voidwhenGreaterEqual(char c, Runnable action)
wait until value greater than or equal to c, then run action if nonnull.
voidwhenLess(char c, Runnable action)
wait until value less than c, then run action if nonnull.
voidwhenLessEqual(char c, Runnable action)
wait until value less than or equal to c, then run action if nonnull.
voidwhenNotEqual(char c, Runnable action)
wait until value not equal to c, then run action if nonnull.

Constructor Detail

WaitableChar

public WaitableChar(char initialValue)
Make a new WaitableChar with the given initial value, and using its own internal lock.

WaitableChar

public WaitableChar(char initialValue, Object lock)
Make a new WaitableChar with the given initial value, and using the supplied lock.

Method Detail

add

public char add(char amount)

commit

public boolean commit(char assumedValue, char newValue)

divide

public char divide(char factor)

multiply

public char multiply(char factor)

set

public char set(char newValue)

subtract

public char subtract(char amount)

whenEqual

public void whenEqual(char c, Runnable action)
Wait until value equals c, then run action if nonnull. The action is run with the synchronization lock held.

whenGreater

public void whenGreater(char c, Runnable action)
wait until value greater than c, then run action if nonnull. The action is run with the synchronization lock held.

whenGreaterEqual

public void whenGreaterEqual(char 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.

whenLess

public void whenLess(char c, Runnable action)
wait until value less than c, then run action if nonnull. The action is run with the synchronization lock held.

whenLessEqual

public void whenLessEqual(char 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.

whenNotEqual

public void whenNotEqual(char c, Runnable action)
wait until value not equal to c, then run action if nonnull. The action is run with the synchronization lock held.