Methods Summary |
---|
public java.lang.Double | DoubleValue()
return value.get();
|
public double | addAndGet(double delta)
Double origVal, newVal;
while (true) {
origVal = value.get();
newVal = new Double(origVal.doubleValue() + delta);
if (value.compareAndSet(origVal, newVal))
return newVal.doubleValue();
}
|
public byte | byteValue()
return (byte)intValue();
|
public boolean | compareAndSet(double expect, double update)
Double origVal, newVal;
newVal = new Double(update);
while (true) {
origVal = value.get();
if (Double.compare(origVal.doubleValue(), expect) == 0) {
if (value.compareAndSet(origVal, newVal))
return true;
} else {
return false;
}
}
|
public int | compareTo(java.lang.Double aValue)
return Double.compare(doubleValue(), aValue.doubleValue());
|
public int | compareTo(javathreads.examples.ch05.AtomicDouble aValue)
return Double.compare(doubleValue(), aValue.doubleValue());
|
public double | decrementAndGet()
return addAndGet((double) -1.0);
|
public double | doubleValue()
return DoubleValue().doubleValue();
|
public boolean | equals(java.lang.Object obj)
Double origVal = DoubleValue();
return ((obj instanceof Double)
&& (origVal.equals((Double)obj)))
||
((obj instanceof AtomicDouble)
&&
(origVal.equals(((AtomicDouble)obj).DoubleValue())));
|
public float | floatValue()
return DoubleValue().floatValue();
|
public double | get()
return value.get().doubleValue();
|
public double | getAndAdd(double delta)
Double origVal, newVal;
while (true) {
origVal = value.get();
newVal = new Double(origVal.doubleValue() + delta);
if (value.compareAndSet(origVal, newVal))
return origVal.doubleValue();
}
|
public double | getAndDecrement()
return getAndAdd((double) -1.0);
|
public double | getAndIncrement()
return getAndAdd((double) 1.0);
|
public double | getAndMultiply(double multiple)
Double origVal, newVal;
while (true) {
origVal = value.get();
newVal = new Double(origVal.doubleValue() * multiple);
if (value.compareAndSet(origVal, newVal))
return origVal.doubleValue();
}
|
public double | getAndSet(double setVal)
Double origVal, newVal;
newVal = new Double(setVal);
while (true) {
origVal = value.get();
if (value.compareAndSet(origVal, newVal))
return origVal.doubleValue();
}
|
public int | hashCode()
return DoubleValue().hashCode();
|
public double | incrementAndGet()
return addAndGet((double) 1.0);
|
public int | intValue()
return DoubleValue().intValue();
|
public boolean | isInfinite()
return DoubleValue().isInfinite();
|
public boolean | isNaN()
return DoubleValue().isNaN();
|
public long | longValue()
return DoubleValue().longValue();
|
public double | multiplyAndGet(double multiple)
Double origVal, newVal;
while (true) {
origVal = value.get();
newVal = new Double(origVal.doubleValue() * multiple);
if (value.compareAndSet(origVal, newVal))
return newVal.doubleValue();
}
|
public void | set(double newVal)
value.set(new Double(newVal));
|
public short | shortValue()
return (short)intValue();
|
public java.lang.String | toString()
return DoubleValue().toString();
|
public boolean | weakCompareAndSet(double expect, double update)
return compareAndSet(expect, update);
|