1 package org.djunits.value.vfloat.vector; 2 3 import java.util.List; 4 import java.util.Map; 5 6 import org.djunits.unit.AbsorbedDoseUnit; 7 import org.djunits.unit.scale.IdentityScale; 8 import org.djunits.value.storage.StorageType; 9 import org.djunits.value.vfloat.scalar.FloatAbsorbedDose; 10 import org.djunits.value.vfloat.vector.base.FloatVectorRel; 11 import org.djunits.value.vfloat.vector.data.FloatVectorData; 12 13 import jakarta.annotation.Generated; 14 15 /** 16 * Immutable Float FloatAbsorbedDoseVector, a vector of values with a AbsorbedDoseUnit. 17 * <p> 18 * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br> 19 * BSD-style license. See <a href="https://djunits.org/docs/license.html">DJUNITS License</a>. 20 * </p> 21 * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a> 22 * @author <a href="https://www.tudelft.nl/staff/p.knoppers/">Peter Knoppers</a> 23 */ 24 @Generated(value = "org.djunits.generator.GenerateDJUNIT", date = "2023-07-23T14:06:38.224104100Z") 25 public class FloatAbsorbedDoseVector extends FloatVectorRel<AbsorbedDoseUnit, FloatAbsorbedDose, FloatAbsorbedDoseVector> 26 27 { 28 /** */ 29 private static final long serialVersionUID = 20190905L; 30 31 /** 32 * Construct a FloatAbsorbedDoseVector from an internal data object. 33 * @param data FloatVectorData; the internal data object for the vector 34 * @param displayUnit AbsorbedDoseUnit; the display unit of the vector data 35 */ 36 public FloatAbsorbedDoseVector(final FloatVectorData data, final AbsorbedDoseUnit displayUnit) 37 { 38 super(data, displayUnit); 39 } 40 41 /* CONSTRUCTORS WITH float[] */ 42 43 /** 44 * Construct a FloatAbsorbedDoseVector from a float[] object. The Float values are expressed in the displayUnit, and will be 45 * printed using the displayUnit. 46 * @param data float[]; the data for the vector, expressed in the displayUnit 47 * @param displayUnit AbsorbedDoseUnit; the unit of the values in the data array, and display unit when printing 48 * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector 49 */ 50 public FloatAbsorbedDoseVector(final float[] data, final AbsorbedDoseUnit displayUnit, final StorageType storageType) 51 { 52 this(FloatVectorData.instantiate(data, displayUnit.getScale(), storageType), displayUnit); 53 } 54 55 /** 56 * Construct a FloatAbsorbedDoseVector from a float[] object. The Float values are expressed in the displayUnit. Assume that 57 * the StorageType is DENSE since we offer the data as an array. 58 * @param data float[]; the data for the vector 59 * @param displayUnit AbsorbedDoseUnit; the unit of the values in the data array, and display unit when printing 60 */ 61 public FloatAbsorbedDoseVector(final float[] data, final AbsorbedDoseUnit displayUnit) 62 { 63 this(data, displayUnit, StorageType.DENSE); 64 } 65 66 /** 67 * Construct a FloatAbsorbedDoseVector from a float[] object with SI-unit values. 68 * @param data float[]; the data for the vector, in SI units 69 * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector 70 */ 71 public FloatAbsorbedDoseVector(final float[] data, final StorageType storageType) 72 { 73 this(data, AbsorbedDoseUnit.SI, storageType); 74 } 75 76 /** 77 * Construct a FloatAbsorbedDoseVector from a float[] object with SI-unit values. Assume that the StorageType is DENSE since 78 * we offer the data as an array. 79 * @param data float[]; the data for the vector, in SI units 80 */ 81 public FloatAbsorbedDoseVector(final float[] data) 82 { 83 this(data, StorageType.DENSE); 84 } 85 86 /* CONSTRUCTORS WITH FloatAbsorbedDose[] */ 87 88 /** 89 * Construct a FloatAbsorbedDoseVector from an array of FloatAbsorbedDose objects. The FloatAbsorbedDose values are each 90 * expressed in their own unit, but will be internally stored as SI values, all expressed in the displayUnit when printing. 91 * @param data FloatAbsorbedDose[]; the data for the vector 92 * @param displayUnit AbsorbedDoseUnit; the display unit of the values when printing 93 * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector 94 */ 95 public FloatAbsorbedDoseVector(final FloatAbsorbedDose[] data, final AbsorbedDoseUnit displayUnit, 96 final StorageType storageType) 97 { 98 this(FloatVectorData.instantiate(data, storageType), displayUnit); 99 } 100 101 /** 102 * Construct a FloatAbsorbedDoseVector from an array of FloatAbsorbedDose objects. The FloatAbsorbedDose 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. 105 * @param data FloatAbsorbedDose[]; the data for the vector 106 * @param displayUnit AbsorbedDoseUnit; the display unit of the values when printing 107 */ 108 public FloatAbsorbedDoseVector(final FloatAbsorbedDose[] data, final AbsorbedDoseUnit displayUnit) 109 { 110 this(data, displayUnit, StorageType.DENSE); 111 } 112 113 /** 114 * Construct a FloatAbsorbedDoseVector from an array of FloatAbsorbedDose objects. The FloatAbsorbedDose 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. 117 * @param data FloatAbsorbedDose[]; the data for the vector 118 * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector 119 */ 120 public FloatAbsorbedDoseVector(final FloatAbsorbedDose[] data, final StorageType storageType) 121 { 122 this(data, AbsorbedDoseUnit.SI, storageType); 123 } 124 125 /** 126 * Construct a FloatAbsorbedDoseVector from an array of FloatAbsorbedDose objects. The FloatAbsorbedDose 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. 129 * @param data FloatAbsorbedDose[]; the data for the vector 130 */ 131 public FloatAbsorbedDoseVector(final FloatAbsorbedDose[] data) 132 { 133 this(data, StorageType.DENSE); 134 } 135 136 /* CONSTRUCTORS WITH List<Float> or List<AbsorbedDose> */ 137 138 /** 139 * Construct a FloatAbsorbedDoseVector from a list of Number objects or a list of FloatAbsorbedDose objects. Note that the 140 * displayUnit has a different meaning depending on whether the list contains Number objects (e.g., Float objects) or 141 * FloatAbsorbedDose objects. In case the list contains Number objects, the displayUnit indicates the unit in which the 142 * values in the list are expressed, as well as the unit in which they will be printed. In case the list contains 143 * FloatAbsorbedDose objects, each FloatAbsorbedDose has its own unit, and the displayUnit is just used for printing. The 144 * values but will always be internally stored as SI values or base values, and expressed using the display unit or base 145 * unit when printing. 146 * @param data List<Float> or List<AbsorbedDose>; the data for the vector 147 * @param displayUnit AbsorbedDoseUnit; the display unit of the vector data, and the unit of the data points when the data 148 * is expressed as List<Float> or List<Number> in general 149 * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector 150 */ 151 public FloatAbsorbedDoseVector(final List<? extends Number> data, final AbsorbedDoseUnit displayUnit, 152 final StorageType storageType) 153 { 154 this(data.size() == 0 ? FloatVectorData.instantiate(new float[] {}, IdentityScale.SCALE, storageType) 155 : data.get(0) instanceof FloatAbsorbedDose ? FloatVectorData.instantiate(data, IdentityScale.SCALE, storageType) 156 : FloatVectorData.instantiate(data, displayUnit.getScale(), storageType), 157 displayUnit); 158 } 159 160 /** 161 * Construct a FloatAbsorbedDoseVector from a list of Number objects or a list of FloatAbsorbedDose objects. Note that the 162 * displayUnit has a different meaning depending on whether the list contains Number objects (e.g., Float objects) or 163 * FloatAbsorbedDose objects. In case the list contains Number objects, the displayUnit indicates the unit in which the 164 * values in the list are expressed, as well as the unit in which they will be printed. In case the list contains 165 * FloatAbsorbedDose objects, each FloatAbsorbedDose has its own unit, and the displayUnit is just used for printing. The 166 * values but will always be internally stored as SI values or base values, and expressed using the display unit or base 167 * unit when printing. Assume the storage type is DENSE since we offer the data as a List. 168 * @param data List<Float> or List<AbsorbedDose>; the data for the vector 169 * @param displayUnit AbsorbedDoseUnit; the display unit of the vector data, and the unit of the data points when the data 170 * is expressed as List<Float> or List<Number> in general 171 */ 172 public FloatAbsorbedDoseVector(final List<? extends Number> data, final AbsorbedDoseUnit displayUnit) 173 { 174 this(data, displayUnit, StorageType.DENSE); 175 } 176 177 /** 178 * Construct a FloatAbsorbedDoseVector from a list of Number objects or a list of FloatAbsorbedDose objects. When data 179 * contains numbers such as Float, assume that they are expressed using SI units. When the data consists of 180 * FloatAbsorbedDose objects, they each have their own unit, but will be printed using SI units or base units. The values 181 * but will always be internally stored as SI values or base values, and expressed using the display unit or base unit when 182 * printing. 183 * @param data List<Float> or List<AbsorbedDose>; the data for the vector 184 * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector 185 */ 186 public FloatAbsorbedDoseVector(final List<? extends Number> data, final StorageType storageType) 187 { 188 this(data, AbsorbedDoseUnit.SI, storageType); 189 } 190 191 /** 192 * Construct a FloatAbsorbedDoseVector from a list of Number objects or a list of FloatAbsorbedDose objects. When data 193 * contains numbers such as Float, assume that they are expressed using SI units. When the data consists of 194 * FloatAbsorbedDose objects, they each have their own unit, but will be printed using SI units or base units. The values 195 * but will always be internally stored as SI values or base values, and expressed using the display unit or base unit when 196 * printing. Assume the storage type is DENSE since we offer the data as a List. 197 * @param data List<Float> or List<AbsorbedDose>; the data for the vector 198 */ 199 public FloatAbsorbedDoseVector(final List<? extends Number> data) 200 { 201 this(data, StorageType.DENSE); 202 } 203 204 /* CONSTRUCTORS WITH Map<Integer, Float> or Map<Integer, FloatAbsorbedDose> */ 205 206 /** 207 * Construct a FloatAbsorbedDoseVector from a (sparse) map of index values to Number objects or a (sparse) map of index 208 * values to of FloatAbsorbedDose objects. Using index values is particularly useful for sparse vectors. The size parameter 209 * indicates the size of the vector, since the largest index does not have to be part of the map. Note that the displayUnit 210 * has a different meaning depending on whether the map contains Number objects (e.g., Float objects) or FloatAbsorbedDose 211 * objects. In case the map contains Number objects, the displayUnit indicates the unit in which the values in the map are 212 * expressed, as well as the unit in which they will be printed. In case the map contains FloatAbsorbedDose objects, each 213 * FloatAbsorbedDose has its own unit, and the displayUnit is just used for printing. The values but will always be 214 * internally stored as SI values or base values, and expressed using the display unit or base unit when printing. 215 * @param data Map<Integer, Float> or Map<Integer, FloatAbsorbedDose>; the data for the vector 216 * @param size int; the size off the vector, i.e., the highest index 217 * @param displayUnit AbsorbedDoseUnit; the display unit of the vector data, and the unit of the data points when the data 218 * is expressed as List<Float> or List<Number> in general 219 * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector 220 */ 221 public FloatAbsorbedDoseVector(final Map<Integer, ? extends Number> data, final int size, 222 final AbsorbedDoseUnit displayUnit, final StorageType storageType) 223 { 224 this(data.size() == 0 ? FloatVectorData.instantiate(data, size, IdentityScale.SCALE, storageType) 225 : data.values().iterator().next() instanceof FloatAbsorbedDose 226 ? FloatVectorData.instantiate(data, size, IdentityScale.SCALE, storageType) 227 : FloatVectorData.instantiate(data, size, displayUnit.getScale(), storageType), 228 displayUnit); 229 } 230 231 /** 232 * Construct a FloatAbsorbedDoseVector from a (sparse) map of index values to Number objects or a (sparse) map of index 233 * values to of FloatAbsorbedDose objects. Using index values is particularly useful for sparse vectors. The size parameter 234 * indicates the size of the vector, since the largest index does not have to be part of the map. Note that the displayUnit 235 * has a different meaning depending on whether the map contains Number objects (e.g., Float objects) or FloatAbsorbedDose 236 * objects. In case the map contains Number objects, the displayUnit indicates the unit in which the values in the map are 237 * expressed, as well as the unit in which they will be printed. In case the map contains FloatAbsorbedDose objects, each 238 * FloatAbsorbedDose has its own unit, and the displayUnit is just used for printing. The values but will always be 239 * internally stored as SI values or base values, and expressed using the display unit or base unit when printing. Assume 240 * the storage type is SPARSE since we offer the data as a Map. 241 * @param data Map<Integer, Float> or Map<Integer, FloatAbsorbedDose>; the data for the vector 242 * @param size int; the size off the vector, i.e., the highest index 243 * @param displayUnit AbsorbedDoseUnit; the display unit of the vector data, and the unit of the data points when the data 244 * is expressed as List<Float> or List<Number> in general 245 */ 246 public FloatAbsorbedDoseVector(final Map<Integer, ? extends Number> data, final int size, 247 final AbsorbedDoseUnit displayUnit) 248 { 249 this(data, size, displayUnit, StorageType.SPARSE); 250 } 251 252 /** 253 * Construct a FloatAbsorbedDoseVector from a (sparse) map of index values to Number objects or a (sparse) map of index 254 * values to of FloatAbsorbedDose objects. Using index values is particularly useful for sparse vectors. The size parameter 255 * indicates the size of the vector, since the largest index does not have to be part of the map. When data contains numbers 256 * such as Float, assume that they are expressed using SI units. When the data consists of FloatAbsorbedDose objects, they 257 * each have their own unit, but will be printed using SI units or base units. The values but will always be internally 258 * stored as SI values or base values, and expressed using the display unit or base unit when printing. 259 * @param data Map<Integer, Float> or Map<Integer, FloatAbsorbedDose>; the data for the vector 260 * @param size int; the size off the vector, i.e., the highest index 261 * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector 262 */ 263 public FloatAbsorbedDoseVector(final Map<Integer, ? extends Number> data, final int size, final StorageType storageType) 264 { 265 this(data, size, AbsorbedDoseUnit.SI, storageType); 266 } 267 268 /** 269 * Construct a FloatAbsorbedDoseVector from a (sparse) map of index values to Number objects or a (sparse) map of index 270 * values to of FloatAbsorbedDose objects. Using index values is particularly useful for sparse vectors. The size parameter 271 * indicates the size of the vector, since the largest index does not have to be part of the map. When data contains numbers 272 * such as Float, assume that they are expressed using SI units. When the data consists of FloatAbsorbedDose objects, they 273 * each have their own unit, but will be printed using SI units or base units. The values but will always be internally 274 * stored as SI values or base values, and expressed using the display unit or base unit when printing. Assume the storage 275 * type is SPARSE since we offer the data as a Map. 276 * @param data Map<Integer, Float> or Map<Integer, FloatAbsorbedDose>; the data for the vector 277 * @param size int; the size off the vector, i.e., the highest index 278 */ 279 public FloatAbsorbedDoseVector(final Map<Integer, ? extends Number> data, final int size) 280 { 281 this(data, size, StorageType.SPARSE); 282 } 283 284 /* ****************************** Other methods ****************************** */ 285 286 @Override 287 public Class<FloatAbsorbedDose> getScalarClass() 288 { 289 return FloatAbsorbedDose.class; 290 } 291 292 @Override 293 public FloatAbsorbedDoseVector instantiateVector(final FloatVectorData fvd, final AbsorbedDoseUnit displayUnit) 294 { 295 return new FloatAbsorbedDoseVector(fvd, displayUnit); 296 } 297 298 @Override 299 public FloatAbsorbedDose instantiateScalarSI(final float valueSI, final AbsorbedDoseUnit displayUnit) 300 { 301 FloatAbsorbedDose result = FloatAbsorbedDose.instantiateSI(valueSI); 302 result.setDisplayUnit(displayUnit); 303 return result; 304 } 305 306 }