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