38 |
|
* @author Martin Buchholz |
39 |
|
*/ |
40 |
|
public class AtomicDouble extends Number implements java.io.Serializable { |
41 |
< |
static final long serialVersionUID = -8405198993435143622L; |
41 |
> |
private static final long serialVersionUID = -8405198993435143622L; |
42 |
|
|
43 |
|
private volatile long value; |
44 |
|
|
54 |
|
/** |
55 |
|
* Creates a new {@code AtomicDouble} with initial value {@code 0.0}. |
56 |
|
*/ |
57 |
< |
public AtomicDouble() { this(0.0); } |
57 |
> |
public AtomicDouble() { |
58 |
> |
// assert doubleToRawLongBits(0.0) == 0L; |
59 |
> |
} |
60 |
|
|
61 |
|
/** |
62 |
|
* Gets the current value. |
123 |
|
* if the current value is <a href="#bitEquals">bitwise equal</a> |
124 |
|
* to the expected value. |
125 |
|
* |
126 |
< |
* <p>May <a href="package-summary.html#Spurious">fail spuriously</a> |
126 |
> |
* <p>May <a |
127 |
> |
* href="http://download.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/package-summary.html#Spurious"> |
128 |
> |
* fail spuriously</a> |
129 |
|
* and does not provide ordering guarantees, so is only rarely an |
130 |
|
* appropriate alternative to {@code compareAndSet}. |
131 |
|
* |
184 |
|
* after a narrowing primitive conversion. |
185 |
|
*/ |
186 |
|
public int intValue() { |
187 |
< |
return (int)get(); |
187 |
> |
return (int) get(); |
188 |
|
} |
189 |
|
|
190 |
|
/** |
192 |
|
* after a narrowing primitive conversion. |
193 |
|
*/ |
194 |
|
public long longValue() { |
195 |
< |
return (long)get(); |
195 |
> |
return (long) get(); |
196 |
|
} |
197 |
|
|
198 |
|
/** |
200 |
|
* after a narrowing primitive conversion. |
201 |
|
*/ |
202 |
|
public float floatValue() { |
203 |
< |
return (float)get(); |
203 |
> |
return (float) get(); |
204 |
|
} |
205 |
|
|
206 |
|
/** |