View Javadoc
1   package org.djunits.value.vdouble.matrix;
2   
3   import java.util.Collection;
4   
5   import org.djunits.unit.EquivalentDoseUnit;
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.EquivalentDose;
11  import org.djunits.value.vdouble.vector.EquivalentDoseVector;
12  import org.djunits.value.vdouble.vector.data.DoubleVectorData;
13  
14  import jakarta.annotation.Generated;
15  
16  /**
17   * Immutable Double EquivalentDoseMatrix, a matrix of values with a EquivalentDoseUnit.
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 EquivalentDoseMatrix
27          extends DoubleMatrixRel<EquivalentDoseUnit, EquivalentDose, EquivalentDoseVector, EquivalentDoseMatrix>
28  
29  {
30      /** */
31      private static final long serialVersionUID = 20151109L;
32  
33      /**
34       * Construct a EquivalentDoseMatrix from an internal data object.
35       * @param data DoubleMatrixData; the internal data object for the matrix
36       * @param displayUnit EquivalentDoseUnit; the display unit of the matrix data
37       */
38      public EquivalentDoseMatrix(final DoubleMatrixData data, final EquivalentDoseUnit displayUnit)
39      {
40          super(data, displayUnit);
41      }
42  
43      /* CONSTRUCTORS WITH double[][] */
44  
45      /**
46       * Construct a EquivalentDoseMatrix from a double[][] object. The double values are expressed in the displayUnit, and will
47       * be printed using the displayUnit.
48       * @param data double[][]; the data for the matrix, expressed in the displayUnit
49       * @param displayUnit EquivalentDoseUnit; 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 EquivalentDoseMatrix(final double[][] data, final EquivalentDoseUnit displayUnit, final StorageType storageType)
53      {
54          this(DoubleMatrixData.instantiate(data, displayUnit.getScale(), storageType), displayUnit);
55      }
56  
57      /**
58       * Construct a EquivalentDoseMatrix from a double[][] object. The double values are expressed in the displayUnit. Assume
59       * that the StorageType is DENSE since we offer the data as an array of an array.
60       * @param data double[][]; the data for the matrix
61       * @param displayUnit EquivalentDoseUnit; the unit of the values in the data array, and display unit when printing
62       */
63      public EquivalentDoseMatrix(final double[][] data, final EquivalentDoseUnit displayUnit)
64      {
65          this(data, displayUnit, StorageType.DENSE);
66      }
67  
68      /**
69       * Construct a EquivalentDoseMatrix from a double[][] object with SI-unit values.
70       * @param data double[][]; the data for the matrix, in SI units
71       * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix
72       */
73      public EquivalentDoseMatrix(final double[][] data, final StorageType storageType)
74      {
75          this(data, EquivalentDoseUnit.SI, storageType);
76      }
77  
78      /**
79       * Construct a EquivalentDoseMatrix from a double[][] object with SI-unit values. Assume that the StorageType is DENSE since
80       * we offer the data as an array of an array.
81       * @param data double[][]; the data for the matrix, in SI units
82       */
83      public EquivalentDoseMatrix(final double[][] data)
84      {
85          this(data, StorageType.DENSE);
86      }
87  
88      /* CONSTRUCTORS WITH EquivalentDose[][] */
89  
90      /**
91       * Construct a EquivalentDoseMatrix from an array of an array of EquivalentDose objects. The EquivalentDose values are each
92       * expressed in their own unit, but will be internally stored as SI values, all expressed in the displayUnit when printing.
93       * @param data EquivalentDose[][]; the data for the matrix
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 Matrix
96       */
97      public EquivalentDoseMatrix(final EquivalentDose[][] data, final EquivalentDoseUnit displayUnit,
98              final StorageType storageType)
99      {
100         this(DoubleMatrixData.instantiate(data, storageType), displayUnit);
101     }
102 
103     /**
104      * Construct a EquivalentDoseMatrix from an array of an array of EquivalentDose objects. The EquivalentDose values are each
105      * expressed in their own unit, but will be internally stored as SI values, all expressed in the displayUnit when printing.
106      * Assume that the StorageType is DENSE since we offer the data as an array of an array.
107      * @param data EquivalentDose[][]; the data for the matrix
108      * @param displayUnit EquivalentDoseUnit; the display unit of the values when printing
109      */
110     public EquivalentDoseMatrix(final EquivalentDose[][] data, final EquivalentDoseUnit displayUnit)
111     {
112         this(data, displayUnit, StorageType.DENSE);
113     }
114 
115     /**
116      * Construct a EquivalentDoseMatrix from an array of an array of EquivalentDose objects. The EquivalentDose values are each
117      * 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 of an array.
119      * @param data EquivalentDose[][]; the data for the matrix
120      * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix
121      */
122     public EquivalentDoseMatrix(final EquivalentDose[][] data, final StorageType storageType)
123     {
124         this(data, EquivalentDoseUnit.SI, storageType);
125     }
126 
127     /**
128      * Construct a EquivalentDoseMatrix from an array of an array of EquivalentDose objects. The EquivalentDose values are each
129      * 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 of an array.
131      * @param data EquivalentDose[][]; the data for the matrix
132      */
133     public EquivalentDoseMatrix(final EquivalentDose[][] data)
134     {
135         this(data, StorageType.DENSE);
136     }
137 
138     /* CONSTRUCTORS WITH Collection<DoubleSparseValue> */
139 
140     /**
141      * Construct a EquivalentDoseMatrix from a (sparse) collection of DoubleSparseValue objects. The displayUnit indicates the
142      * unit in which the values in the collection are expressed, as well as the unit in which they will be printed.
143      * @param data Collection&lt;DoubleSparseValue&gt;; the data for the matrix
144      * @param displayUnit EquivalentDoseUnit; the display unit of the matrix data, and the unit of the data points
145      * @param rows int; the number of rows of the matrix
146      * @param cols int; the number of columns of the matrix
147      * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix
148      */
149     public EquivalentDoseMatrix(final Collection<DoubleSparseValue<EquivalentDoseUnit, EquivalentDose>> data,
150             final EquivalentDoseUnit displayUnit, final int rows, final int cols, final StorageType storageType)
151     {
152         this(DoubleMatrixData.instantiate(data, rows, cols, storageType), displayUnit);
153     }
154 
155     /**
156      * Construct a EquivalentDoseMatrix from a (sparse) collection of DoubleSparseValue objects. The displayUnit indicates the
157      * unit in which the values in the collection are expressed, as well as the unit in which they will be printed. Assume the
158      * storage type is SPARSE, since we offer the data as a collection.
159      * @param data Collection&lt;DoubleSparseValue&gt;; the data for the matrix
160      * @param displayUnit EquivalentDoseUnit; the display unit of the matrix data, and the unit of the data points
161      * @param rows int; the number of rows of the matrix
162      * @param cols int; the number of columns of the matrix
163      */
164     public EquivalentDoseMatrix(final Collection<DoubleSparseValue<EquivalentDoseUnit, EquivalentDose>> data,
165             final EquivalentDoseUnit displayUnit, final int rows, final int cols)
166     {
167         this(data, displayUnit, rows, cols, StorageType.SPARSE);
168     }
169 
170     /**
171      * Construct a EquivalentDoseMatrix from a (sparse) collection of DoubleSparseValue objects. The displayUnit indicates the
172      * unit in which the values in the collection are expressed, as well as the unit in which they will be printed. Use the SI
173      * unit or base unit as the displayUnit.
174      * @param data Collection&lt;DoubleSparseValue&gt;; the data for the matrix
175      * @param rows int; the number of rows of the matrix
176      * @param cols int; the number of columns of the matrix
177      * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Matrix
178      */
179     public EquivalentDoseMatrix(final Collection<DoubleSparseValue<EquivalentDoseUnit, EquivalentDose>> data, final int rows,
180             final int cols, final StorageType storageType)
181     {
182         this(data, EquivalentDoseUnit.SI, rows, cols, storageType);
183     }
184 
185     /**
186      * Construct a EquivalentDoseMatrix from a (sparse) collection of DoubleSparseValue objects. The displayUnit indicates the
187      * unit in which the values in the collection are expressed, as well as the unit in which they will be printed. Use the SI
188      * unit or base unit as the displayUnit. Assume the storage type is SPARSE, since we offer the data as a collection.
189      * @param data Collection&lt;DoubleSparseValue&gt;; the data for the matrix
190      * @param rows int; the number of rows of the matrix
191      * @param cols int; the number of columns of the matrix
192      */
193     public EquivalentDoseMatrix(final Collection<DoubleSparseValue<EquivalentDoseUnit, EquivalentDose>> data, final int rows,
194             final int cols)
195     {
196         this(data, EquivalentDoseUnit.SI, rows, cols, StorageType.SPARSE);
197     }
198 
199     @Override
200     public Class<EquivalentDose> getScalarClass()
201     {
202         return EquivalentDose.class;
203     }
204 
205     @Override
206     public Class<EquivalentDoseVector> getVectorClass()
207     {
208         return EquivalentDoseVector.class;
209     }
210 
211     @Override
212     public EquivalentDoseMatrix instantiateMatrix(final DoubleMatrixData dmd, final EquivalentDoseUnit displayUnit)
213     {
214         return new EquivalentDoseMatrix(dmd, displayUnit);
215     }
216 
217     @Override
218     public EquivalentDoseVector instantiateVector(final DoubleVectorData dvd, final EquivalentDoseUnit displayUnit)
219     {
220         return new EquivalentDoseVector(dvd, displayUnit);
221     }
222 
223     @Override
224     public EquivalentDose instantiateScalarSI(final double valueSI, final EquivalentDoseUnit displayUnit)
225     {
226         EquivalentDose result = EquivalentDose.instantiateSI(valueSI);
227         result.setDisplayUnit(displayUnit);
228         return result;
229     }
230 
231 }