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