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