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
74 public MutableFloatElectricalChargeVector(final List<FloatElectricalCharge> values, final StorageType storageType)
75 throws ValueException
76 {
77 super(values, storageType);
78 }
79
80
81
82
83
84
85
86
87
88 public MutableFloatElectricalChargeVector(final SortedMap<Integer, FloatElectricalCharge> values, final int length,
89 final StorageType storageType) throws ValueException
90 {
91 super(values, length, storageType);
92 }
93
94
95
96
97
98
99
100
101
102
103 public MutableFloatElectricalChargeVector(final SortedMap<Integer, Float> values, final ElectricalChargeUnit unit,
104 final int length, final StorageType storageType) throws ValueException
105 {
106 super(values, unit, length, storageType);
107 }
108
109
110
111
112
113 MutableFloatElectricalChargeVector(final FloatVectorData data, final ElectricalChargeUnit unit)
114 {
115 super(data, unit);
116 }
117
118
119 @Override
120 protected final FloatElectricalChargeVector instantiateType(final FloatVectorData dvd, final ElectricalChargeUnit unit)
121 {
122 return new FloatElectricalChargeVector(dvd, unit);
123 }
124
125
126 @Override
127 protected final MutableFloatElectricalChargeVector instantiateMutableType(final FloatVectorData dvd,
128 final ElectricalChargeUnit unit)
129 {
130 return new MutableFloatElectricalChargeVector(dvd, unit);
131 }
132
133
134 @Override
135 protected final FloatElectricalCharge instantiateScalar(final float value, final ElectricalChargeUnit unit)
136 {
137 return new FloatElectricalCharge(value, unit);
138 }
139
140
141 @Override
142 public final MutableFloatElectricalChargeVector toDense()
143 {
144 return this.data.isDense() ? (MutableFloatElectricalChargeVector) this
145 : instantiateMutableType(this.data.toDense(), getUnit());
146 }
147
148
149 @Override
150 public final MutableFloatElectricalChargeVector toSparse()
151 {
152 return this.data.isSparse() ? (MutableFloatElectricalChargeVector) this
153 : instantiateMutableType(this.data.toSparse(), getUnit());
154 }
155
156
157
158
159
160
161 public FloatElectricalCharge[] toArray()
162 {
163 FloatElectricalCharge[] array = new FloatElectricalCharge[size()];
164 for (int i = 0; i < size(); i++)
165 {
166 try
167 {
168 array[i] = get(i);
169 }
170 catch (ValueException exception)
171 {
172 throw new RuntimeException(exception);
173 }
174 }
175 return array;
176 }
177
178 }