|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Number
edu.mines.jtk.util.AtomicFloat
public class AtomicFloat
A float value that may be updated atomically. An atomic float works like
an atomic integer. (See AtomicInteger.)
For example, an atomic float might be used for parallel computation of the
dot product of two vectors of floats.
| Constructor Summary | |
|---|---|
AtomicFloat()
Constructs an atomic float with initial value zero. |
|
AtomicFloat(float value)
Constructs an atomic float with specified initial value. |
|
| Method Summary | |
|---|---|
float |
addAndGet(float delta)
Atomically adds a specified value to the value of this float. |
boolean |
compareAndSet(float expect,
float update)
Atomically sets this float to the specified updated value if the current value equals the specified expected value. |
float |
decrementAndGet()
Atomically decrements by one the value of this float. |
double |
doubleValue()
|
float |
floatValue()
|
float |
get()
Gets the current value of this float. |
float |
getAndAdd(float delta)
Atomically adds a specified value to the value of this float. |
float |
getAndDecrement()
Atomically decrements by one the value of this float. |
float |
getAndIncrement()
Atomically increments by one the value of this float. |
float |
getAndSet(float value)
Atomically sets the value of this float and returns its old value. |
float |
incrementAndGet()
Atomically increments by one the value of this float. |
int |
intValue()
|
long |
longValue()
|
void |
set(float value)
Sets the value of this float. |
java.lang.String |
toString()
|
boolean |
weakCompareAndSet(float expect,
float update)
Atomically sets this float to the specified updated value if the current value equals the specified expected value. |
| Methods inherited from class java.lang.Number |
|---|
byteValue, shortValue |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AtomicFloat()
public AtomicFloat(float value)
value - the initial value.| Method Detail |
|---|
public final float get()
public final void set(float value)
value - the new value.public final float getAndSet(float value)
value - the new value.
public final boolean compareAndSet(float expect,
float update)
expect - the expected value.update - the updated value.
public final boolean weakCompareAndSet(float expect,
float update)
My fail spuriously, and does not provide ordering guarantees, so is only rarely useful.
expect - the expected value.update - the updated value.
public final float getAndIncrement()
public final float getAndDecrement()
public final float getAndAdd(float delta)
delta - the value to add.
public final float incrementAndGet()
public final float decrementAndGet()
public final float addAndGet(float delta)
delta - the value to add.
public java.lang.String toString()
toString in class java.lang.Objectpublic int intValue()
intValue in class java.lang.Numberpublic long longValue()
longValue in class java.lang.Numberpublic float floatValue()
floatValue in class java.lang.Numberpublic double doubleValue()
doubleValue in class java.lang.Number
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||