|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object EDU.oswego.cs.dl.util.concurrent.SynchronizedVariable EDU.oswego.cs.dl.util.concurrent.SynchronizedDouble
public class SynchronizedDouble
A class useful for offloading synch for double instance variables.
[ Introduction to this package. ]
Field Summary | |
---|---|
protected double |
value_
|
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.SynchronizedVariable |
---|
lock_ |
Constructor Summary | |
---|---|
SynchronizedDouble(double initialValue)
Make a new SynchronizedDouble with the given initial value, and using its own internal lock. |
|
SynchronizedDouble(double initialValue,
java.lang.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(java.lang.Object other)
|
int |
compareTo(SynchronizedDouble other)
|
double |
divide(double factor)
Divide value by factor (i.e., set value /= factor) |
boolean |
equals(java.lang.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. |
java.lang.String |
toString()
|
Methods inherited from class EDU.oswego.cs.dl.util.concurrent.SynchronizedVariable |
---|
execute, getLock |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected double value_
Constructor Detail |
---|
public SynchronizedDouble(double initialValue)
public SynchronizedDouble(double initialValue, java.lang.Object lock)
Method Detail |
---|
public final double get()
public double set(double newValue)
public boolean commit(double assumedValue, double newValue)
public double swap(SynchronizedDouble other)
public double add(double amount)
public double subtract(double amount)
public double multiply(double factor)
public double divide(double factor)
public int compareTo(double other)
compareTo
in interface java.lang.Comparable
public int compareTo(SynchronizedDouble other)
compareTo
in interface java.lang.Comparable
public int compareTo(java.lang.Object other)
compareTo
in interface java.lang.Comparable
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |