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