EDU.oswego.cs.dl.util.concurrent
public class SynchronizedDouble extends SynchronizedVariable implements Comparable, Cloneable
Field Summary | |
---|---|
protected double | value_ |
Constructor Summary | |
---|---|
SynchronizedDouble(double initialValue)
Make a new SynchronizedDouble with the given initial value,
and using its own internal lock.
| |
SynchronizedDouble(double initialValue, Object lock)
Make a new SynchronizedDouble with the given initial value,
and using the supplied lock.
|
Method Summary | |
---|---|
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. |
int | compareTo(double other) |
int | compareTo(SynchronizedDouble other) |
int | compareTo(Object other) |
double | divide(double factor)
Divide value by factor (i.e., set value /= factor) |
boolean | equals(Object other) |
double | get()
Return the current value
|
int | hashCode() |
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) |
double | swap(SynchronizedDouble other)
Atomically swap values with another SynchronizedDouble.
|
String | toString() |
Returns: the new value
Returns: true if successful
Returns: the new value
Returns: the new value
Returns: the old value
Returns: the new value
Returns: the new value