public class AtomicDouble
extends java.lang.Number
implements java.io.Serializable
AtomicInteger
.)
For example, an atomic double might be used for parallel computation of the
dot product of two vectors of doubles.Constructor and Description |
---|
AtomicDouble()
Constructs an atomic double with initial value zero.
|
AtomicDouble(double value)
Constructs an atomic double with specified initial value.
|
Modifier and Type | Method and Description |
---|---|
double |
addAndGet(double delta)
Atomically adds a specified value to the value of this double.
|
boolean |
compareAndSet(double expect,
double update)
Atomically sets this double to the specified updated value
if the current value equals the specified expected value.
|
double |
decrementAndGet()
Atomically decrements by one the value of this double.
|
double |
doubleValue() |
float |
floatValue() |
double |
get()
Gets the current value of this double.
|
double |
getAndAdd(double delta)
Atomically adds a specified value to the value of this double.
|
double |
getAndDecrement()
Atomically decrements by one the value of this double.
|
double |
getAndIncrement()
Atomically increments by one the value of this double.
|
double |
getAndSet(double value)
Atomically sets the value of this double and returns its old value.
|
double |
incrementAndGet()
Atomically increments by one the value of this double.
|
int |
intValue() |
long |
longValue() |
void |
set(double value)
Sets the value of this double.
|
java.lang.String |
toString() |
boolean |
weakCompareAndSet(double expect,
double update)
Atomically sets this double to the specified updated value
if the current value equals the specified expected value.
|
public AtomicDouble()
public AtomicDouble(double value)
value
- the initial value.public final double get()
public final void set(double value)
value
- the new value.public final double getAndSet(double value)
value
- the new value.public final boolean compareAndSet(double expect, double update)
expect
- the expected value.update
- the updated value.public final boolean weakCompareAndSet(double expect, double 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 double getAndIncrement()
public final double getAndDecrement()
public final double getAndAdd(double delta)
delta
- the value to add.public final double incrementAndGet()
public final double decrementAndGet()
public final double addAndGet(double delta)
delta
- the value to add.public java.lang.String toString()
toString
in class java.lang.Object
public int intValue()
intValue
in class java.lang.Number
public long longValue()
longValue
in class java.lang.Number
public float floatValue()
floatValue
in class java.lang.Number
public double doubleValue()
doubleValue
in class java.lang.Number