public class DoubleMaxUpdater extends Number implements Serializable
double maximum
with initial value Double.NEGATIVE_INFINITY. When updates (method
update(double)) are contended across threads, the set of variables may grow
dynamically to reduce contention. Method max() (or, equivalently,
doubleValue()) returns the current maximum across the variables
maintaining updates.
This class extends Number, but does not define methods
such as equals, hashCode and compareTo because instances are expected to be mutated, and so are not
useful as collection keys.
jsr166e note: This class is targeted to be placed in java.util.concurrent.atomic.
| 构造器和说明 |
|---|
DoubleMaxUpdater()
Creates a new instance with initial value of
Double.NEGATIVE_INFINITY. |
| 限定符和类型 | 方法和说明 |
|---|---|
double |
doubleValue()
Equivalent to
max(). |
float |
floatValue()
Returns the
max() as a float after a narrowing primitive
conversion. |
int |
intValue()
Returns the
max() as an int after a narrowing primitive
conversion. |
long |
longValue()
Returns the
max() as a long after a narrowing primitive
conversion. |
double |
max()
Returns the current maximum.
|
double |
maxThenReset()
|
void |
reset()
Resets variables maintaining updates to
Double.NEGATIVE_INFINITY. |
String |
toString()
Returns the String representation of the
max(). |
void |
update(double x)
Updates the maximum to be at least the given value.
|
byteValue, shortValuepublic DoubleMaxUpdater()
Double.NEGATIVE_INFINITY.public void update(double x)
x - the value to updatepublic double max()
public void reset()
Double.NEGATIVE_INFINITY. This method may be a useful alternative to
creating a new updater, but is only effective if there are no concurrent
updates. Because this method is intrinsically racy, it should only be
used when it is known that no threads are concurrently updating.public double maxThenReset()
max() followed by reset(). This method may apply for example during quiescent points
between multithreaded computations. If there are updates concurrent with
this method, the returned value is
not guaranteed to be the final value occurring before the reset.public double doubleValue()
max().doubleValue 在类中 Numberpublic long longValue()
max() as a long after a narrowing primitive
conversion.public int intValue()
max() as an int after a narrowing primitive
conversion.public float floatValue()
max() as a float after a narrowing primitive
conversion.floatValue 在类中 NumberCopyright © 2013 The Skfiy Open Association. All Rights Reserved.