1 package org.djunits.value.vdouble.vector; 2 3 import java.util.List; 4 import java.util.Map; 5 6 import org.djunits.unit.CatalyticActivityUnit; 7 import org.djunits.unit.scale.IdentityScale; 8 import org.djunits.value.storage.StorageType; 9 import org.djunits.value.vdouble.scalar.CatalyticActivity; 10 import org.djunits.value.vdouble.vector.base.DoubleVectorRel; 11 import org.djunits.value.vdouble.vector.data.DoubleVectorData; 12 13 import jakarta.annotation.Generated; 14 15 /** 16 * Double CatalyticActivityVector, a vector of values with a CatalyticActivityUnit. 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 CatalyticActivityVector extends DoubleVectorRel<CatalyticActivityUnit, CatalyticActivity, CatalyticActivityVector> 26 27 { 28 /** */ 29 private static final long serialVersionUID = 20190905L; 30 31 /** 32 * Construct an CatalyticActivityVector from an internal data object. 33 * @param data DoubleVectorData; the internal data object for the vector 34 * @param displayUnit CatalyticActivityUnit; the display unit of the vector data 35 */ 36 public CatalyticActivityVector(final DoubleVectorData data, final CatalyticActivityUnit displayUnit) 37 { 38 super(data, displayUnit); 39 } 40 41 /* CONSTRUCTORS WITH double[] */ 42 43 /** 44 * Construct an CatalyticActivityVector from a double[] object. The double values are expressed in the displayUnit, and will 45 * be printed using the displayUnit. 46 * @param data double[]; the data for the vector, expressed in the displayUnit 47 * @param displayUnit CatalyticActivityUnit; 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 CatalyticActivityVector(final double[] data, final CatalyticActivityUnit displayUnit, final StorageType storageType) 51 { 52 this(DoubleVectorData.instantiate(data, displayUnit.getScale(), storageType), displayUnit); 53 } 54 55 /** 56 * Construct an CatalyticActivityVector from a double[] object. The double values are expressed in the displayUnit. Assume 57 * that the StorageType is DENSE since we offer the data as an array. 58 * @param data double[]; the data for the vector 59 * @param displayUnit CatalyticActivityUnit; the unit of the values in the data array, and display unit when printing 60 */ 61 public CatalyticActivityVector(final double[] data, final CatalyticActivityUnit displayUnit) 62 { 63 this(data, displayUnit, StorageType.DENSE); 64 } 65 66 /** 67 * Construct an CatalyticActivityVector from a double[] object with SI-unit values. 68 * @param data double[]; 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 CatalyticActivityVector(final double[] data, final StorageType storageType) 72 { 73 this(data, CatalyticActivityUnit.SI, storageType); 74 } 75 76 /** 77 * Construct an CatalyticActivityVector from a double[] object with SI-unit values. Assume that the StorageType is DENSE 78 * since we offer the data as an array. 79 * @param data double[]; the data for the vector, in SI units 80 */ 81 public CatalyticActivityVector(final double[] data) 82 { 83 this(data, StorageType.DENSE); 84 } 85 86 /* CONSTRUCTORS WITH CatalyticActivity[] */ 87 88 /** 89 * Construct an CatalyticActivityVector from an array of CatalyticActivity objects. The CatalyticActivity 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 CatalyticActivity[]; the data for the vector 92 * @param displayUnit CatalyticActivityUnit; 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 CatalyticActivityVector(final CatalyticActivity[] data, final CatalyticActivityUnit displayUnit, 96 final StorageType storageType) 97 { 98 this(DoubleVectorData.instantiate(data, storageType), displayUnit); 99 } 100 101 /** 102 * Construct an CatalyticActivityVector from an array of CatalyticActivity objects. The CatalyticActivity 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 CatalyticActivity[]; the data for the vector 106 * @param displayUnit CatalyticActivityUnit; the display unit of the values when printing 107 */ 108 public CatalyticActivityVector(final CatalyticActivity[] data, final CatalyticActivityUnit displayUnit) 109 { 110 this(data, displayUnit, StorageType.DENSE); 111 } 112 113 /** 114 * Construct an CatalyticActivityVector from an array of CatalyticActivity objects. The CatalyticActivity 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 CatalyticActivity[]; the data for the vector 118 * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector 119 */ 120 public CatalyticActivityVector(final CatalyticActivity[] data, final StorageType storageType) 121 { 122 this(data, CatalyticActivityUnit.SI, storageType); 123 } 124 125 /** 126 * Construct an CatalyticActivityVector from an array of CatalyticActivity objects. The CatalyticActivity 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 CatalyticActivity[]; the data for the vector 130 */ 131 public CatalyticActivityVector(final CatalyticActivity[] data) 132 { 133 this(data, StorageType.DENSE); 134 } 135 136 /* CONSTRUCTORS WITH List<Double> or List<CatalyticActivity> */ 137 138 /** 139 * Construct an CatalyticActivityVector from a list of Number objects or a list of CatalyticActivity objects. Note that the 140 * displayUnit has a different meaning depending on whether the list contains Number objects (e.g., Double objects) or 141 * CatalyticActivity 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 * CatalyticActivity objects, each CatalyticActivity 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<Double> or List<CatalyticActivity>; the data for the vector 147 * @param displayUnit CatalyticActivityUnit; the display unit of the vector data, and the unit of the data points when the 148 * data is expressed as List<Double> or List<Number> in general 149 * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector 150 */ 151 public CatalyticActivityVector(final List<? extends Number> data, final CatalyticActivityUnit displayUnit, 152 final StorageType storageType) 153 { 154 this(data.size() == 0 ? DoubleVectorData.instantiate(new double[] {}, IdentityScale.SCALE, storageType) 155 : data.get(0) instanceof CatalyticActivity 156 ? DoubleVectorData.instantiate(data, IdentityScale.SCALE, storageType) 157 : DoubleVectorData.instantiate(data, displayUnit.getScale(), storageType), 158 displayUnit); 159 } 160 161 /** 162 * Construct an CatalyticActivityVector from a list of Number objects or a list of CatalyticActivity objects. Note that the 163 * displayUnit has a different meaning depending on whether the list contains Number objects (e.g., Double objects) or 164 * CatalyticActivity 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 * CatalyticActivity objects, each CatalyticActivity 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<Double> or List<CatalyticActivity>; the data for the vector 170 * @param displayUnit CatalyticActivityUnit; the display unit of the vector data, and the unit of the data points when the 171 * data is expressed as List<Double> or List<Number> in general 172 */ 173 public CatalyticActivityVector(final List<? extends Number> data, final CatalyticActivityUnit displayUnit) 174 { 175 this(data, displayUnit, StorageType.DENSE); 176 } 177 178 /** 179 * Construct an CatalyticActivityVector from a list of Number objects or a list of CatalyticActivity objects. When data 180 * contains numbers such as Double, assume that they are expressed using SI units. When the data consists of 181 * CatalyticActivity 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<Double> or List<CatalyticActivity>; the data for the vector 185 * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector 186 */ 187 public CatalyticActivityVector(final List<? extends Number> data, final StorageType storageType) 188 { 189 this(data, CatalyticActivityUnit.SI, storageType); 190 } 191 192 /** 193 * Construct an CatalyticActivityVector from a list of Number objects or a list of CatalyticActivity objects. When data 194 * contains numbers such as Double, assume that they are expressed using SI units. When the data consists of 195 * CatalyticActivity 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<Double> or List<CatalyticActivity>; the data for the vector 199 */ 200 public CatalyticActivityVector(final List<? extends Number> data) 201 { 202 this(data, StorageType.DENSE); 203 } 204 205 /* CONSTRUCTORS WITH Map<Integer, Double> or Map<Integer, CatalyticActivity> */ 206 207 /** 208 * Construct an CatalyticActivityVector from a (sparse) map of index values to Number objects or a (sparse) map of index 209 * values to of CatalyticActivity 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., Double objects) or CatalyticActivity 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 CatalyticActivity objects, each 214 * CatalyticActivity 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, Double> or Map<Integer, CatalyticActivity>; the data for the vector 217 * @param size int; the size off the vector, i.e., the highest index 218 * @param displayUnit CatalyticActivityUnit; the display unit of the vector data, and the unit of the data points when the 219 * data is expressed as List<Double> or List<Number> in general 220 * @param storageType StorageType; the StorageType (SPARSE or DENSE) to use for constructing the Vector 221 */ 222 public CatalyticActivityVector(final Map<Integer, ? extends Number> data, final int size, 223 final CatalyticActivityUnit displayUnit, final StorageType storageType) 224 { 225 this(data.size() == 0 ? DoubleVectorData.instantiate(data, size, IdentityScale.SCALE, storageType) 226 : data.values().iterator().next() instanceof CatalyticActivity 227 ? DoubleVectorData.instantiate(data, size, IdentityScale.SCALE, storageType) 228 : DoubleVectorData.instantiate(data, size, displayUnit.getScale(), storageType), 229 displayUnit); 230 } 231 232 /** 233 * Construct an CatalyticActivityVector from a (sparse) map of index values to Number objects or a (sparse) map of index 234 * values to of CatalyticActivity 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., Double objects) or CatalyticActivity 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 CatalyticActivity objects, each 239 * CatalyticActivity 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, Double> or Map<Integer, CatalyticActivity>; the data for the vector 243 * @param size int; the size off the vector, i.e., the highest index 244 * @param displayUnit CatalyticActivityUnit; the display unit of the vector data, and the unit of the data points when the 245 * data is expressed as List<Double> or List<Number> in general 246 */ 247 public CatalyticActivityVector(final Map<Integer, ? extends Number> data, final int size, 248 final CatalyticActivityUnit displayUnit) 249 { 250 this(data, size, displayUnit, StorageType.SPARSE); 251 } 252 253 /** 254 * Construct an CatalyticActivityVector from a (sparse) map of index values to Number objects or a (sparse) map of index 255 * values to of CatalyticActivity 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 Double, assume that they are expressed using SI units. When the data consists of CatalyticActivity 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, Double> or Map<Integer, CatalyticActivity>; 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 CatalyticActivityVector(final Map<Integer, ? extends Number> data, final int size, final StorageType storageType) 265 { 266 this(data, size, CatalyticActivityUnit.SI, storageType); 267 } 268 269 /** 270 * Construct an CatalyticActivityVector from a (sparse) map of index values to Number objects or a (sparse) map of index 271 * values to of CatalyticActivity 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 Double, assume that they are expressed using SI units. When the data consists of CatalyticActivity 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, Double> or Map<Integer, CatalyticActivity>; the data for the vector 278 * @param size int; the size off the vector, i.e., the highest index 279 */ 280 public CatalyticActivityVector(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<CatalyticActivity> getScalarClass() 289 { 290 return CatalyticActivity.class; 291 } 292 293 @Override 294 public CatalyticActivityVector instantiateVector(final DoubleVectorData dvd, final CatalyticActivityUnit displayUnit) 295 { 296 return new CatalyticActivityVector(dvd, displayUnit); 297 } 298 299 @Override 300 public CatalyticActivity instantiateScalarSI(final double valueSI, final CatalyticActivityUnit displayUnit) 301 { 302 CatalyticActivity result = CatalyticActivity.instantiateSI(valueSI); 303 result.setDisplayUnit(displayUnit); 304 return result; 305 } 306 307 }