public class WaitableDouble extends SynchronizedDouble
value_lock_| Constructor and Description |
|---|
WaitableDouble(double initialValue)
Make a new WaitableDouble with the given initial value,
and using its own internal lock.
|
WaitableDouble(double initialValue,
java.lang.Object lock)
Make a new WaitableDouble with the given initial value,
and using the supplied lock.
|
| Modifier and Type | Method and Description |
|---|---|
double |
add(double amount)
Add amount to value (i.e., set value += amount)
|
boolean |
commit(double assumedValue,
double newValue)
Set value to newValue only if it is currently assumedValue.
|
double |
divide(double factor)
Divide value by factor (i.e., set value /= factor)
|
double |
multiply(double factor)
Multiply value by factor (i.e., set value *= factor)
|
double |
set(double newValue)
Set to newValue.
|
double |
subtract(double amount)
Subtract amount from value (i.e., set value -= amount)
|
void |
whenEqual(double c,
java.lang.Runnable action)
Wait until value equals c, then run action if nonnull.
|
void |
whenGreater(double c,
java.lang.Runnable action)
wait until value greater than c, then run action if nonnull.
|
void |
whenGreaterEqual(double c,
java.lang.Runnable action)
wait until value greater than or equal to c, then run action if nonnull.
|
void |
whenLess(double c,
java.lang.Runnable action)
wait until value less than c, then run action if nonnull.
|
void |
whenLessEqual(double c,
java.lang.Runnable action)
wait until value less than or equal to c, then run action if nonnull.
|
void |
whenNotEqual(double c,
java.lang.Runnable action)
wait until value not equal to c, then run action if nonnull.
|
compareTo, compareTo, compareTo, equals, get, hashCode, swap, toStringexecute, getLockpublic WaitableDouble(double initialValue)
public WaitableDouble(double initialValue,
java.lang.Object lock)
public double set(double newValue)
SynchronizedDoubleset in class SynchronizedDoublepublic boolean commit(double assumedValue,
double newValue)
SynchronizedDoublecommit in class SynchronizedDoublepublic double add(double amount)
SynchronizedDoubleadd in class SynchronizedDoublepublic double subtract(double amount)
SynchronizedDoublesubtract in class SynchronizedDoublepublic double multiply(double factor)
SynchronizedDoublemultiply in class SynchronizedDoublepublic double divide(double factor)
SynchronizedDoubledivide in class SynchronizedDoublepublic void whenEqual(double c,
java.lang.Runnable action)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void whenNotEqual(double c,
java.lang.Runnable action)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void whenLessEqual(double c,
java.lang.Runnable action)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void whenLess(double c,
java.lang.Runnable action)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void whenGreaterEqual(double c,
java.lang.Runnable action)
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic void whenGreater(double c,
java.lang.Runnable action)
throws java.lang.InterruptedException
java.lang.InterruptedException