1 package org.djunits.value.vdouble.vector;
2
3 import java.util.List;
4 import java.util.Map;
5
6 import org.djunits.unit.AbsorbedDoseUnit;
7 import org.djunits.unit.AccelerationUnit;
8 import org.djunits.unit.AmountOfSubstanceUnit;
9 import org.djunits.unit.AngleUnit;
10 import org.djunits.unit.AngularAccelerationUnit;
11 import org.djunits.unit.AngularVelocityUnit;
12 import org.djunits.unit.AreaUnit;
13 import org.djunits.unit.CatalyticActivityUnit;
14 import org.djunits.unit.DensityUnit;
15 import org.djunits.unit.DimensionlessUnit;
16 import org.djunits.unit.DurationUnit;
17 import org.djunits.unit.ElectricalCapacitanceUnit;
18 import org.djunits.unit.ElectricalChargeUnit;
19 import org.djunits.unit.ElectricalConductanceUnit;
20 import org.djunits.unit.ElectricalCurrentUnit;
21 import org.djunits.unit.ElectricalInductanceUnit;
22 import org.djunits.unit.ElectricalPotentialUnit;
23 import org.djunits.unit.ElectricalResistanceUnit;
24 import org.djunits.unit.EnergyUnit;
25 import org.djunits.unit.EquivalentDoseUnit;
26 import org.djunits.unit.FlowMassUnit;
27 import org.djunits.unit.FlowVolumeUnit;
28 import org.djunits.unit.ForceUnit;
29 import org.djunits.unit.FrequencyUnit;
30 import org.djunits.unit.IlluminanceUnit;
31 import org.djunits.unit.LengthUnit;
32 import org.djunits.unit.LinearDensityUnit;
33 import org.djunits.unit.LuminousFluxUnit;
34 import org.djunits.unit.LuminousIntensityUnit;
35 import org.djunits.unit.MagneticFluxDensityUnit;
36 import org.djunits.unit.MagneticFluxUnit;
37 import org.djunits.unit.MassUnit;
38 import org.djunits.unit.MomentumUnit;
39 import org.djunits.unit.PowerUnit;
40 import org.djunits.unit.PressureUnit;
41 import org.djunits.unit.RadioActivityUnit;
42 import org.djunits.unit.SIUnit;
43 import org.djunits.unit.SolidAngleUnit;
44 import org.djunits.unit.SpeedUnit;
45 import org.djunits.unit.TemperatureUnit;
46 import org.djunits.unit.TorqueUnit;
47 import org.djunits.unit.Unit;
48 import org.djunits.unit.VolumeUnit;
49 import org.djunits.unit.scale.IdentityScale;
50 import org.djunits.unit.si.SIDimensions;
51 import org.djunits.unit.util.UnitRuntimeException;
52 import org.djunits.value.storage.StorageType;
53 import org.djunits.value.vdouble.scalar.SIScalar;
54 import org.djunits.value.vdouble.vector.base.DoubleVectorRel;
55 import org.djunits.value.vdouble.vector.data.DoubleVectorData;
56 import org.djutils.exceptions.Throw;
57
58 import jakarta.annotation.Generated;
59
60
61
62
63
64
65
66
67
68
69
70 @Generated(value = "org.djunits.generator.GenerateDJUNIT", date = "2023-07-23T14:06:38.224104100Z")
71 public class SIVector extends DoubleVectorRel<SIUnit, SIScalar, SIVector>
72 {
73
74 private static final long serialVersionUID = 20150901L;
75
76
77
78
79
80
81 public SIVector(final DoubleVectorData data, final SIUnit displayUnit)
82 {
83 super(data, displayUnit);
84 }
85
86
87
88
89
90
91
92
93
94
95 public SIVector(final double[] data, final SIUnit displayUnit, final StorageType storageType)
96 {
97 this(DoubleVectorData.instantiate(data, displayUnit.getScale(), storageType), displayUnit);
98 }
99
100
101
102
103
104
105
106 public SIVector(final double[] data, final SIUnit displayUnit)
107 {
108 this(data, displayUnit, StorageType.DENSE);
109 }
110
111
112
113
114
115
116
117
118
119
120 public SIVector(final SIScalar[] data, final SIUnit displayUnit, final StorageType storageType)
121 {
122 this(DoubleVectorData.instantiate(data, storageType), displayUnit);
123 }
124
125
126
127
128
129
130
131
132 public SIVector(final SIScalar[] data, final SIUnit displayUnit)
133 {
134 this(data, displayUnit, StorageType.DENSE);
135 }
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151 public SIVector(final List<? extends Number> data, final SIUnit displayUnit, final StorageType storageType)
152 {
153 this(data.size() == 0 ? DoubleVectorData.instantiate(new double[] {}, IdentityScale.SCALE, storageType)
154 : data.get(0) instanceof SIScalar ? DoubleVectorData.instantiate(data, IdentityScale.SCALE, storageType)
155 : DoubleVectorData.instantiate(data, displayUnit.getScale(), storageType),
156 displayUnit);
157 }
158
159
160
161
162
163
164
165
166
167
168
169
170
171 public SIVector(final List<? extends Number> data, final SIUnit displayUnit)
172 {
173 this(data, displayUnit, StorageType.DENSE);
174 }
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193 public SIVector(final Map<Integer, ? extends Number> data, final int size, final SIUnit displayUnit,
194 final StorageType storageType)
195 {
196 this(data.size() == 0 ? DoubleVectorData.instantiate(data, size, IdentityScale.SCALE, storageType)
197 : data.values().iterator().next() instanceof SIScalar
198 ? DoubleVectorData.instantiate(data, size, IdentityScale.SCALE, storageType)
199 : DoubleVectorData.instantiate(data, size, displayUnit.getScale(), storageType),
200 displayUnit);
201 }
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218 public SIVector(final Map<Integer, ? extends Number> data, final int size, final SIUnit displayUnit)
219 {
220 this(data, size, displayUnit, StorageType.SPARSE);
221 }
222
223
224
225 @Override
226 public Class<SIScalar> getScalarClass()
227 {
228 return SIScalar.class;
229 }
230
231
232
233
234
235
236
237
238
239
240 public static SIVector of(final double[] value, final String unitString, final StorageType storageType)
241 {
242 Throw.whenNull(value, "Error parsing SIVector: value is null");
243 Throw.whenNull(unitString, "Error parsing SIVector: unitString is null");
244 Throw.whenNull(storageType, "Error parsing SIVector: storageType is null");
245 try
246 {
247 SIUnit unit = Unit.lookupOrCreateUnitWithSIDimensions(SIDimensions.of(unitString));
248 if (unit != null)
249 {
250 return new SIVector(value, unit, storageType);
251 }
252 }
253 catch (Exception exception)
254 {
255 throw new IllegalArgumentException("Error parsing SIUnit from " + unitString, exception);
256 }
257 throw new IllegalArgumentException("Error parsing SIVector with unit " + unitString);
258 }
259
260
261
262
263
264
265
266
267
268
269 public static SIVector of(final List<Double> valueList, final String unitString, final StorageType storageType)
270 {
271 Throw.whenNull(valueList, "Error parsing SIVector: valueList is null");
272 Throw.whenNull(unitString, "Error parsing SIVector: unitString is null");
273 Throw.whenNull(storageType, "Error parsing SIVector: storageType is null");
274 try
275 {
276 SIUnit unit = Unit.lookupOrCreateUnitWithSIDimensions(SIDimensions.of(unitString));
277 if (unit != null)
278 {
279 return new SIVector(valueList, unit, storageType);
280 }
281 }
282 catch (Exception exception)
283 {
284 throw new IllegalArgumentException("Error parsing SIUnit from " + unitString, exception);
285 }
286 throw new IllegalArgumentException("Error parsing SIVector with unit " + unitString);
287 }
288
289
290
291
292
293
294
295
296
297
298
299 public static SIVector of(final Map<Integer, Double> valueMap, final String unitString, final int length,
300 final StorageType storageType)
301 {
302 Throw.whenNull(valueMap, "Error parsing SIVector: valueMap is null");
303 Throw.whenNull(unitString, "Error parsing SIVector: unitString is null");
304 Throw.whenNull(storageType, "Error parsing SIVector: storageType is null");
305 try
306 {
307 SIUnit unit = Unit.lookupOrCreateUnitWithSIDimensions(SIDimensions.of(unitString));
308 if (unit != null)
309 {
310 return new SIVector(valueMap, length, unit, storageType);
311 }
312 }
313 catch (Exception exception)
314 {
315 throw new IllegalArgumentException("Error parsing SIUnit from " + unitString, exception);
316 }
317 throw new IllegalArgumentException("Error parsing SIVector with unit " + unitString);
318 }
319
320 @Override
321 public SIVector instantiateVector(final DoubleVectorData dvd, final SIUnit unit)
322 {
323 return new SIVector(dvd, unit);
324 }
325
326 @Override
327 public SIScalar instantiateScalarSI(final double valueSI, final SIUnit unit)
328 {
329 return new SIScalar(valueSI, unit);
330 }
331
332 @Override
333 public String toString(final SIUnit displayUnit, final boolean verbose, final boolean withUnit)
334 {
335 return super.toString(displayUnit, verbose, withUnit).replaceAll("!", "");
336 }
337
338
339
340
341
342
343
344
345
346 public final AbsorbedDoseVector asAbsorbedDose()
347 {
348 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AbsorbedDoseUnit.BASE.getSiDimensions())),
349 UnitRuntimeException.class, "cannot cast %s to AbsorbedDoseVector", this.toString());
350 return new AbsorbedDoseVector(this.data, AbsorbedDoseUnit.SI);
351 }
352
353
354
355
356
357
358 public final AbsorbedDoseVector asAbsorbedDose(final AbsorbedDoseUnit displayUnit)
359 {
360 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AbsorbedDoseUnit.BASE.getSiDimensions())),
361 UnitRuntimeException.class, "cannot cast %s to AbsorbedDoseVector", this.toString());
362 AbsorbedDoseVector result = new AbsorbedDoseVector(this.data, displayUnit.getStandardUnit());
363 result.setDisplayUnit(displayUnit);
364 return result;
365 }
366
367
368
369
370
371 public final AccelerationVector asAcceleration()
372 {
373 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AccelerationUnit.BASE.getSiDimensions())),
374 UnitRuntimeException.class, "cannot cast %s to AccelerationVector", this.toString());
375 return new AccelerationVector(this.data, AccelerationUnit.SI);
376 }
377
378
379
380
381
382
383 public final AccelerationVector asAcceleration(final AccelerationUnit displayUnit)
384 {
385 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AccelerationUnit.BASE.getSiDimensions())),
386 UnitRuntimeException.class, "cannot cast %s to AccelerationVector", this.toString());
387 AccelerationVector result = new AccelerationVector(this.data, displayUnit.getStandardUnit());
388 result.setDisplayUnit(displayUnit);
389 return result;
390 }
391
392
393
394
395
396 public final AmountOfSubstanceVector asAmountOfSubstance()
397 {
398 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AmountOfSubstanceUnit.BASE.getSiDimensions())),
399 UnitRuntimeException.class, "cannot cast %s to AmountOfSubstanceVector", this.toString());
400 return new AmountOfSubstanceVector(this.data, AmountOfSubstanceUnit.SI);
401 }
402
403
404
405
406
407
408 public final AmountOfSubstanceVector asAmountOfSubstance(final AmountOfSubstanceUnit displayUnit)
409 {
410 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AmountOfSubstanceUnit.BASE.getSiDimensions())),
411 UnitRuntimeException.class, "cannot cast %s to AmountOfSubstanceVector", this.toString());
412 AmountOfSubstanceVector result = new AmountOfSubstanceVector(this.data, displayUnit.getStandardUnit());
413 result.setDisplayUnit(displayUnit);
414 return result;
415 }
416
417
418
419
420
421 public final AngularAccelerationVector asAngularAcceleration()
422 {
423 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AngularAccelerationUnit.BASE.getSiDimensions())),
424 UnitRuntimeException.class, "cannot cast %s to AngularAccelerationVector", this.toString());
425 return new AngularAccelerationVector(this.data, AngularAccelerationUnit.SI);
426 }
427
428
429
430
431
432
433 public final AngularAccelerationVector asAngularAcceleration(final AngularAccelerationUnit displayUnit)
434 {
435 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AngularAccelerationUnit.BASE.getSiDimensions())),
436 UnitRuntimeException.class, "cannot cast %s to AngularAccelerationVector", this.toString());
437 AngularAccelerationVector result = new AngularAccelerationVector(this.data, displayUnit.getStandardUnit());
438 result.setDisplayUnit(displayUnit);
439 return result;
440 }
441
442
443
444
445
446 public final AngularVelocityVector asAngularVelocity()
447 {
448 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AngularVelocityUnit.BASE.getSiDimensions())),
449 UnitRuntimeException.class, "cannot cast %s to AngularVelocityVector", this.toString());
450 return new AngularVelocityVector(this.data, AngularVelocityUnit.SI);
451 }
452
453
454
455
456
457
458 public final AngularVelocityVector asAngularVelocity(final AngularVelocityUnit displayUnit)
459 {
460 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AngularVelocityUnit.BASE.getSiDimensions())),
461 UnitRuntimeException.class, "cannot cast %s to AngularVelocityVector", this.toString());
462 AngularVelocityVector result = new AngularVelocityVector(this.data, displayUnit.getStandardUnit());
463 result.setDisplayUnit(displayUnit);
464 return result;
465 }
466
467
468
469
470
471 public final AreaVector asArea()
472 {
473 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AreaUnit.BASE.getSiDimensions())),
474 UnitRuntimeException.class, "cannot cast %s to AreaVector", this.toString());
475 return new AreaVector(this.data, AreaUnit.SI);
476 }
477
478
479
480
481
482
483 public final AreaVector asArea(final AreaUnit displayUnit)
484 {
485 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AreaUnit.BASE.getSiDimensions())),
486 UnitRuntimeException.class, "cannot cast %s to AreaVector", this.toString());
487 AreaVector result = new AreaVector(this.data, displayUnit.getStandardUnit());
488 result.setDisplayUnit(displayUnit);
489 return result;
490 }
491
492
493
494
495
496 public final CatalyticActivityVector asCatalyticActivity()
497 {
498 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(CatalyticActivityUnit.BASE.getSiDimensions())),
499 UnitRuntimeException.class, "cannot cast %s to CatalyticActivityVector", this.toString());
500 return new CatalyticActivityVector(this.data, CatalyticActivityUnit.SI);
501 }
502
503
504
505
506
507
508 public final CatalyticActivityVector asCatalyticActivity(final CatalyticActivityUnit displayUnit)
509 {
510 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(CatalyticActivityUnit.BASE.getSiDimensions())),
511 UnitRuntimeException.class, "cannot cast %s to CatalyticActivityVector", this.toString());
512 CatalyticActivityVector result = new CatalyticActivityVector(this.data, displayUnit.getStandardUnit());
513 result.setDisplayUnit(displayUnit);
514 return result;
515 }
516
517
518
519
520
521 public final DensityVector asDensity()
522 {
523 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(DensityUnit.BASE.getSiDimensions())),
524 UnitRuntimeException.class, "cannot cast %s to DensityVector", this.toString());
525 return new DensityVector(this.data, DensityUnit.SI);
526 }
527
528
529
530
531
532
533 public final DensityVector asDensity(final DensityUnit displayUnit)
534 {
535 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(DensityUnit.BASE.getSiDimensions())),
536 UnitRuntimeException.class, "cannot cast %s to DensityVector", this.toString());
537 DensityVector result = new DensityVector(this.data, displayUnit.getStandardUnit());
538 result.setDisplayUnit(displayUnit);
539 return result;
540 }
541
542
543
544
545
546 public final DimensionlessVector asDimensionless()
547 {
548 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(DimensionlessUnit.BASE.getSiDimensions())),
549 UnitRuntimeException.class, "cannot cast %s to DimensionlessVector", this.toString());
550 return new DimensionlessVector(this.data, DimensionlessUnit.SI);
551 }
552
553
554
555
556
557
558 public final DimensionlessVector asDimensionless(final DimensionlessUnit displayUnit)
559 {
560 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(DimensionlessUnit.BASE.getSiDimensions())),
561 UnitRuntimeException.class, "cannot cast %s to DimensionlessVector", this.toString());
562 DimensionlessVector result = new DimensionlessVector(this.data, displayUnit.getStandardUnit());
563 result.setDisplayUnit(displayUnit);
564 return result;
565 }
566
567
568
569
570
571 public final ElectricalCapacitanceVector asElectricalCapacitance()
572 {
573 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalCapacitanceUnit.BASE.getSiDimensions())),
574 UnitRuntimeException.class, "cannot cast %s to ElectricalCapacitanceVector", this.toString());
575 return new ElectricalCapacitanceVector(this.data, ElectricalCapacitanceUnit.SI);
576 }
577
578
579
580
581
582
583 public final ElectricalCapacitanceVector asElectricalCapacitance(final ElectricalCapacitanceUnit displayUnit)
584 {
585 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalCapacitanceUnit.BASE.getSiDimensions())),
586 UnitRuntimeException.class, "cannot cast %s to ElectricalCapacitanceVector", this.toString());
587 ElectricalCapacitanceVector result = new ElectricalCapacitanceVector(this.data, displayUnit.getStandardUnit());
588 result.setDisplayUnit(displayUnit);
589 return result;
590 }
591
592
593
594
595
596 public final ElectricalChargeVector asElectricalCharge()
597 {
598 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalChargeUnit.BASE.getSiDimensions())),
599 UnitRuntimeException.class, "cannot cast %s to ElectricalChargeVector", this.toString());
600 return new ElectricalChargeVector(this.data, ElectricalChargeUnit.SI);
601 }
602
603
604
605
606
607
608 public final ElectricalChargeVector asElectricalCharge(final ElectricalChargeUnit displayUnit)
609 {
610 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalChargeUnit.BASE.getSiDimensions())),
611 UnitRuntimeException.class, "cannot cast %s to ElectricalChargeVector", this.toString());
612 ElectricalChargeVector result = new ElectricalChargeVector(this.data, displayUnit.getStandardUnit());
613 result.setDisplayUnit(displayUnit);
614 return result;
615 }
616
617
618
619
620
621 public final ElectricalConductanceVector asElectricalConductance()
622 {
623 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalConductanceUnit.BASE.getSiDimensions())),
624 UnitRuntimeException.class, "cannot cast %s to ElectricalConductanceVector", this.toString());
625 return new ElectricalConductanceVector(this.data, ElectricalConductanceUnit.SI);
626 }
627
628
629
630
631
632
633 public final ElectricalConductanceVector asElectricalConductance(final ElectricalConductanceUnit displayUnit)
634 {
635 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalConductanceUnit.BASE.getSiDimensions())),
636 UnitRuntimeException.class, "cannot cast %s to ElectricalConductanceVector", this.toString());
637 ElectricalConductanceVector result = new ElectricalConductanceVector(this.data, displayUnit.getStandardUnit());
638 result.setDisplayUnit(displayUnit);
639 return result;
640 }
641
642
643
644
645
646 public final ElectricalCurrentVector asElectricalCurrent()
647 {
648 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalCurrentUnit.BASE.getSiDimensions())),
649 UnitRuntimeException.class, "cannot cast %s to ElectricalCurrentVector", this.toString());
650 return new ElectricalCurrentVector(this.data, ElectricalCurrentUnit.SI);
651 }
652
653
654
655
656
657
658 public final ElectricalCurrentVector asElectricalCurrent(final ElectricalCurrentUnit displayUnit)
659 {
660 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalCurrentUnit.BASE.getSiDimensions())),
661 UnitRuntimeException.class, "cannot cast %s to ElectricalCurrentVector", this.toString());
662 ElectricalCurrentVector result = new ElectricalCurrentVector(this.data, displayUnit.getStandardUnit());
663 result.setDisplayUnit(displayUnit);
664 return result;
665 }
666
667
668
669
670
671 public final ElectricalInductanceVector asElectricalInductance()
672 {
673 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalInductanceUnit.BASE.getSiDimensions())),
674 UnitRuntimeException.class, "cannot cast %s to ElectricalInductanceVector", this.toString());
675 return new ElectricalInductanceVector(this.data, ElectricalInductanceUnit.SI);
676 }
677
678
679
680
681
682
683 public final ElectricalInductanceVector asElectricalInductance(final ElectricalInductanceUnit displayUnit)
684 {
685 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalInductanceUnit.BASE.getSiDimensions())),
686 UnitRuntimeException.class, "cannot cast %s to ElectricalInductanceVector", this.toString());
687 ElectricalInductanceVector result = new ElectricalInductanceVector(this.data, displayUnit.getStandardUnit());
688 result.setDisplayUnit(displayUnit);
689 return result;
690 }
691
692
693
694
695
696 public final ElectricalPotentialVector asElectricalPotential()
697 {
698 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalPotentialUnit.BASE.getSiDimensions())),
699 UnitRuntimeException.class, "cannot cast %s to ElectricalPotentialVector", this.toString());
700 return new ElectricalPotentialVector(this.data, ElectricalPotentialUnit.SI);
701 }
702
703
704
705
706
707
708 public final ElectricalPotentialVector asElectricalPotential(final ElectricalPotentialUnit displayUnit)
709 {
710 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalPotentialUnit.BASE.getSiDimensions())),
711 UnitRuntimeException.class, "cannot cast %s to ElectricalPotentialVector", this.toString());
712 ElectricalPotentialVector result = new ElectricalPotentialVector(this.data, displayUnit.getStandardUnit());
713 result.setDisplayUnit(displayUnit);
714 return result;
715 }
716
717
718
719
720
721 public final ElectricalResistanceVector asElectricalResistance()
722 {
723 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalResistanceUnit.BASE.getSiDimensions())),
724 UnitRuntimeException.class, "cannot cast %s to ElectricalResistanceVector", this.toString());
725 return new ElectricalResistanceVector(this.data, ElectricalResistanceUnit.SI);
726 }
727
728
729
730
731
732
733 public final ElectricalResistanceVector asElectricalResistance(final ElectricalResistanceUnit displayUnit)
734 {
735 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ElectricalResistanceUnit.BASE.getSiDimensions())),
736 UnitRuntimeException.class, "cannot cast %s to ElectricalResistanceVector", this.toString());
737 ElectricalResistanceVector result = new ElectricalResistanceVector(this.data, displayUnit.getStandardUnit());
738 result.setDisplayUnit(displayUnit);
739 return result;
740 }
741
742
743
744
745
746 public final EnergyVector asEnergy()
747 {
748 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(EnergyUnit.BASE.getSiDimensions())),
749 UnitRuntimeException.class, "cannot cast %s to EnergyVector", this.toString());
750 return new EnergyVector(this.data, EnergyUnit.SI);
751 }
752
753
754
755
756
757
758 public final EnergyVector asEnergy(final EnergyUnit displayUnit)
759 {
760 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(EnergyUnit.BASE.getSiDimensions())),
761 UnitRuntimeException.class, "cannot cast %s to EnergyVector", this.toString());
762 EnergyVector result = new EnergyVector(this.data, displayUnit.getStandardUnit());
763 result.setDisplayUnit(displayUnit);
764 return result;
765 }
766
767
768
769
770
771 public final EquivalentDoseVector asEquivalentDose()
772 {
773 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(EquivalentDoseUnit.BASE.getSiDimensions())),
774 UnitRuntimeException.class, "cannot cast %s to EquivalentDoseVector", this.toString());
775 return new EquivalentDoseVector(this.data, EquivalentDoseUnit.SI);
776 }
777
778
779
780
781
782
783 public final EquivalentDoseVector asEquivalentDose(final EquivalentDoseUnit displayUnit)
784 {
785 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(EquivalentDoseUnit.BASE.getSiDimensions())),
786 UnitRuntimeException.class, "cannot cast %s to EquivalentDoseVector", this.toString());
787 EquivalentDoseVector result = new EquivalentDoseVector(this.data, displayUnit.getStandardUnit());
788 result.setDisplayUnit(displayUnit);
789 return result;
790 }
791
792
793
794
795
796 public final FlowMassVector asFlowMass()
797 {
798 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(FlowMassUnit.BASE.getSiDimensions())),
799 UnitRuntimeException.class, "cannot cast %s to FlowMassVector", this.toString());
800 return new FlowMassVector(this.data, FlowMassUnit.SI);
801 }
802
803
804
805
806
807
808 public final FlowMassVector asFlowMass(final FlowMassUnit displayUnit)
809 {
810 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(FlowMassUnit.BASE.getSiDimensions())),
811 UnitRuntimeException.class, "cannot cast %s to FlowMassVector", this.toString());
812 FlowMassVector result = new FlowMassVector(this.data, displayUnit.getStandardUnit());
813 result.setDisplayUnit(displayUnit);
814 return result;
815 }
816
817
818
819
820
821 public final FlowVolumeVector asFlowVolume()
822 {
823 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(FlowVolumeUnit.BASE.getSiDimensions())),
824 UnitRuntimeException.class, "cannot cast %s to FlowVolumeVector", this.toString());
825 return new FlowVolumeVector(this.data, FlowVolumeUnit.SI);
826 }
827
828
829
830
831
832
833 public final FlowVolumeVector asFlowVolume(final FlowVolumeUnit displayUnit)
834 {
835 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(FlowVolumeUnit.BASE.getSiDimensions())),
836 UnitRuntimeException.class, "cannot cast %s to FlowVolumeVector", this.toString());
837 FlowVolumeVector result = new FlowVolumeVector(this.data, displayUnit.getStandardUnit());
838 result.setDisplayUnit(displayUnit);
839 return result;
840 }
841
842
843
844
845
846 public final ForceVector asForce()
847 {
848 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ForceUnit.BASE.getSiDimensions())),
849 UnitRuntimeException.class, "cannot cast %s to ForceVector", this.toString());
850 return new ForceVector(this.data, ForceUnit.SI);
851 }
852
853
854
855
856
857
858 public final ForceVector asForce(final ForceUnit displayUnit)
859 {
860 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(ForceUnit.BASE.getSiDimensions())),
861 UnitRuntimeException.class, "cannot cast %s to ForceVector", this.toString());
862 ForceVector result = new ForceVector(this.data, displayUnit.getStandardUnit());
863 result.setDisplayUnit(displayUnit);
864 return result;
865 }
866
867
868
869
870
871 public final FrequencyVector asFrequency()
872 {
873 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(FrequencyUnit.BASE.getSiDimensions())),
874 UnitRuntimeException.class, "cannot cast %s to FrequencyVector", this.toString());
875 return new FrequencyVector(this.data, FrequencyUnit.SI);
876 }
877
878
879
880
881
882
883 public final FrequencyVector asFrequency(final FrequencyUnit displayUnit)
884 {
885 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(FrequencyUnit.BASE.getSiDimensions())),
886 UnitRuntimeException.class, "cannot cast %s to FrequencyVector", this.toString());
887 FrequencyVector result = new FrequencyVector(this.data, displayUnit.getStandardUnit());
888 result.setDisplayUnit(displayUnit);
889 return result;
890 }
891
892
893
894
895
896 public final IlluminanceVector asIlluminance()
897 {
898 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(IlluminanceUnit.BASE.getSiDimensions())),
899 UnitRuntimeException.class, "cannot cast %s to IlluminanceVector", this.toString());
900 return new IlluminanceVector(this.data, IlluminanceUnit.SI);
901 }
902
903
904
905
906
907
908 public final IlluminanceVector asIlluminance(final IlluminanceUnit displayUnit)
909 {
910 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(IlluminanceUnit.BASE.getSiDimensions())),
911 UnitRuntimeException.class, "cannot cast %s to IlluminanceVector", this.toString());
912 IlluminanceVector result = new IlluminanceVector(this.data, displayUnit.getStandardUnit());
913 result.setDisplayUnit(displayUnit);
914 return result;
915 }
916
917
918
919
920
921 public final LinearDensityVector asLinearDensity()
922 {
923 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(LinearDensityUnit.BASE.getSiDimensions())),
924 UnitRuntimeException.class, "cannot cast %s to LinearDensityVector", this.toString());
925 return new LinearDensityVector(this.data, LinearDensityUnit.SI);
926 }
927
928
929
930
931
932
933 public final LinearDensityVector asLinearDensity(final LinearDensityUnit displayUnit)
934 {
935 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(LinearDensityUnit.BASE.getSiDimensions())),
936 UnitRuntimeException.class, "cannot cast %s to LinearDensityVector", this.toString());
937 LinearDensityVector result = new LinearDensityVector(this.data, displayUnit.getStandardUnit());
938 result.setDisplayUnit(displayUnit);
939 return result;
940 }
941
942
943
944
945
946 public final LuminousFluxVector asLuminousFlux()
947 {
948 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(LuminousFluxUnit.BASE.getSiDimensions())),
949 UnitRuntimeException.class, "cannot cast %s to LuminousFluxVector", this.toString());
950 return new LuminousFluxVector(this.data, LuminousFluxUnit.SI);
951 }
952
953
954
955
956
957
958 public final LuminousFluxVector asLuminousFlux(final LuminousFluxUnit displayUnit)
959 {
960 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(LuminousFluxUnit.BASE.getSiDimensions())),
961 UnitRuntimeException.class, "cannot cast %s to LuminousFluxVector", this.toString());
962 LuminousFluxVector result = new LuminousFluxVector(this.data, displayUnit.getStandardUnit());
963 result.setDisplayUnit(displayUnit);
964 return result;
965 }
966
967
968
969
970
971 public final LuminousIntensityVector asLuminousIntensity()
972 {
973 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(LuminousIntensityUnit.BASE.getSiDimensions())),
974 UnitRuntimeException.class, "cannot cast %s to LuminousIntensityVector", this.toString());
975 return new LuminousIntensityVector(this.data, LuminousIntensityUnit.SI);
976 }
977
978
979
980
981
982
983 public final LuminousIntensityVector asLuminousIntensity(final LuminousIntensityUnit displayUnit)
984 {
985 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(LuminousIntensityUnit.BASE.getSiDimensions())),
986 UnitRuntimeException.class, "cannot cast %s to LuminousIntensityVector", this.toString());
987 LuminousIntensityVector result = new LuminousIntensityVector(this.data, displayUnit.getStandardUnit());
988 result.setDisplayUnit(displayUnit);
989 return result;
990 }
991
992
993
994
995
996 public final MagneticFluxDensityVector asMagneticFluxDensity()
997 {
998 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(MagneticFluxDensityUnit.BASE.getSiDimensions())),
999 UnitRuntimeException.class, "cannot cast %s to MagneticFluxDensityVector", this.toString());
1000 return new MagneticFluxDensityVector(this.data, MagneticFluxDensityUnit.SI);
1001 }
1002
1003
1004
1005
1006
1007
1008 public final MagneticFluxDensityVector asMagneticFluxDensity(final MagneticFluxDensityUnit displayUnit)
1009 {
1010 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(MagneticFluxDensityUnit.BASE.getSiDimensions())),
1011 UnitRuntimeException.class, "cannot cast %s to MagneticFluxDensityVector", this.toString());
1012 MagneticFluxDensityVector result = new MagneticFluxDensityVector(this.data, displayUnit.getStandardUnit());
1013 result.setDisplayUnit(displayUnit);
1014 return result;
1015 }
1016
1017
1018
1019
1020
1021 public final MagneticFluxVector asMagneticFlux()
1022 {
1023 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(MagneticFluxUnit.BASE.getSiDimensions())),
1024 UnitRuntimeException.class, "cannot cast %s to MagneticFluxVector", this.toString());
1025 return new MagneticFluxVector(this.data, MagneticFluxUnit.SI);
1026 }
1027
1028
1029
1030
1031
1032
1033 public final MagneticFluxVector asMagneticFlux(final MagneticFluxUnit displayUnit)
1034 {
1035 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(MagneticFluxUnit.BASE.getSiDimensions())),
1036 UnitRuntimeException.class, "cannot cast %s to MagneticFluxVector", this.toString());
1037 MagneticFluxVector result = new MagneticFluxVector(this.data, displayUnit.getStandardUnit());
1038 result.setDisplayUnit(displayUnit);
1039 return result;
1040 }
1041
1042
1043
1044
1045
1046 public final MassVector asMass()
1047 {
1048 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(MassUnit.BASE.getSiDimensions())),
1049 UnitRuntimeException.class, "cannot cast %s to MassVector", this.toString());
1050 return new MassVector(this.data, MassUnit.SI);
1051 }
1052
1053
1054
1055
1056
1057
1058 public final MassVector asMass(final MassUnit displayUnit)
1059 {
1060 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(MassUnit.BASE.getSiDimensions())),
1061 UnitRuntimeException.class, "cannot cast %s to MassVector", this.toString());
1062 MassVector result = new MassVector(this.data, displayUnit.getStandardUnit());
1063 result.setDisplayUnit(displayUnit);
1064 return result;
1065 }
1066
1067
1068
1069
1070
1071 public final MomentumVector asMomentum()
1072 {
1073 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(MomentumUnit.BASE.getSiDimensions())),
1074 UnitRuntimeException.class, "cannot cast %s to MomentumVector", this.toString());
1075 return new MomentumVector(this.data, MomentumUnit.SI);
1076 }
1077
1078
1079
1080
1081
1082
1083 public final MomentumVector asMomentum(final MomentumUnit displayUnit)
1084 {
1085 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(MomentumUnit.BASE.getSiDimensions())),
1086 UnitRuntimeException.class, "cannot cast %s to MomentumVector", this.toString());
1087 MomentumVector result = new MomentumVector(this.data, displayUnit.getStandardUnit());
1088 result.setDisplayUnit(displayUnit);
1089 return result;
1090 }
1091
1092
1093
1094
1095
1096 public final PowerVector asPower()
1097 {
1098 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(PowerUnit.BASE.getSiDimensions())),
1099 UnitRuntimeException.class, "cannot cast %s to PowerVector", this.toString());
1100 return new PowerVector(this.data, PowerUnit.SI);
1101 }
1102
1103
1104
1105
1106
1107
1108 public final PowerVector asPower(final PowerUnit displayUnit)
1109 {
1110 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(PowerUnit.BASE.getSiDimensions())),
1111 UnitRuntimeException.class, "cannot cast %s to PowerVector", this.toString());
1112 PowerVector result = new PowerVector(this.data, displayUnit.getStandardUnit());
1113 result.setDisplayUnit(displayUnit);
1114 return result;
1115 }
1116
1117
1118
1119
1120
1121 public final PressureVector asPressure()
1122 {
1123 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(PressureUnit.BASE.getSiDimensions())),
1124 UnitRuntimeException.class, "cannot cast %s to PressureVector", this.toString());
1125 return new PressureVector(this.data, PressureUnit.SI);
1126 }
1127
1128
1129
1130
1131
1132
1133 public final PressureVector asPressure(final PressureUnit displayUnit)
1134 {
1135 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(PressureUnit.BASE.getSiDimensions())),
1136 UnitRuntimeException.class, "cannot cast %s to PressureVector", this.toString());
1137 PressureVector result = new PressureVector(this.data, displayUnit.getStandardUnit());
1138 result.setDisplayUnit(displayUnit);
1139 return result;
1140 }
1141
1142
1143
1144
1145
1146 public final RadioActivityVector asRadioActivity()
1147 {
1148 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(RadioActivityUnit.BASE.getSiDimensions())),
1149 UnitRuntimeException.class, "cannot cast %s to RadioActivityVector", this.toString());
1150 return new RadioActivityVector(this.data, RadioActivityUnit.SI);
1151 }
1152
1153
1154
1155
1156
1157
1158 public final RadioActivityVector asRadioActivity(final RadioActivityUnit displayUnit)
1159 {
1160 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(RadioActivityUnit.BASE.getSiDimensions())),
1161 UnitRuntimeException.class, "cannot cast %s to RadioActivityVector", this.toString());
1162 RadioActivityVector result = new RadioActivityVector(this.data, displayUnit.getStandardUnit());
1163 result.setDisplayUnit(displayUnit);
1164 return result;
1165 }
1166
1167
1168
1169
1170
1171 public final SolidAngleVector asSolidAngle()
1172 {
1173 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(SolidAngleUnit.BASE.getSiDimensions())),
1174 UnitRuntimeException.class, "cannot cast %s to SolidAngleVector", this.toString());
1175 return new SolidAngleVector(this.data, SolidAngleUnit.SI);
1176 }
1177
1178
1179
1180
1181
1182
1183 public final SolidAngleVector asSolidAngle(final SolidAngleUnit displayUnit)
1184 {
1185 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(SolidAngleUnit.BASE.getSiDimensions())),
1186 UnitRuntimeException.class, "cannot cast %s to SolidAngleVector", this.toString());
1187 SolidAngleVector result = new SolidAngleVector(this.data, displayUnit.getStandardUnit());
1188 result.setDisplayUnit(displayUnit);
1189 return result;
1190 }
1191
1192
1193
1194
1195
1196 public final SpeedVector asSpeed()
1197 {
1198 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(SpeedUnit.BASE.getSiDimensions())),
1199 UnitRuntimeException.class, "cannot cast %s to SpeedVector", this.toString());
1200 return new SpeedVector(this.data, SpeedUnit.SI);
1201 }
1202
1203
1204
1205
1206
1207
1208 public final SpeedVector asSpeed(final SpeedUnit displayUnit)
1209 {
1210 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(SpeedUnit.BASE.getSiDimensions())),
1211 UnitRuntimeException.class, "cannot cast %s to SpeedVector", this.toString());
1212 SpeedVector result = new SpeedVector(this.data, displayUnit.getStandardUnit());
1213 result.setDisplayUnit(displayUnit);
1214 return result;
1215 }
1216
1217
1218
1219
1220
1221 public final TorqueVector asTorque()
1222 {
1223 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(TorqueUnit.BASE.getSiDimensions())),
1224 UnitRuntimeException.class, "cannot cast %s to TorqueVector", this.toString());
1225 return new TorqueVector(this.data, TorqueUnit.SI);
1226 }
1227
1228
1229
1230
1231
1232
1233 public final TorqueVector asTorque(final TorqueUnit displayUnit)
1234 {
1235 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(TorqueUnit.BASE.getSiDimensions())),
1236 UnitRuntimeException.class, "cannot cast %s to TorqueVector", this.toString());
1237 TorqueVector result = new TorqueVector(this.data, displayUnit.getStandardUnit());
1238 result.setDisplayUnit(displayUnit);
1239 return result;
1240 }
1241
1242
1243
1244
1245
1246 public final VolumeVector asVolume()
1247 {
1248 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(VolumeUnit.BASE.getSiDimensions())),
1249 UnitRuntimeException.class, "cannot cast %s to VolumeVector", this.toString());
1250 return new VolumeVector(this.data, VolumeUnit.SI);
1251 }
1252
1253
1254
1255
1256
1257
1258 public final VolumeVector asVolume(final VolumeUnit displayUnit)
1259 {
1260 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(VolumeUnit.BASE.getSiDimensions())),
1261 UnitRuntimeException.class, "cannot cast %s to VolumeVector", this.toString());
1262 VolumeVector result = new VolumeVector(this.data, displayUnit.getStandardUnit());
1263 result.setDisplayUnit(displayUnit);
1264 return result;
1265 }
1266
1267
1268
1269
1270
1271 public final AngleVector asAngle()
1272 {
1273 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AngleUnit.BASE.getSiDimensions())),
1274 UnitRuntimeException.class, "cannot cast %s to AngleVector", this.toString());
1275 return new AngleVector(this.data, AngleUnit.SI);
1276 }
1277
1278
1279
1280
1281
1282
1283 public final AngleVector asAngle(final AngleUnit displayUnit)
1284 {
1285 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(AngleUnit.BASE.getSiDimensions())),
1286 UnitRuntimeException.class, "cannot cast %s to AngleVector", this.toString());
1287 AngleVector result = new AngleVector(this.data, displayUnit.getStandardUnit());
1288 result.setDisplayUnit(displayUnit);
1289 return result;
1290 }
1291
1292
1293
1294
1295
1296 public final LengthVector asLength()
1297 {
1298 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(LengthUnit.BASE.getSiDimensions())),
1299 UnitRuntimeException.class, "cannot cast %s to LengthVector", this.toString());
1300 return new LengthVector(this.data, LengthUnit.SI);
1301 }
1302
1303
1304
1305
1306
1307
1308 public final LengthVector asLength(final LengthUnit displayUnit)
1309 {
1310 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(LengthUnit.BASE.getSiDimensions())),
1311 UnitRuntimeException.class, "cannot cast %s to LengthVector", this.toString());
1312 LengthVector result = new LengthVector(this.data, displayUnit.getStandardUnit());
1313 result.setDisplayUnit(displayUnit);
1314 return result;
1315 }
1316
1317
1318
1319
1320
1321 public final TemperatureVector asTemperature()
1322 {
1323 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(TemperatureUnit.BASE.getSiDimensions())),
1324 UnitRuntimeException.class, "cannot cast %s to TemperatureVector", this.toString());
1325 return new TemperatureVector(this.data, TemperatureUnit.SI);
1326 }
1327
1328
1329
1330
1331
1332
1333 public final TemperatureVector asTemperature(final TemperatureUnit displayUnit)
1334 {
1335 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(TemperatureUnit.BASE.getSiDimensions())),
1336 UnitRuntimeException.class, "cannot cast %s to TemperatureVector", this.toString());
1337 TemperatureVector result = new TemperatureVector(this.data, displayUnit.getStandardUnit());
1338 result.setDisplayUnit(displayUnit);
1339 return result;
1340 }
1341
1342
1343
1344
1345
1346 public final DurationVector asDuration()
1347 {
1348 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(DurationUnit.BASE.getSiDimensions())),
1349 UnitRuntimeException.class, "cannot cast %s to DurationVector", this.toString());
1350 return new DurationVector(this.data, DurationUnit.SI);
1351 }
1352
1353
1354
1355
1356
1357
1358 public final DurationVector asDuration(final DurationUnit displayUnit)
1359 {
1360 Throw.when(!(getDisplayUnit().getQuantity().getSiDimensions().equals(DurationUnit.BASE.getSiDimensions())),
1361 UnitRuntimeException.class, "cannot cast %s to DurationVector", this.toString());
1362 DurationVector result = new DurationVector(this.data, displayUnit.getStandardUnit());
1363 result.setDisplayUnit(displayUnit);
1364 return result;
1365 }
1366
1367 }