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