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     /** {@inheritDoc} */
205     @Override
206     public Class<FloatTemperature> getScalarClass()
207     {
208         return FloatTemperature.class;
209     }
210 
211     /** {@inheritDoc} */
212     @Override
213     public Class<FloatTemperatureVector> getVectorClass()
214     {
215         return FloatTemperatureVector.class;
216     }
217 
218     /** {@inheritDoc} */
219     @Override
220     public FloatTemperatureMatrix instantiateMatrix(final FloatMatrixData fmd, final TemperatureUnit displayUnit)
221     {
222         return new FloatTemperatureMatrix(fmd, displayUnit);
223     }
224 
225     /** {@inheritDoc} */
226     @Override
227     public FloatTemperatureVector instantiateVector(final FloatVectorData fvd, final TemperatureUnit displayUnit)
228     {
229         return new FloatTemperatureVector(fvd, displayUnit);
230     }
231 
232     /** {@inheritDoc} */
233     @Override
234     public FloatTemperature instantiateScalarSI(final float valueSI, final TemperatureUnit displayUnit)
235     {
236         FloatTemperature result = FloatTemperature.instantiateSI(valueSI);
237         result.setDisplayUnit(displayUnit);
238         return result;
239     }
240 
241     /** {@inheritDoc} */
242     @Override
243     public FloatAbsoluteTemperatureMatrix instantiateMatrixAbs(final FloatMatrixData fmd,
244             final AbsoluteTemperatureUnit displayUnit)
245     {
246         return new FloatAbsoluteTemperatureMatrix(fmd, displayUnit);
247     }
248 
249     /** {@inheritDoc} */
250     @Override
251     public FloatAbsoluteTemperatureVector instantiateVectorAbs(final FloatVectorData fvd,
252             final AbsoluteTemperatureUnit displayUnit)
253     {
254         return new FloatAbsoluteTemperatureVector(fvd, displayUnit);
255     }
256 
257     /** {@inheritDoc} */
258     @Override
259     public FloatAbsoluteTemperature instantiateScalarAbsSI(final float valueSI, final AbsoluteTemperatureUnit displayUnit)
260     {
261         FloatAbsoluteTemperature result = FloatAbsoluteTemperature.instantiateSI(valueSI);
262         result.setDisplayUnit(displayUnit);
263         return result;
264     }
265 
266 }