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