AtomicDoubleArray.java
3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
package com.google.common.util.concurrent;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.concurrent.atomic.AtomicLongArray;
public class AtomicDoubleArray
implements Serializable
{
private static final long serialVersionUID = 0L;
private transient AtomicLongArray a;
public AtomicDoubleArray(int paramInt)
{
this.a = new AtomicLongArray(paramInt);
}
public AtomicDoubleArray(double[] paramArrayOfDouble)
{
int j = paramArrayOfDouble.length;
long[] arrayOfLong = new long[j];
int i = 0;
while (i < j)
{
arrayOfLong[i] = Double.doubleToRawLongBits(paramArrayOfDouble[i]);
i += 1;
}
this.a = new AtomicLongArray(arrayOfLong);
}
private void readObject(ObjectInputStream paramObjectInputStream)
throws IOException, ClassNotFoundException
{
paramObjectInputStream.defaultReadObject();
int j = paramObjectInputStream.readInt();
this.a = new AtomicLongArray(j);
int i = 0;
while (i < j)
{
set(i, paramObjectInputStream.readDouble());
i += 1;
}
}
private void writeObject(ObjectOutputStream paramObjectOutputStream)
throws IOException
{
paramObjectOutputStream.defaultWriteObject();
int j = length();
paramObjectOutputStream.writeInt(j);
int i = 0;
while (i < j)
{
paramObjectOutputStream.writeDouble(get(i));
i += 1;
}
}
public double addAndGet(int paramInt, double paramDouble)
{
long l1;
double d;
long l2;
do
{
l1 = this.a.get(paramInt);
d = Double.longBitsToDouble(l1) + paramDouble;
l2 = Double.doubleToRawLongBits(d);
} while (!this.a.compareAndSet(paramInt, l1, l2));
return d;
}
public final boolean compareAndSet(int paramInt, double paramDouble1, double paramDouble2)
{
return this.a.compareAndSet(paramInt, Double.doubleToRawLongBits(paramDouble1), Double.doubleToRawLongBits(paramDouble2));
}
public final double get(int paramInt)
{
return Double.longBitsToDouble(this.a.get(paramInt));
}
public final double getAndAdd(int paramInt, double paramDouble)
{
long l1;
double d;
long l2;
do
{
l1 = this.a.get(paramInt);
d = Double.longBitsToDouble(l1);
l2 = Double.doubleToRawLongBits(d + paramDouble);
} while (!this.a.compareAndSet(paramInt, l1, l2));
return d;
}
public final double getAndSet(int paramInt, double paramDouble)
{
long l = Double.doubleToRawLongBits(paramDouble);
return Double.longBitsToDouble(this.a.getAndSet(paramInt, l));
}
public final void lazySet(int paramInt, double paramDouble)
{
set(paramInt, paramDouble);
}
public final int length()
{
return this.a.length();
}
public final void set(int paramInt, double paramDouble)
{
long l = Double.doubleToRawLongBits(paramDouble);
this.a.set(paramInt, l);
}
public String toString()
{
int j = length() - 1;
if (j == -1) {
return "[]";
}
StringBuilder localStringBuilder = new StringBuilder((j + 1) * 19);
localStringBuilder.append('[');
int i = 0;
for (;;)
{
localStringBuilder.append(Double.longBitsToDouble(this.a.get(i)));
if (i == j) {
return ']';
}
localStringBuilder.append(',').append(' ');
i += 1;
}
}
public final boolean weakCompareAndSet(int paramInt, double paramDouble1, double paramDouble2)
{
return this.a.weakCompareAndSet(paramInt, Double.doubleToRawLongBits(paramDouble1), Double.doubleToRawLongBits(paramDouble2));
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/google/common/util/concurrent/AtomicDoubleArray.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/