EDU.oswego.cs.dl.util.concurrent

Class WaitableFloat

public class WaitableFloat extends SynchronizedFloat

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

[ Introduction to this package. ]

Constructor Summary
WaitableFloat(float initialValue)
Make a new WaitableFloat with the given initial value, and using its own internal lock.
WaitableFloat(float initialValue, Object lock)
Make a new WaitableFloat with the given initial value, and using the supplied lock.
Method Summary
floatadd(float amount)
booleancommit(float assumedValue, float newValue)
floatdivide(float factor)
floatmultiply(float factor)
floatset(float newValue)
floatsubtract(float amount)
voidwhenEqual(float c, Runnable action)
Wait until value equals c, then run action if nonnull.
voidwhenGreater(float c, Runnable action)
wait until value greater than c, then run action if nonnull.
voidwhenGreaterEqual(float c, Runnable action)
wait until value greater than or equal to c, then run action if nonnull.
voidwhenLess(float c, Runnable action)
wait until value less than c, then run action if nonnull.
voidwhenLessEqual(float c, Runnable action)
wait until value less than or equal to c, then run action if nonnull.
voidwhenNotEqual(float c, Runnable action)
wait until value not equal to c, then run action if nonnull.

Constructor Detail

WaitableFloat

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

WaitableFloat

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

Method Detail

add

public float add(float amount)

commit

public boolean commit(float assumedValue, float newValue)

divide

public float divide(float factor)

multiply

public float multiply(float factor)

set

public float set(float newValue)

subtract

public float subtract(float amount)

whenEqual

public void whenEqual(float 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(float 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(float 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(float 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(float 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(float c, Runnable action)
wait until value not equal to c, then run action if nonnull. The action is run with the synchronization lock held.