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