public class AtomicDouble extends Number
This class is an internal implementation detail only intended for use within spectator. It is subject to change without notice.
Constructor and Description |
---|
AtomicDouble()
Create an instance with an initial value of 0.
|
AtomicDouble(double init)
Create an instance with an initial value of
init . |
Modifier and Type | Method and Description |
---|---|
double |
addAndGet(double amount)
Add
amount to the value and return the new value. |
boolean |
compareAndSet(double expect,
double update)
Set the value to
amount if the current value is expect . |
double |
doubleValue() |
float |
floatValue() |
double |
get()
Return the current value.
|
double |
getAndAdd(double amount)
Add
amount to the value and return the previous value. |
double |
getAndSet(double amount)
Set the value to
amount and return the previous value. |
int |
intValue() |
long |
longValue() |
void |
max(double v)
Set the current value to the maximum of the current value or the provided value.
|
void |
set(double amount)
Set the current value to
amount . |
byteValue, shortValue
public AtomicDouble()
public AtomicDouble(double init)
init
.public double get()
public double addAndGet(double amount)
amount
to the value and return the new value.public double getAndAdd(double amount)
amount
to the value and return the previous value.public double getAndSet(double amount)
amount
and return the previous value.public boolean compareAndSet(double expect, double update)
amount
if the current value is expect
. Return true if the
value was updated.public void set(double amount)
amount
.public void max(double v)
public float floatValue()
floatValue
in class Number
public double doubleValue()
doubleValue
in class Number