View Javadoc
1   package org.djunits.value.vfloat.vector;
2   
3   import java.util.List;
4   import java.util.Map;
5   
6   import org.djunits.unit.AngularVelocityUnit;
7   import org.djunits.unit.scale.IdentityScale;
8   import org.djunits.value.storage.StorageType;
9   import org.djunits.value.vfloat.scalar.FloatAngularVelocity;
10  import org.djunits.value.vfloat.vector.base.FloatVectorRel;
11  import org.djunits.value.vfloat.vector.data.FloatVectorData;
12  
13  import jakarta.annotation.Generated;
14  
15  /**
16   * Immutable Float FloatAngularVelocityVector, a vector of values with a AngularVelocityUnit.
17   * <p>
18   * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
19   * BSD-style license. See <a href="https://djunits.org/docs/license.html">DJUNITS License</a>.
20   * </p>
21   * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
22   * @author <a href="https://www.tudelft.nl/staff/p.knoppers/">Peter Knoppers</a>
23   */
24  @Generated(value = "org.djunits.generator.GenerateDJUNIT", date = "2023-07-23T14:06:38.224104100Z")
25  public class FloatAngularVelocityVector
26          extends FloatVectorRel<AngularVelocityUnit, FloatAngularVelocity, FloatAngularVelocityVector>
27  
28  {
29      /** */
30      private static final long serialVersionUID = 20190905L;
31  
32      /**
33       * Construct a FloatAngularVelocityVector from an internal data object.
34       * @param data FloatVectorData; the internal data object for the vector
35       * @param displayUnit AngularVelocityUnit; the display unit of the vector data
36       */
37      public FloatAngularVelocityVector(final FloatVectorData data, final AngularVelocityUnit displayUnit)
38      {
39          super(data, displayUnit);
40      }
41  
42      /* CONSTRUCTORS WITH float[] */
43  
44      /**
45       * Construct a FloatAngularVelocityVector from a float[] object. The Float values are expressed in the displayUnit, and will
46       * be printed using the displayUnit.
47       * @param data float[]; the data for the vector, expressed in the displayUnit
48       * @param displayUnit AngularVelocityUnit; the unit of the values in the data array, and display unit when printing
49       * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector
50       */
51      public FloatAngularVelocityVector(final float[] data, final AngularVelocityUnit displayUnit, final StorageType storageType)
52      {
53          this(FloatVectorData.instantiate(data, displayUnit.getScale(), storageType), displayUnit);
54      }
55  
56      /**
57       * Construct a FloatAngularVelocityVector from a float[] object. The Float values are expressed in the displayUnit. Assume
58       * that the StorageType is DENSE since we offer the data as an array.
59       * @param data float[]; the data for the vector
60       * @param displayUnit AngularVelocityUnit; the unit of the values in the data array, and display unit when printing
61       */
62      public FloatAngularVelocityVector(final float[] data, final AngularVelocityUnit displayUnit)
63      {
64          this(data, displayUnit, StorageType.DENSE);
65      }
66  
67      /**
68       * Construct a FloatAngularVelocityVector from a float[] object with SI-unit values.
69       * @param data float[]; the data for the vector, in SI units
70       * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector
71       */
72      public FloatAngularVelocityVector(final float[] data, final StorageType storageType)
73      {
74          this(data, AngularVelocityUnit.SI, storageType);
75      }
76  
77      /**
78       * Construct a FloatAngularVelocityVector from a float[] object with SI-unit values. Assume that the StorageType is DENSE
79       * since we offer the data as an array.
80       * @param data float[]; the data for the vector, in SI units
81       */
82      public FloatAngularVelocityVector(final float[] data)
83      {
84          this(data, StorageType.DENSE);
85      }
86  
87      /* CONSTRUCTORS WITH FloatAngularVelocity[] */
88  
89      /**
90       * Construct a FloatAngularVelocityVector from an array of FloatAngularVelocity objects. The FloatAngularVelocity values are
91       * each expressed in their own unit, but will be internally stored as SI values, all expressed in the displayUnit when
92       * printing.
93       * @param data FloatAngularVelocity[]; the data for the vector
94       * @param displayUnit AngularVelocityUnit; the display unit of the values when printing
95       * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector
96       */
97      public FloatAngularVelocityVector(final FloatAngularVelocity[] data, final AngularVelocityUnit displayUnit,
98              final StorageType storageType)
99      {
100         this(FloatVectorData.instantiate(data, storageType), displayUnit);
101     }
102 
103     /**
104      * Construct a FloatAngularVelocityVector from an array of FloatAngularVelocity objects. The FloatAngularVelocity values are
105      * each expressed in their own unit, but will be internally stored as SI values, all expressed in the displayUnit when
106      * printing. Assume that the StorageType is DENSE since we offer the data as an array.
107      * @param data FloatAngularVelocity[]; the data for the vector
108      * @param displayUnit AngularVelocityUnit; the display unit of the values when printing
109      */
110     public FloatAngularVelocityVector(final FloatAngularVelocity[] data, final AngularVelocityUnit displayUnit)
111     {
112         this(data, displayUnit, StorageType.DENSE);
113     }
114 
115     /**
116      * Construct a FloatAngularVelocityVector from an array of FloatAngularVelocity objects. The FloatAngularVelocity values are
117      * each expressed in their own unit, but will be internally stored as SI values, and expressed using SI units when printing.
118      * since we offer the data as an array.
119      * @param data FloatAngularVelocity[]; the data for the vector
120      * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector
121      */
122     public FloatAngularVelocityVector(final FloatAngularVelocity[] data, final StorageType storageType)
123     {
124         this(data, AngularVelocityUnit.SI, storageType);
125     }
126 
127     /**
128      * Construct a FloatAngularVelocityVector from an array of FloatAngularVelocity objects. The FloatAngularVelocity values are
129      * each expressed in their own unit, but will be internally stored as SI values, and expressed using SI units when printing.
130      * Assume that the StorageType is DENSE since we offer the data as an array.
131      * @param data FloatAngularVelocity[]; the data for the vector
132      */
133     public FloatAngularVelocityVector(final FloatAngularVelocity[] data)
134     {
135         this(data, StorageType.DENSE);
136     }
137 
138     /* CONSTRUCTORS WITH List<Float> or List<AngularVelocity> */
139 
140     /**
141      * Construct a FloatAngularVelocityVector from a list of Number objects or a list of FloatAngularVelocity objects. Note that
142      * the displayUnit has a different meaning depending on whether the list contains Number objects (e.g., Float objects) or
143      * FloatAngularVelocity objects. In case the list contains Number objects, the displayUnit indicates the unit in which the
144      * values in the list are expressed, as well as the unit in which they will be printed. In case the list contains
145      * FloatAngularVelocity objects, each FloatAngularVelocity has its own unit, and the displayUnit is just used for printing.
146      * The values but will always be internally stored as SI values or base values, and expressed using the display unit or base
147      * unit when printing.
148      * @param data List&lt;Float&gt; or List&lt;AngularVelocity&gt;; the data for the vector
149      * @param displayUnit AngularVelocityUnit; the display unit of the vector data, and the unit of the data points when the
150      *            data is expressed as List&lt;Float&gt; or List&lt;Number&gt; in general
151      * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector
152      */
153     public FloatAngularVelocityVector(final List<? extends Number> data, final AngularVelocityUnit displayUnit,
154             final StorageType storageType)
155     {
156         this(data.size() == 0 ? FloatVectorData.instantiate(new float[] {}, IdentityScale.SCALE, storageType)
157                 : data.get(0) instanceof FloatAngularVelocity
158                         ? FloatVectorData.instantiate(data, IdentityScale.SCALE, storageType)
159                         : FloatVectorData.instantiate(data, displayUnit.getScale(), storageType),
160                 displayUnit);
161     }
162 
163     /**
164      * Construct a FloatAngularVelocityVector from a list of Number objects or a list of FloatAngularVelocity objects. Note that
165      * the displayUnit has a different meaning depending on whether the list contains Number objects (e.g., Float objects) or
166      * FloatAngularVelocity objects. In case the list contains Number objects, the displayUnit indicates the unit in which the
167      * values in the list are expressed, as well as the unit in which they will be printed. In case the list contains
168      * FloatAngularVelocity objects, each FloatAngularVelocity has its own unit, and the displayUnit is just used for printing.
169      * The values but will always be internally stored as SI values or base values, and expressed using the display unit or base
170      * unit when printing. Assume the storage type is DENSE since we offer the data as a List.
171      * @param data List&lt;Float&gt; or List&lt;AngularVelocity&gt;; the data for the vector
172      * @param displayUnit AngularVelocityUnit; the display unit of the vector data, and the unit of the data points when the
173      *            data is expressed as List&lt;Float&gt; or List&lt;Number&gt; in general
174      */
175     public FloatAngularVelocityVector(final List<? extends Number> data, final AngularVelocityUnit displayUnit)
176     {
177         this(data, displayUnit, StorageType.DENSE);
178     }
179 
180     /**
181      * Construct a FloatAngularVelocityVector from a list of Number objects or a list of FloatAngularVelocity objects. When data
182      * contains numbers such as Float, assume that they are expressed using SI units. When the data consists of
183      * FloatAngularVelocity objects, they each have their own unit, but will be printed using SI units or base units. The values
184      * but will always be internally stored as SI values or base values, and expressed using the display unit or base unit when
185      * printing.
186      * @param data List&lt;Float&gt; or List&lt;AngularVelocity&gt;; the data for the vector
187      * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector
188      */
189     public FloatAngularVelocityVector(final List<? extends Number> data, final StorageType storageType)
190     {
191         this(data, AngularVelocityUnit.SI, storageType);
192     }
193 
194     /**
195      * Construct a FloatAngularVelocityVector from a list of Number objects or a list of FloatAngularVelocity objects. When data
196      * contains numbers such as Float, assume that they are expressed using SI units. When the data consists of
197      * FloatAngularVelocity objects, they each have their own unit, but will be printed using SI units or base units. The values
198      * but will always be internally stored as SI values or base values, and expressed using the display unit or base unit when
199      * printing. Assume the storage type is DENSE since we offer the data as a List.
200      * @param data List&lt;Float&gt; or List&lt;AngularVelocity&gt;; the data for the vector
201      */
202     public FloatAngularVelocityVector(final List<? extends Number> data)
203     {
204         this(data, StorageType.DENSE);
205     }
206 
207     /* CONSTRUCTORS WITH Map<Integer, Float> or Map<Integer, FloatAngularVelocity> */
208 
209     /**
210      * Construct a FloatAngularVelocityVector from a (sparse) map of index values to Number objects or a (sparse) map of index
211      * values to of FloatAngularVelocity objects. Using index values is particularly useful for sparse vectors. The size
212      * parameter indicates the size of the vector, since the largest index does not have to be part of the map. Note that the
213      * displayUnit has a different meaning depending on whether the map contains Number objects (e.g., Float objects) or
214      * FloatAngularVelocity objects. In case the map contains Number objects, the displayUnit indicates the unit in which the
215      * values in the map are expressed, as well as the unit in which they will be printed. In case the map contains
216      * FloatAngularVelocity objects, each FloatAngularVelocity has its own unit, and the displayUnit is just used for printing.
217      * The values but will always be internally stored as SI values or base values, and expressed using the display unit or base
218      * unit when printing.
219      * @param data Map&lt;Integer, Float&gt; or Map&lt;Integer, FloatAngularVelocity&gt;; the data for the vector
220      * @param size int; the size off the vector, i.e., the highest index
221      * @param displayUnit AngularVelocityUnit; the display unit of the vector data, and the unit of the data points when the
222      *            data is expressed as List&lt;Float&gt; or List&lt;Number&gt; in general
223      * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector
224      */
225     public FloatAngularVelocityVector(final Map<Integer, ? extends Number> data, final int size,
226             final AngularVelocityUnit displayUnit, final StorageType storageType)
227     {
228         this(data.size() == 0 ? FloatVectorData.instantiate(data, size, IdentityScale.SCALE, storageType)
229                 : data.values().iterator().next() instanceof FloatAngularVelocity
230                         ? FloatVectorData.instantiate(data, size, IdentityScale.SCALE, storageType)
231                         : FloatVectorData.instantiate(data, size, displayUnit.getScale(), storageType),
232                 displayUnit);
233     }
234 
235     /**
236      * Construct a FloatAngularVelocityVector from a (sparse) map of index values to Number objects or a (sparse) map of index
237      * values to of FloatAngularVelocity objects. Using index values is particularly useful for sparse vectors. The size
238      * parameter indicates the size of the vector, since the largest index does not have to be part of the map. Note that the
239      * displayUnit has a different meaning depending on whether the map contains Number objects (e.g., Float objects) or
240      * FloatAngularVelocity objects. In case the map contains Number objects, the displayUnit indicates the unit in which the
241      * values in the map are expressed, as well as the unit in which they will be printed. In case the map contains
242      * FloatAngularVelocity objects, each FloatAngularVelocity has its own unit, and the displayUnit is just used for printing.
243      * The values but will always be internally stored as SI values or base values, and expressed using the display unit or base
244      * unit when printing. Assume the storage type is SPARSE since we offer the data as a Map.
245      * @param data Map&lt;Integer, Float&gt; or Map&lt;Integer, FloatAngularVelocity&gt;; the data for the vector
246      * @param size int; the size off the vector, i.e., the highest index
247      * @param displayUnit AngularVelocityUnit; the display unit of the vector data, and the unit of the data points when the
248      *            data is expressed as List&lt;Float&gt; or List&lt;Number&gt; in general
249      */
250     public FloatAngularVelocityVector(final Map<Integer, ? extends Number> data, final int size,
251             final AngularVelocityUnit displayUnit)
252     {
253         this(data, size, displayUnit, StorageType.SPARSE);
254     }
255 
256     /**
257      * Construct a FloatAngularVelocityVector from a (sparse) map of index values to Number objects or a (sparse) map of index
258      * values to of FloatAngularVelocity objects. Using index values is particularly useful for sparse vectors. The size
259      * parameter indicates the size of the vector, since the largest index does not have to be part of the map. When data
260      * contains numbers such as Float, assume that they are expressed using SI units. When the data consists of
261      * FloatAngularVelocity objects, they each have their own unit, but will be printed using SI units or base units. The values
262      * but will always be internally stored as SI values or base values, and expressed using the display unit or base unit when
263      * printing.
264      * @param data Map&lt;Integer, Float&gt; or Map&lt;Integer, FloatAngularVelocity&gt;; the data for the vector
265      * @param size int; the size off the vector, i.e., the highest index
266      * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector
267      */
268     public FloatAngularVelocityVector(final Map<Integer, ? extends Number> data, final int size, final StorageType storageType)
269     {
270         this(data, size, AngularVelocityUnit.SI, storageType);
271     }
272 
273     /**
274      * Construct a FloatAngularVelocityVector from a (sparse) map of index values to Number objects or a (sparse) map of index
275      * values to of FloatAngularVelocity objects. Using index values is particularly useful for sparse vectors. The size
276      * parameter indicates the size of the vector, since the largest index does not have to be part of the map. When data
277      * contains numbers such as Float, assume that they are expressed using SI units. When the data consists of
278      * FloatAngularVelocity objects, they each have their own unit, but will be printed using SI units or base units. The values
279      * but will always be internally stored as SI values or base values, and expressed using the display unit or base unit when
280      * printing. Assume the storage type is SPARSE since we offer the data as a Map.
281      * @param data Map&lt;Integer, Float&gt; or Map&lt;Integer, FloatAngularVelocity&gt;; the data for the vector
282      * @param size int; the size off the vector, i.e., the highest index
283      */
284     public FloatAngularVelocityVector(final Map<Integer, ? extends Number> data, final int size)
285     {
286         this(data, size, StorageType.SPARSE);
287     }
288 
289     /* ****************************** Other methods ****************************** */
290 
291     /** {@inheritDoc} */
292     @Override
293     public Class<FloatAngularVelocity> getScalarClass()
294     {
295         return FloatAngularVelocity.class;
296     }
297 
298     /** {@inheritDoc} */
299     @Override
300     public FloatAngularVelocityVector instantiateVector(final FloatVectorData fvd, final AngularVelocityUnit displayUnit)
301     {
302         return new FloatAngularVelocityVector(fvd, displayUnit);
303     }
304 
305     /** {@inheritDoc} */
306     @Override
307     public FloatAngularVelocity instantiateScalarSI(final float valueSI, final AngularVelocityUnit displayUnit)
308     {
309         FloatAngularVelocity result = FloatAngularVelocity.instantiateSI(valueSI);
310         result.setDisplayUnit(displayUnit);
311         return result;
312     }
313 
314 }