1 package org.djunits.value.vfloat.vector;
2
3 import java.util.List;
4 import java.util.SortedMap;
5
6 import org.djunits.unit.ElectricalChargeUnit;
7 import org.djunits.value.StorageType;
8 import org.djunits.value.ValueException;
9 import org.djunits.value.vfloat.scalar.FloatElectricalCharge;
10
11
12
13
14
15
16
17
18
19
20
21
22 public class FloatElectricalChargeVector extends AbstractFloatVectorRel<ElectricalChargeUnit, FloatElectricalChargeVector,
23 MutableFloatElectricalChargeVector, FloatElectricalCharge>
24 {
25
26 private static final long serialVersionUID = 20151109L;
27
28
29
30
31
32
33
34
35 public FloatElectricalChargeVector(final float[] values, final ElectricalChargeUnit unit, final StorageType storageType)
36 throws ValueException
37 {
38 super(values, unit, storageType);
39 }
40
41
42
43
44
45
46
47
48 public FloatElectricalChargeVector(final List<Float> values, final ElectricalChargeUnit unit, final StorageType storageType)
49 throws ValueException
50 {
51 super(values, unit, storageType);
52 }
53
54
55
56
57
58
59
60
61 public FloatElectricalChargeVector(final FloatElectricalCharge[] values, final StorageType storageType)
62 throws ValueException
63 {
64 super(values, storageType);
65 }
66
67
68
69
70
71
72
73 public FloatElectricalChargeVector(final List<FloatElectricalCharge> values, final StorageType storageType)
74 throws ValueException
75 {
76 super(values, storageType);
77 }
78
79
80
81
82
83
84
85
86
87 public FloatElectricalChargeVector(final SortedMap<Integer, FloatElectricalCharge> values, final int length,
88 final StorageType storageType) throws ValueException
89 {
90 super(values, length, storageType);
91 }
92
93
94
95
96
97
98
99
100
101 public FloatElectricalChargeVector(final SortedMap<Integer, Float> values, final ElectricalChargeUnit unit,
102 final int length, final StorageType storageType) throws ValueException
103 {
104 super(values, unit, length, storageType);
105 }
106
107
108
109
110
111 FloatElectricalChargeVector(final FloatVectorData data, final ElectricalChargeUnit unit)
112 {
113 super(data, unit);
114 }
115
116
117 @Override
118 protected final FloatElectricalChargeVector instantiateType(final FloatVectorData dvd, final ElectricalChargeUnit unit)
119 {
120 return new FloatElectricalChargeVector(dvd, unit);
121 }
122
123
124 @Override
125 protected final MutableFloatElectricalChargeVector instantiateMutableType(final FloatVectorData dvd,
126 final ElectricalChargeUnit unit)
127 {
128 return new MutableFloatElectricalChargeVector(dvd, unit);
129 }
130
131
132 @Override
133 protected final FloatElectricalCharge instantiateScalar(final float value, final ElectricalChargeUnit unit)
134 {
135 return new FloatElectricalCharge(value, unit);
136 }
137
138
139 @Override
140 public final FloatElectricalChargeVector toDense()
141 {
142 return this.data.isDense() ? (FloatElectricalChargeVector) this : instantiateType(this.data.toDense(), getUnit());
143 }
144
145
146 @Override
147 public final FloatElectricalChargeVector toSparse()
148 {
149 return this.data.isSparse() ? (FloatElectricalChargeVector) this : instantiateType(this.data.toSparse(), getUnit());
150 }
151
152
153
154
155
156
157 public FloatElectricalCharge[] toArray()
158 {
159 FloatElectricalCharge[] array = new FloatElectricalCharge[size()];
160 for (int i = 0; i < size(); i++)
161 {
162 try
163 {
164 array[i] = get(i);
165 }
166 catch (ValueException exception)
167 {
168 throw new RuntimeException(exception);
169 }
170 }
171 return array;
172 }
173
174 }