1 package org.djunits.value.vdouble.vector;
2
3 import java.util.List;
4 import java.util.SortedMap;
5
6 import org.djunits.unit.AbsoluteLinearUnit;
7 import org.djunits.unit.Unit;
8 import org.djunits.value.StorageType;
9 import org.djunits.value.ValueException;
10 import org.djunits.value.vdouble.scalar.DoubleScalar;
11
12
13
14
15
16
17
18
19
20
21
22
23 public abstract class DoubleVector
24 {
25
26
27
28
29
30 public static class Abs<AU extends AbsoluteLinearUnit<AU, RU>, RU extends Unit<RU>> extends AbstractDoubleVectorAbs<AU, RU,
31 DoubleVector.Abs<AU, RU>, DoubleVector.Rel<RU>, MutableDoubleVector.Abs<AU, RU>, DoubleScalar.Abs<AU, RU>>
32 {
33
34 private static final long serialVersionUID = 20150626L;
35
36
37
38
39
40
41
42
43 public Abs(final double[] values, final AU unit, final StorageType storageType) throws ValueException
44 {
45 super(values, unit, storageType);
46 }
47
48
49
50
51
52
53
54
55 public Abs(final List<Double> values, final AU unit, final StorageType storageType) throws ValueException
56 {
57 super(values, unit, storageType);
58 }
59
60
61
62
63
64
65
66 public Abs(final DoubleScalar.Abs<AU, RU>[] values, final StorageType storageType) throws ValueException
67 {
68 super(values, storageType);
69 }
70
71
72
73
74
75
76
77 public Abs(final List<DoubleScalar.Abs<AU, RU>> values, final StorageType storageType) throws ValueException
78 {
79 super(values, storageType);
80 }
81
82
83
84
85
86
87
88
89 public Abs(final SortedMap<Integer, DoubleScalar.Abs<AU, RU>> values, final int length, final StorageType storageType)
90 throws ValueException
91 {
92 super(values, length, storageType);
93 }
94
95
96
97
98
99
100
101
102
103 public Abs(final SortedMap<Integer, Double> values, final AU unit, final int length, final StorageType storageType)
104 throws ValueException
105 {
106 super(values, unit, length, storageType);
107 }
108
109
110
111
112
113
114 public Abs(final DoubleVectorData data, final AU unit)
115 {
116 super(data, unit);
117 }
118
119
120 @Override
121 protected final DoubleVector.Abs<AU, RU> instantiateTypeAbs(final DoubleVectorData dvd, final AU unit)
122 {
123 return new DoubleVector.Abs<AU, RU>(dvd, unit);
124 }
125
126
127 @Override
128 protected final DoubleVector.Rel<RU> instantiateTypeRel(final DoubleVectorData dvd, final RU unit)
129 {
130 return new DoubleVector.Rel<RU>(dvd, unit);
131 }
132
133
134 @Override
135 protected final MutableDoubleVector.Abs<AU, RU> instantiateMutableType(final DoubleVectorData dvd, final AU unit)
136 {
137 return new MutableDoubleVector.Abs<AU, RU>(dvd, unit);
138 }
139
140
141 @Override
142 protected final DoubleScalar.Abs<AU, RU> instantiateScalar(final double value, final AU unit)
143 {
144 return new DoubleScalar.Abs<AU, RU>(value, unit);
145 }
146
147
148 @Override
149 public final DoubleVector.Abs<AU, RU> toDense()
150 {
151 return this.data.isDense() ? (DoubleVector.Abs<AU, RU>) this : instantiateTypeAbs(this.data.toDense(), getUnit());
152 }
153
154
155 @Override
156 public final DoubleVector.Abs<AU, RU> toSparse()
157 {
158 return this.data.isSparse() ? (DoubleVector.Abs<AU, RU>) this : instantiateTypeAbs(this.data.toSparse(), getUnit());
159 }
160
161 }
162
163
164
165
166
167 public static class Rel<U extends Unit<U>>
168 extends AbstractDoubleVectorRel<U, DoubleVector.Rel<U>, MutableDoubleVector.Rel<U>, DoubleScalar.Rel<U>>
169 {
170
171 private static final long serialVersionUID = 20150626L;
172
173
174
175
176
177
178
179
180 public Rel(final double[] values, final U unit, final StorageType storageType) throws ValueException
181 {
182 super(values, unit, storageType);
183 }
184
185
186
187
188
189
190
191
192 public Rel(final List<Double> values, final U unit, final StorageType storageType) throws ValueException
193 {
194 super(values, unit, storageType);
195 }
196
197
198
199
200
201
202
203 public Rel(final DoubleScalar.Rel<U>[] values, final StorageType storageType) throws ValueException
204 {
205 super(values, storageType);
206 }
207
208
209
210
211
212
213
214 public Rel(final List<DoubleScalar.Rel<U>> values, final StorageType storageType) throws ValueException
215 {
216 super(values, storageType);
217 }
218
219
220
221
222
223
224
225
226 public Rel(final SortedMap<Integer, DoubleScalar.Rel<U>> values, final int length, final StorageType storageType)
227 throws ValueException
228 {
229 super(values, length, storageType);
230 }
231
232
233
234
235
236
237
238
239
240 public Rel(final SortedMap<Integer, Double> values, final U unit, final int length, final StorageType storageType)
241 throws ValueException
242 {
243 super(values, unit, length, storageType);
244 }
245
246
247
248
249
250
251 public Rel(final DoubleVectorData data, final U unit)
252 {
253 super(data, unit);
254 }
255
256
257 @Override
258 protected final DoubleVector.Rel<U> instantiateType(final DoubleVectorData dvd, final U unit)
259 {
260 return new DoubleVector.Rel<U>(dvd, unit);
261 }
262
263
264 @Override
265 protected final MutableDoubleVector.Rel<U> instantiateMutableType(final DoubleVectorData dvd, final U unit)
266 {
267 return new MutableDoubleVector.Rel<U>(dvd, unit);
268 }
269
270
271 @Override
272 protected final DoubleScalar.Rel<U> instantiateScalar(final double value, final U unit)
273 {
274 return new DoubleScalar.Rel<U>(value, unit);
275 }
276
277
278 @Override
279 public final DoubleVector.Rel<U> toDense()
280 {
281 return this.data.isDense() ? (DoubleVector.Rel<U>) this : instantiateType(this.data.toDense(), getUnit());
282 }
283
284
285 @Override
286 public final DoubleVector.Rel<U> toSparse()
287 {
288 return this.data.isSparse() ? (DoubleVector.Rel<U>) this : instantiateType(this.data.toSparse(), getUnit());
289 }
290
291 }
292 }