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