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