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 MutableFloatElectricalChargeVector extends AbstractMutableFloatVectorRel<ElectricalChargeUnit,
23 FloatElectricalChargeVector, MutableFloatElectricalChargeVector, FloatElectricalCharge>
24 {
25
26 private static final long serialVersionUID = 20151109L;
27
28
29
30
31
32
33
34
35 public MutableFloatElectricalChargeVector(final float[] values, final ElectricalChargeUnit unit,
36 final StorageType storageType) throws ValueException
37 {
38 super(values, unit, storageType);
39 }
40
41
42
43
44
45
46
47
48 public MutableFloatElectricalChargeVector(final List<Float> values, final ElectricalChargeUnit unit,
49 final StorageType storageType) throws ValueException
50 {
51 super(values, unit, storageType);
52 }
53
54
55
56
57
58
59
60
61 public MutableFloatElectricalChargeVector(final FloatElectricalCharge[] values, final StorageType storageType)
62 throws ValueException
63 {
64 super(values, storageType);
65 }
66
67
68
69
70
71
72
73 public MutableFloatElectricalChargeVector(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 MutableFloatElectricalChargeVector(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 MutableFloatElectricalChargeVector(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 MutableFloatElectricalChargeVector(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 MutableFloatElectricalChargeVector toDense()
141 {
142 return this.data.isDense() ? (MutableFloatElectricalChargeVector) this
143 : instantiateMutableType(this.data.toDense(), getUnit());
144 }
145
146
147 @Override
148 public final MutableFloatElectricalChargeVector toSparse()
149 {
150 return this.data.isSparse() ? (MutableFloatElectricalChargeVector) this
151 : instantiateMutableType(this.data.toSparse(), getUnit());
152 }
153
154
155
156
157
158
159 public FloatElectricalCharge[] toArray()
160 {
161 FloatElectricalCharge[] array = new FloatElectricalCharge[size()];
162 for (int i = 0; i < size(); i++)
163 {
164 try
165 {
166 array[i] = get(i);
167 }
168 catch (ValueException exception)
169 {
170 throw new RuntimeException(exception);
171 }
172 }
173 return array;
174 }
175
176 }