View Javadoc
1   package org.djunits.value.vdouble.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.vdouble.matrix.base.DoubleMatrixAbs;
9   import org.djunits.value.vdouble.matrix.base.DoubleSparseValue;
10  import org.djunits.value.vdouble.matrix.data.DoubleMatrixData;
11  import org.djunits.value.vdouble.scalar.AbsoluteTemperature;
12  import org.djunits.value.vdouble.scalar.Temperature;
13  import org.djunits.value.vdouble.vector.AbsoluteTemperatureVector;
14  import org.djunits.value.vdouble.vector.TemperatureVector;
15  import org.djunits.value.vdouble.vector.data.DoubleVectorData;
16  
17  import jakarta.annotation.Generated;
18  
19  /**
20   * Immutable AbsoluteTemperature 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 AbsoluteTemperatureMatrix
30          extends DoubleMatrixAbs<AbsoluteTemperatureUnit, AbsoluteTemperature, AbsoluteTemperatureVector,
31                  AbsoluteTemperatureMatrix, TemperatureUnit, Temperature, TemperatureVector, TemperatureMatrix>
32  {
33      /** */
34      private static final long serialVersionUID = 20151006L;
35  
36      /**
37       * Construct a AbsoluteTemperatureMatrix from an internal data object.
38       * @param data DoubleMatrixData; the internal data object for the matrix
39       * @param displayUnit AbsoluteTemperatureUnit; the display unit of the matrix data
40       */
41      public AbsoluteTemperatureMatrix(final DoubleMatrixData data, final AbsoluteTemperatureUnit displayUnit)
42      {
43          super(data, displayUnit);
44      }
45  
46      /* CONSTRUCTORS WITH double[][] */
47  
48      /**
49       * Construct a AbsoluteTemperatureMatrix from a double[][] object. The double values are expressed in the displayUnit, and
50       * will be printed using the displayUnit.
51       * @param data double[][]; the data for the matrix, expressed in the displayUnit
52       * @param displayUnit AbsoluteTemperatureUnit; the unit of the values in the data array, and display unit when printing
53       * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix
54       */
55      public AbsoluteTemperatureMatrix(final double[][] data, final AbsoluteTemperatureUnit displayUnit,
56              final StorageType storageType)
57      {
58          this(DoubleMatrixData.instantiate(data, displayUnit.getScale(), storageType), displayUnit);
59      }
60  
61      /**
62       * Construct a AbsoluteTemperatureMatrix from a double[][] object. The double values are expressed in the displayUnit.
63       * Assume that the StorageType is DENSE since we offer the data as an array of an array.
64       * @param data double[][]; the data for the matrix
65       * @param displayUnit AbsoluteTemperatureUnit; the unit of the values in the data array, and display unit when printing
66       */
67      public AbsoluteTemperatureMatrix(final double[][] data, final AbsoluteTemperatureUnit displayUnit)
68      {
69          this(data, displayUnit, StorageType.DENSE);
70      }
71  
72      /**
73       * Construct a AbsoluteTemperatureMatrix from a double[][] object with SI-unit values.
74       * @param data double[][]; 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 AbsoluteTemperatureMatrix(final double[][] data, final StorageType storageType)
78      {
79          this(data, AbsoluteTemperatureUnit.BASE.getStandardUnit(), storageType);
80      }
81  
82      /**
83       * Construct a AbsoluteTemperatureMatrix from a double[][] 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 double[][]; the data for the matrix, in SI units
86       */
87      public AbsoluteTemperatureMatrix(final double[][] data)
88      {
89          this(data, StorageType.DENSE);
90      }
91  
92      /* CONSTRUCTORS WITH AbsoluteTemperature[][] */
93  
94      /**
95       * Construct a AbsoluteTemperatureMatrix from an array of an array of AbsoluteTemperature objects. The AbsoluteTemperature
96       * values are each expressed in their own unit, but will be internally stored as SI values, all expressed in the displayUnit
97       * when printing.
98       * @param data AbsoluteTemperature[][]; the data for the matrix
99       * @param displayUnit AbsoluteTemperatureUnit; 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 AbsoluteTemperatureMatrix(final AbsoluteTemperature[][] data, final AbsoluteTemperatureUnit displayUnit,
103             final StorageType storageType)
104     {
105         this(DoubleMatrixData.instantiate(data, storageType), displayUnit);
106     }
107 
108     /**
109      * Construct a AbsoluteTemperatureMatrix from an array of an array of AbsoluteTemperature objects. The AbsoluteTemperature
110      * values are each expressed in their own unit, but will be internally stored as SI values, all expressed in the displayUnit
111      * when printing. Assume that the StorageType is DENSE since we offer the data as an array of an array.
112      * @param data AbsoluteTemperature[][]; the data for the matrix
113      * @param displayUnit AbsoluteTemperatureUnit; the display unit of the values when printing
114      */
115     public AbsoluteTemperatureMatrix(final AbsoluteTemperature[][] data, final AbsoluteTemperatureUnit displayUnit)
116     {
117         this(data, displayUnit, StorageType.DENSE);
118     }
119 
120     /**
121      * Construct a AbsoluteTemperatureMatrix from an array of an array of AbsoluteTemperature objects. The AbsoluteTemperature
122      * values are each expressed in their own unit, but will be internally stored as SI values, and expressed using SI units
123      * when printing. since we offer the data as an array of an array.
124      * @param data AbsoluteTemperature[][]; the data for the matrix
125      * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix
126      */
127     public AbsoluteTemperatureMatrix(final AbsoluteTemperature[][] data, final StorageType storageType)
128     {
129         this(data, AbsoluteTemperatureUnit.BASE.getStandardUnit(), storageType);
130     }
131 
132     /**
133      * Construct a AbsoluteTemperatureMatrix from an array of an array of AbsoluteTemperature objects. The AbsoluteTemperature
134      * values are each expressed in their own unit, but will be internally stored as SI values, and expressed using SI units
135      * when printing. Assume that the StorageType is DENSE since we offer the data as an array of an array.
136      * @param data AbsoluteTemperature[][]; the data for the matrix
137      */
138     public AbsoluteTemperatureMatrix(final AbsoluteTemperature[][] data)
139     {
140         this(data, StorageType.DENSE);
141     }
142 
143     /* CONSTRUCTORS WITH Collection<DoubleSparseValue> */
144 
145     /**
146      * Construct a AbsoluteTemperatureMatrix from a (sparse) collection of DoubleSparseValue objects. The displayUnit indicates
147      * the 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;DoubleSparseValue&gt;; the data for the matrix
149      * @param displayUnit AbsoluteTemperatureUnit; 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 AbsoluteTemperatureMatrix(final Collection<DoubleSparseValue<AbsoluteTemperatureUnit, AbsoluteTemperature>> data,
155             final AbsoluteTemperatureUnit displayUnit, final int rows, final int cols, final StorageType storageType)
156     {
157         this(DoubleMatrixData.instantiate(data, rows, cols, storageType), displayUnit);
158     }
159 
160     /**
161      * Construct a AbsoluteTemperatureMatrix from a (sparse) collection of DoubleSparseValue objects. The displayUnit indicates
162      * the unit in which the values in the collection are expressed, as well as the unit in which they will be printed. Assume
163      * the storage type is SPARSE, since we offer the data as a collection.
164      * @param data Collection&lt;DoubleSparseValue&gt;; the data for the matrix
165      * @param displayUnit AbsoluteTemperatureUnit; 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 AbsoluteTemperatureMatrix(final Collection<DoubleSparseValue<AbsoluteTemperatureUnit, AbsoluteTemperature>> data,
170             final AbsoluteTemperatureUnit displayUnit, final int rows, final int cols)
171     {
172         this(data, displayUnit, rows, cols, StorageType.SPARSE);
173     }
174 
175     /**
176      * Construct a AbsoluteTemperatureMatrix from a (sparse) collection of DoubleSparseValue objects. The displayUnit indicates
177      * the unit in which the values in the collection are expressed, as well as the unit in which they will be printed. Use the
178      * SI unit or base unit as the displayUnit.
179      * @param data Collection&lt;DoubleSparseValue&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 AbsoluteTemperatureMatrix(final Collection<DoubleSparseValue<AbsoluteTemperatureUnit, AbsoluteTemperature>> data,
185             final int rows, final int cols, final StorageType storageType)
186     {
187         this(data, AbsoluteTemperatureUnit.BASE.getStandardUnit(), rows, cols, storageType);
188     }
189 
190     /**
191      * Construct a AbsoluteTemperatureMatrix from a (sparse) collection of DoubleSparseValue objects. The displayUnit indicates
192      * the unit in which the values in the collection are expressed, as well as the unit in which they will be printed. Use the
193      * SI 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;DoubleSparseValue&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 AbsoluteTemperatureMatrix(final Collection<DoubleSparseValue<AbsoluteTemperatureUnit, AbsoluteTemperature>> data,
199             final int rows, final int cols)
200     {
201         this(data, AbsoluteTemperatureUnit.BASE.getStandardUnit(), rows, cols, StorageType.SPARSE);
202     }
203 
204     @Override
205     public Class<AbsoluteTemperature> getScalarClass()
206     {
207         return AbsoluteTemperature.class;
208     }
209 
210     @Override
211     public Class<AbsoluteTemperatureVector> getVectorClass()
212     {
213         return AbsoluteTemperatureVector.class;
214     }
215 
216     @Override
217     public AbsoluteTemperatureMatrix instantiateMatrix(final DoubleMatrixData dmd, final AbsoluteTemperatureUnit displayUnit)
218     {
219         return new AbsoluteTemperatureMatrix(dmd, displayUnit);
220     }
221 
222     @Override
223     public AbsoluteTemperatureVector instantiateVector(final DoubleVectorData dvd, final AbsoluteTemperatureUnit displayUnit)
224     {
225         return new AbsoluteTemperatureVector(dvd, displayUnit);
226     }
227 
228     @Override
229     public AbsoluteTemperature instantiateScalarSI(final double valueSI, final AbsoluteTemperatureUnit displayUnit)
230     {
231         AbsoluteTemperature result = AbsoluteTemperature.instantiateSI(valueSI);
232         result.setDisplayUnit(displayUnit);
233         return result;
234     }
235 
236     @Override
237     public TemperatureMatrix instantiateMatrixRel(final DoubleMatrixData dmd, final TemperatureUnit displayUnit)
238     {
239         return new TemperatureMatrix(dmd, displayUnit);
240     }
241 
242     @Override
243     public TemperatureVector instantiateVectorRel(final DoubleVectorData dvd, final TemperatureUnit displayUnit)
244     {
245         return new TemperatureVector(dvd, displayUnit);
246     }
247 
248     @Override
249     public Temperature instantiateScalarRelSI(final double valueSI, final TemperatureUnit displayUnit)
250     {
251         Temperature result = Temperature.instantiateSI(valueSI);
252         result.setDisplayUnit(displayUnit);
253         return result;
254     }
255 
256 }