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