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