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