|
||||||||
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.SynchronizedFloat
public class SynchronizedFloat
A class useful for offloading synch for float instance variables.
[ Introduction to this package. ]
Field Summary | |
---|---|
protected float |
value_
|
Fields inherited from class EDU.oswego.cs.dl.util.concurrent.SynchronizedVariable |
---|
lock_ |
Constructor Summary | |
---|---|
SynchronizedFloat(float initialValue)
Make a new SynchronizedFloat with the given initial value, and using its own internal lock. |
|
SynchronizedFloat(float initialValue,
java.lang.Object lock)
Make a new SynchronizedFloat with the given initial value, and using the supplied lock. |
Method Summary | |
---|---|
float |
add(float amount)
Add amount to value (i.e., set value += amount) |
boolean |
commit(float assumedValue,
float newValue)
Set value to newValue only if it is currently assumedValue. |
int |
compareTo(float other)
|
int |
compareTo(java.lang.Object other)
|
int |
compareTo(SynchronizedFloat other)
|
float |
divide(float factor)
Divide value by factor (i.e., set value /= factor) |
boolean |
equals(java.lang.Object other)
|
float |
get()
Return the current value |
int |
hashCode()
|
float |
multiply(float factor)
Multiply value by factor (i.e., set value *= factor) |
float |
set(float newValue)
Set to newValue. |
float |
subtract(float amount)
Subtract amount from value (i.e., set value -= amount) |
float |
swap(SynchronizedFloat other)
Atomically swap values with another SynchronizedFloat. |
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 float value_
Constructor Detail |
---|
public SynchronizedFloat(float initialValue)
public SynchronizedFloat(float initialValue, java.lang.Object lock)
Method Detail |
---|
public final float get()
public float set(float newValue)
public boolean commit(float assumedValue, float newValue)
public float swap(SynchronizedFloat other)
public float add(float amount)
public float subtract(float amount)
public float multiply(float factor)
public float divide(float factor)
public int compareTo(float other)
compareTo
in interface java.lang.Comparable
public int compareTo(SynchronizedFloat 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 |