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