View Javadoc
1   package org.djunits.value.vfloat.matrix;
2   
3   import java.util.Collection;
4   
5   import org.djunits.unit.AbsoluteTemperatureUnit;
6   import org.djunits.unit.TemperatureUnit;
7   import org.djunits.value.storage.StorageType;
8   import org.djunits.value.vfloat.matrix.base.FloatMatrixRelWithAbs;
9   import org.djunits.value.vfloat.matrix.base.FloatSparseValue;
10  import org.djunits.value.vfloat.matrix.data.FloatMatrixData;
11  import org.djunits.value.vfloat.scalar.FloatAbsoluteTemperature;
12  import org.djunits.value.vfloat.scalar.FloatTemperature;
13  import org.djunits.value.vfloat.vector.FloatAbsoluteTemperatureVector;
14  import org.djunits.value.vfloat.vector.FloatTemperatureVector;
15  import org.djunits.value.vfloat.vector.data.FloatVectorData;
16  
17  import jakarta.annotation.Generated;
18  
19  /**
20   * Immutable FloatTemperature Matrix.
21   * <p>
22   * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
23   * BSD-style license. See <a href="https://djunits.org/docs/license.html">DJUNITS License</a>.
24   * </p>
25   * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
26   * @author <a href="https://www.tudelft.nl/staff/p.knoppers/">Peter Knoppers</a>
27   */
28  @Generated(value = "org.djunits.generator.GenerateDJUNIT", date = "2023-07-23T14:06:38.224104100Z")
29  public class FloatTemperatureMatrix extends
30          FloatMatrixRelWithAbs<AbsoluteTemperatureUnit, FloatAbsoluteTemperature, FloatAbsoluteTemperatureVector,
31                  FloatAbsoluteTemperatureMatrix, TemperatureUnit, FloatTemperature, FloatTemperatureVector,
32                  FloatTemperatureMatrix>
33  {
34      /** */
35      private static final long serialVersionUID = 20151006L;
36  
37      /**
38       * Construct a FloatTemperatureMatrix from an internal data object.
39       * @param data FloatMatrixData; the internal data object for the matrix
40       * @param displayUnit TemperatureUnit; the display unit of the matrix data
41       */
42      public FloatTemperatureMatrix(final FloatMatrixData data, final TemperatureUnit displayUnit)
43      {
44          super(data, displayUnit);
45      }
46  
47      /* CONSTRUCTORS WITH float[][] */
48  
49      /**
50       * Construct a FloatTemperatureMatrix from a float[][] object. The float values are expressed in the displayUnit, and will
51       * be printed using the displayUnit.
52       * @param data float[][]; the data for the matrix, expressed in the displayUnit
53       * @param displayUnit TemperatureUnit; the unit of the values in the data array, and display unit when printing
54       * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix
55       */
56      public FloatTemperatureMatrix(final float[][] data, final TemperatureUnit displayUnit, final StorageType storageType)
57      {
58          this(FloatMatrixData.instantiate(data, displayUnit.getScale(), storageType), displayUnit);
59      }
60  
61      /**
62       * Construct a FloatTemperatureMatrix from a float[][] object. The float values are expressed in the displayUnit. Assume
63       * that the StorageType is DENSE since we offer the data as an array of an array.
64       * @param data float[][]; the data for the matrix
65       * @param displayUnit TemperatureUnit; the unit of the values in the data array, and display unit when printing
66       */
67      public FloatTemperatureMatrix(final float[][] data, final TemperatureUnit displayUnit)
68      {
69          this(data, displayUnit, StorageType.DENSE);
70      }
71  
72      /**
73       * Construct a FloatTemperatureMatrix from a float[][] object with SI-unit values.
74       * @param data float[][]; the data for the matrix, in SI units
75       * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix
76       */
77      public FloatTemperatureMatrix(final float[][] data, final StorageType storageType)
78      {
79          this(data, TemperatureUnit.SI, storageType);
80      }
81  
82      /**
83       * Construct a FloatTemperatureMatrix from a float[][] object with SI-unit values. Assume that the StorageType is DENSE
84       * since we offer the data as an array of an array.
85       * @param data float[][]; the data for the matrix, in SI units
86       */
87      public FloatTemperatureMatrix(final float[][] data)
88      {
89          this(data, StorageType.DENSE);
90      }
91  
92      /* CONSTRUCTORS WITH FloatTemperature[][] */
93  
94      /**
95       * Construct a FloatTemperatureMatrix from an array of an array of FloatTemperature objects. The FloatTemperature values are
96       * each expressed in their own unit, but will be internally stored as SI values, all expressed in the displayUnit when
97       * printing.
98       * @param data FloatTemperature[][]; the data for the matrix
99       * @param displayUnit TemperatureUnit; the display unit of the values when printing
100      * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix
101      */
102     public FloatTemperatureMatrix(final FloatTemperature[][] data, final TemperatureUnit displayUnit,
103             final StorageType storageType)
104     {
105         this(FloatMatrixData.instantiate(data, storageType), displayUnit);
106     }
107 
108     /**
109      * Construct a FloatTemperatureMatrix from an array of an array of FloatTemperature objects. The FloatTemperature values are
110      * each expressed in their own unit, but will be internally stored as SI values, all expressed in the displayUnit when
111      * printing. Assume that the StorageType is DENSE since we offer the data as an array of an array.
112      * @param data FloatTemperature[][]; the data for the matrix
113      * @param displayUnit TemperatureUnit; the display unit of the values when printing
114      */
115     public FloatTemperatureMatrix(final FloatTemperature[][] data, final TemperatureUnit displayUnit)
116     {
117         this(data, displayUnit, StorageType.DENSE);
118     }
119 
120     /**
121      * Construct a FloatTemperatureMatrix from an array of an array of FloatTemperature objects. The FloatTemperature values are
122      * each expressed in their own unit, but will be internally stored as SI values, and expressed using SI units when printing.
123      * since we offer the data as an array of an array.
124      * @param data FloatTemperature[][]; the data for the matrix
125      * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix
126      */
127     public FloatTemperatureMatrix(final FloatTemperature[][] data, final StorageType storageType)
128     {
129         this(data, TemperatureUnit.SI, storageType);
130     }
131 
132     /**
133      * Construct a FloatTemperatureMatrix from an array of an array of FloatTemperature objects. The FloatTemperature values are
134      * each expressed in their own unit, but will be internally stored as SI values, and expressed using SI units when printing.
135      * Assume that the StorageType is DENSE since we offer the data as an array of an array.
136      * @param data FloatTemperature[][]; the data for the matrix
137      */
138     public FloatTemperatureMatrix(final FloatTemperature[][] data)
139     {
140         this(data, StorageType.DENSE);
141     }
142 
143     /* CONSTRUCTORS WITH Collection<FloatSparseValue> */
144 
145     /**
146      * Construct a FloatTemperatureMatrix from a (sparse) collection of FloatSparseValue objects. The displayUnit indicates the
147      * unit in which the values in the collection are expressed, as well as the unit in which they will be printed.
148      * @param data Collection&lt;FloatSparseValue&gt;; the data for the matrix
149      * @param displayUnit TemperatureUnit; the display unit of the matrix data, and the unit of the data points
150      * @param rows int; the number of rows of the matrix
151      * @param cols int; the number of columns of the matrix
152      * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix
153      */
154     public FloatTemperatureMatrix(final Collection<FloatSparseValue<TemperatureUnit, FloatTemperature>> data,
155             final TemperatureUnit displayUnit, final int rows, final int cols, final StorageType storageType)
156     {
157         this(FloatMatrixData.instantiate(data, rows, cols, storageType), displayUnit);
158     }
159 
160     /**
161      * Construct a FloatTemperatureMatrix from a (sparse) collection of FloatSparseValue objects. The displayUnit indicates the
162      * unit in which the values in the collection are expressed, as well as the unit in which they will be printed. Assume the
163      * storage type is SPARSE, since we offer the data as a collection.
164      * @param data Collection&lt;FloatSparseValue&gt;; the data for the matrix
165      * @param displayUnit TemperatureUnit; the display unit of the matrix data, and the unit of the data points
166      * @param rows int; the number of rows of the matrix
167      * @param cols int; the number of columns of the matrix
168      */
169     public FloatTemperatureMatrix(final Collection<FloatSparseValue<TemperatureUnit, FloatTemperature>> data,
170             final TemperatureUnit displayUnit, final int rows, final int cols)
171     {
172         this(data, displayUnit, rows, cols, StorageType.SPARSE);
173     }
174 
175     /**
176      * Construct a FloatTemperatureMatrix from a (sparse) collection of FloatSparseValue objects. The displayUnit indicates the
177      * unit in which the values in the collection are expressed, as well as the unit in which they will be printed. Use the SI
178      * unit or base unit as the displayUnit.
179      * @param data Collection&lt;FloatSparseValue&gt;; the data for the matrix
180      * @param rows int; the number of rows of the matrix
181      * @param cols int; the number of columns of the matrix
182      * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix
183      */
184     public FloatTemperatureMatrix(final Collection<FloatSparseValue<TemperatureUnit, FloatTemperature>> data, final int rows,
185             final int cols, final StorageType storageType)
186     {
187         this(data, TemperatureUnit.SI, rows, cols, storageType);
188     }
189 
190     /**
191      * Construct a FloatTemperatureMatrix from a (sparse) collection of FloatSparseValue objects. The displayUnit indicates the
192      * unit in which the values in the collection are expressed, as well as the unit in which they will be printed. Use the SI
193      * unit or base unit as the displayUnit. Assume the storage type is SPARSE, since we offer the data as a collection.
194      * @param data Collection&lt;FloatSparseValue&gt;; the data for the matrix
195      * @param rows int; the number of rows of the matrix
196      * @param cols int; the number of columns of the matrix
197      */
198     public FloatTemperatureMatrix(final Collection<FloatSparseValue<TemperatureUnit, FloatTemperature>> data, final int rows,
199             final int cols)
200     {
201         this(data, TemperatureUnit.SI, rows, cols, StorageType.SPARSE);
202     }
203 
204     @Override
205     public Class<FloatTemperature> getScalarClass()
206     {
207         return FloatTemperature.class;
208     }
209 
210     @Override
211     public Class<FloatTemperatureVector> getVectorClass()
212     {
213         return FloatTemperatureVector.class;
214     }
215 
216     @Override
217     public FloatTemperatureMatrix instantiateMatrix(final FloatMatrixData fmd, final TemperatureUnit displayUnit)
218     {
219         return new FloatTemperatureMatrix(fmd, displayUnit);
220     }
221 
222     @Override
223     public FloatTemperatureVector instantiateVector(final FloatVectorData fvd, final TemperatureUnit displayUnit)
224     {
225         return new FloatTemperatureVector(fvd, displayUnit);
226     }
227 
228     @Override
229     public FloatTemperature instantiateScalarSI(final float valueSI, final TemperatureUnit displayUnit)
230     {
231         FloatTemperature result = FloatTemperature.instantiateSI(valueSI);
232         result.setDisplayUnit(displayUnit);
233         return result;
234     }
235 
236     @Override
237     public FloatAbsoluteTemperatureMatrix instantiateMatrixAbs(final FloatMatrixData fmd,
238             final AbsoluteTemperatureUnit displayUnit)
239     {
240         return new FloatAbsoluteTemperatureMatrix(fmd, displayUnit);
241     }
242 
243     @Override
244     public FloatAbsoluteTemperatureVector instantiateVectorAbs(final FloatVectorData fvd,
245             final AbsoluteTemperatureUnit displayUnit)
246     {
247         return new FloatAbsoluteTemperatureVector(fvd, displayUnit);
248     }
249 
250     @Override
251     public FloatAbsoluteTemperature instantiateScalarAbsSI(final float valueSI, final AbsoluteTemperatureUnit displayUnit)
252     {
253         FloatAbsoluteTemperature result = FloatAbsoluteTemperature.instantiateSI(valueSI);
254         result.setDisplayUnit(displayUnit);
255         return result;
256     }
257 
258 }