EDU.oswego.cs.dl.util.concurrent

Class WaitableDouble

public class WaitableDouble extends SynchronizedDouble

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

[ Introduction to this package. ]

Constructor Summary
WaitableDouble(double initialValue)
Make a new WaitableDouble with the given initial value, and using its own internal lock.
WaitableDouble(double initialValue, Object lock)
Make a new WaitableDouble with the given initial value, and using the supplied lock.
Method Summary
doubleadd(double amount)
booleancommit(double assumedValue, double newValue)
doubledivide(double factor)
doublemultiply(double factor)
doubleset(double newValue)
doublesubtract(double amount)
voidwhenEqual(double c, Runnable action)
Wait until value equals c, then run action if nonnull.
voidwhenGreater(double c, Runnable action)
wait until value greater than c, then run action if nonnull.
voidwhenGreaterEqual(double c, Runnable action)
wait until value greater than or equal to c, then run action if nonnull.
voidwhenLess(double c, Runnable action)
wait until value less than c, then run action if nonnull.
voidwhenLessEqual(double c, Runnable action)
wait until value less than or equal to c, then run action if nonnull.
voidwhenNotEqual(double c, Runnable action)
wait until value not equal to c, then run action if nonnull.

Constructor Detail

WaitableDouble

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

WaitableDouble

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

Method Detail

add

public double add(double amount)

commit

public boolean commit(double assumedValue, double newValue)

divide

public double divide(double factor)

multiply

public double multiply(double factor)

set

public double set(double newValue)

subtract

public double subtract(double amount)

whenEqual

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