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