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