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