EDU.oswego.cs.dl.util.concurrent

Class WaitableBoolean

public class WaitableBoolean extends SynchronizedBoolean

A class useful for offloading synch for boolean instance variables.

[ Introduction to this package. ]

Constructor Summary
WaitableBoolean(boolean initialValue)
Make a new WaitableBoolean with the given initial value *
WaitableBoolean(boolean initialValue, Object lock)
Make a new WaitableBoolean with the given initial value, and using the supplied lock.
Method Summary
booleanand(boolean b)
booleancommit(boolean assumedValue, boolean newValue)
booleancomplement()
booleanor(boolean b)
booleanset(boolean newValue)
voidwhenEqual(boolean c, Runnable action)
Wait until value equals c, then run action if nonnull.
voidwhenFalse(Runnable action)
Wait until value is false, then run action if nonnull.
voidwhenNotEqual(boolean c, Runnable action)
wait until value not equal to c, then run action if nonnull.
voidwhenTrue(Runnable action)
wait until value is true, then run action if nonnull.
booleanxor(boolean b)

Constructor Detail

WaitableBoolean

public WaitableBoolean(boolean initialValue)
Make a new WaitableBoolean with the given initial value *

WaitableBoolean

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

Method Detail

and

public boolean and(boolean b)

commit

public boolean commit(boolean assumedValue, boolean newValue)

complement

public boolean complement()

or

public boolean or(boolean b)

set

public boolean set(boolean newValue)

whenEqual

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

whenFalse

public void whenFalse(Runnable action)
Wait until value is false, then run action if nonnull. The action is run with the synchronization lock held.

whenNotEqual

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

whenTrue

public void whenTrue(Runnable action)
wait until value is true, then run action if nonnull. The action is run with the synchronization lock held.

xor

public boolean xor(boolean b)