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