View Javadoc
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   * Easy access methods for the generic Relative SI DoubleMatrix.
61   * <p>
62   * Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. <br>
63   * All rights reserved. <br>
64   * BSD-style license. See <a href="https://djunits.org/docs/license.html">DJUNITS License</a>.
65   * </p>
66   * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
67   * @author <a href="https://www.tudelft.nl/staff/p.knoppers/">Peter Knoppers</a>
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       * Construct a new Relative Double SIMatrix on the basis of a data object.
77       * @param data DoubleMatrixData; an internal data object
78       * @param unit SIUnit; the unit
79       */
80      public SIMatrix(final DoubleMatrixData data, final SIUnit unit)
81      {
82          super(data, unit);
83      }
84  
85      /**
86       * Construct a new Relative Double SIMatrix with a unit for the float values that will also be used for the displayUnit.
87       * @param values double[][]; the values of the entries in the new Relative Double SIMatrix
88       * @param unit SIUnit; the unit of the new Relative Double SIMatrix
89       * @param storageType StorageType; the data type to use (e.g., DENSE or SPARSE)
90       * @throws ValueRuntimeException when values is null
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       * Construct a new Relative Double SIMatrix with a unit for the float values that will also be used for the displayUnit.
99       * Assume the StorageType is DENSE since we offer the content as an array.
100      * @param values double[][]; the values of the entries in the new Relative Double SIMatrix
101      * @param unit SIUnit; the unit of the new Relative Double SIMatrix
102      * @throws ValueRuntimeException when values is null
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      * Returns an SIMatrix based on an array of values and the textual representation of the unit.
123      * @param values double[][]; the values to use
124      * @param unitString String; the textual representation of the unit
125      * @param storageType StorageType; the storage type to use
126      * @return SIMatrix; the matrix representation of the values in their unit
127      * @throws IllegalArgumentException when the unit cannot be parsed or is incorrect
128      * @throws NullPointerException when the unitString argument is null
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     /******************************** 'CAST AS' METHODS *******************************/
176     /**********************************************************************************/
177 
178     /**
179      * Return the current matrix as a absorbeddose matrix.
180      * @return AbsorbedDoseMatrix; the current matrix as a absorbeddose matrix
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      * Return the current matrix as a absorbeddose matrix, and provide a display unit.
191      * @param displayUnit the unit in which the value will be displayed
192      * @return AbsorbedDoseMatrix; the current matrix as a absorbeddose matrix
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      * Return the current matrix as a acceleration matrix.
205      * @return AccelerationMatrix; the current matrix as a acceleration matrix
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      * Return the current matrix as a acceleration matrix, and provide a display unit.
216      * @param displayUnit the unit in which the value will be displayed
217      * @return AccelerationMatrix; the current matrix as a acceleration matrix
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      * Return the current matrix as a amountofsubstance matrix.
230      * @return AmountOfSubstanceMatrix; the current matrix as a amountofsubstance matrix
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      * Return the current matrix as a amountofsubstance matrix, and provide a display unit.
241      * @param displayUnit the unit in which the value will be displayed
242      * @return AmountOfSubstanceMatrix; the current matrix as a amountofsubstance matrix
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      * Return the current matrix as a angularacceleration matrix.
255      * @return AngularAccelerationMatrix; the current matrix as a angularacceleration matrix
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      * Return the current matrix as a angularacceleration matrix, and provide a display unit.
266      * @param displayUnit the unit in which the value will be displayed
267      * @return AngularAccelerationMatrix; the current matrix as a angularacceleration matrix
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      * Return the current matrix as a angularvelocity matrix.
280      * @return AngularVelocityMatrix; the current matrix as a angularvelocity matrix
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      * Return the current matrix as a angularvelocity matrix, and provide a display unit.
291      * @param displayUnit the unit in which the value will be displayed
292      * @return AngularVelocityMatrix; the current matrix as a angularvelocity matrix
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      * Return the current matrix as a area matrix.
305      * @return AreaMatrix; the current matrix as a area matrix
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      * Return the current matrix as a area matrix, and provide a display unit.
316      * @param displayUnit the unit in which the value will be displayed
317      * @return AreaMatrix; the current matrix as a area matrix
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      * Return the current matrix as a catalyticactivity matrix.
330      * @return CatalyticActivityMatrix; the current matrix as a catalyticactivity matrix
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      * Return the current matrix as a catalyticactivity matrix, and provide a display unit.
341      * @param displayUnit the unit in which the value will be displayed
342      * @return CatalyticActivityMatrix; the current matrix as a catalyticactivity matrix
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      * Return the current matrix as a density matrix.
355      * @return DensityMatrix; the current matrix as a density matrix
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      * Return the current matrix as a density matrix, and provide a display unit.
366      * @param displayUnit the unit in which the value will be displayed
367      * @return DensityMatrix; the current matrix as a density matrix
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      * Return the current matrix as a dimensionless matrix.
380      * @return DimensionlessMatrix; the current matrix as a dimensionless matrix
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      * Return the current matrix as a dimensionless matrix, and provide a display unit.
391      * @param displayUnit the unit in which the value will be displayed
392      * @return DimensionlessMatrix; the current matrix as a dimensionless matrix
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      * Return the current matrix as a electricalcapacitance matrix.
405      * @return ElectricalCapacitanceMatrix; the current matrix as a electricalcapacitance matrix
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      * Return the current matrix as a electricalcapacitance matrix, and provide a display unit.
416      * @param displayUnit the unit in which the value will be displayed
417      * @return ElectricalCapacitanceMatrix; the current matrix as a electricalcapacitance matrix
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      * Return the current matrix as a electricalcharge matrix.
430      * @return ElectricalChargeMatrix; the current matrix as a electricalcharge matrix
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      * Return the current matrix as a electricalcharge matrix, and provide a display unit.
441      * @param displayUnit the unit in which the value will be displayed
442      * @return ElectricalChargeMatrix; the current matrix as a electricalcharge matrix
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      * Return the current matrix as a electricalconductance matrix.
455      * @return ElectricalConductanceMatrix; the current matrix as a electricalconductance matrix
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      * Return the current matrix as a electricalconductance matrix, and provide a display unit.
466      * @param displayUnit the unit in which the value will be displayed
467      * @return ElectricalConductanceMatrix; the current matrix as a electricalconductance matrix
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      * Return the current matrix as a electricalcurrent matrix.
480      * @return ElectricalCurrentMatrix; the current matrix as a electricalcurrent matrix
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      * Return the current matrix as a electricalcurrent matrix, and provide a display unit.
491      * @param displayUnit the unit in which the value will be displayed
492      * @return ElectricalCurrentMatrix; the current matrix as a electricalcurrent matrix
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      * Return the current matrix as a electricalinductance matrix.
505      * @return ElectricalInductanceMatrix; the current matrix as a electricalinductance matrix
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      * Return the current matrix as a electricalinductance matrix, and provide a display unit.
516      * @param displayUnit the unit in which the value will be displayed
517      * @return ElectricalInductanceMatrix; the current matrix as a electricalinductance matrix
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      * Return the current matrix as a electricalpotential matrix.
530      * @return ElectricalPotentialMatrix; the current matrix as a electricalpotential matrix
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      * Return the current matrix as a electricalpotential matrix, and provide a display unit.
541      * @param displayUnit the unit in which the value will be displayed
542      * @return ElectricalPotentialMatrix; the current matrix as a electricalpotential matrix
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      * Return the current matrix as a electricalresistance matrix.
555      * @return ElectricalResistanceMatrix; the current matrix as a electricalresistance matrix
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      * Return the current matrix as a electricalresistance matrix, and provide a display unit.
566      * @param displayUnit the unit in which the value will be displayed
567      * @return ElectricalResistanceMatrix; the current matrix as a electricalresistance matrix
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      * Return the current matrix as a energy matrix.
580      * @return EnergyMatrix; the current matrix as a energy matrix
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      * Return the current matrix as a energy matrix, and provide a display unit.
591      * @param displayUnit the unit in which the value will be displayed
592      * @return EnergyMatrix; the current matrix as a energy matrix
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      * Return the current matrix as a equivalentdose matrix.
605      * @return EquivalentDoseMatrix; the current matrix as a equivalentdose matrix
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      * Return the current matrix as a equivalentdose matrix, and provide a display unit.
616      * @param displayUnit the unit in which the value will be displayed
617      * @return EquivalentDoseMatrix; the current matrix as a equivalentdose matrix
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      * Return the current matrix as a flowmass matrix.
630      * @return FlowMassMatrix; the current matrix as a flowmass matrix
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      * Return the current matrix as a flowmass matrix, and provide a display unit.
641      * @param displayUnit the unit in which the value will be displayed
642      * @return FlowMassMatrix; the current matrix as a flowmass matrix
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      * Return the current matrix as a flowvolume matrix.
655      * @return FlowVolumeMatrix; the current matrix as a flowvolume matrix
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      * Return the current matrix as a flowvolume matrix, and provide a display unit.
666      * @param displayUnit the unit in which the value will be displayed
667      * @return FlowVolumeMatrix; the current matrix as a flowvolume matrix
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      * Return the current matrix as a force matrix.
680      * @return ForceMatrix; the current matrix as a force matrix
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      * Return the current matrix as a force matrix, and provide a display unit.
691      * @param displayUnit the unit in which the value will be displayed
692      * @return ForceMatrix; the current matrix as a force matrix
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      * Return the current matrix as a frequency matrix.
705      * @return FrequencyMatrix; the current matrix as a frequency matrix
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      * Return the current matrix as a frequency matrix, and provide a display unit.
716      * @param displayUnit the unit in which the value will be displayed
717      * @return FrequencyMatrix; the current matrix as a frequency matrix
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      * Return the current matrix as a illuminance matrix.
730      * @return IlluminanceMatrix; the current matrix as a illuminance matrix
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      * Return the current matrix as a illuminance matrix, and provide a display unit.
741      * @param displayUnit the unit in which the value will be displayed
742      * @return IlluminanceMatrix; the current matrix as a illuminance matrix
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      * Return the current matrix as a lineardensity matrix.
755      * @return LinearDensityMatrix; the current matrix as a lineardensity matrix
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      * Return the current matrix as a lineardensity matrix, and provide a display unit.
766      * @param displayUnit the unit in which the value will be displayed
767      * @return LinearDensityMatrix; the current matrix as a lineardensity matrix
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      * Return the current matrix as a luminousflux matrix.
780      * @return LuminousFluxMatrix; the current matrix as a luminousflux matrix
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      * Return the current matrix as a luminousflux matrix, and provide a display unit.
791      * @param displayUnit the unit in which the value will be displayed
792      * @return LuminousFluxMatrix; the current matrix as a luminousflux matrix
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      * Return the current matrix as a luminousintensity matrix.
805      * @return LuminousIntensityMatrix; the current matrix as a luminousintensity matrix
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      * Return the current matrix as a luminousintensity matrix, and provide a display unit.
816      * @param displayUnit the unit in which the value will be displayed
817      * @return LuminousIntensityMatrix; the current matrix as a luminousintensity matrix
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      * Return the current matrix as a magneticfluxdensity matrix.
830      * @return MagneticFluxDensityMatrix; the current matrix as a magneticfluxdensity matrix
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      * Return the current matrix as a magneticfluxdensity matrix, and provide a display unit.
841      * @param displayUnit the unit in which the value will be displayed
842      * @return MagneticFluxDensityMatrix; the current matrix as a magneticfluxdensity matrix
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      * Return the current matrix as a magneticflux matrix.
855      * @return MagneticFluxMatrix; the current matrix as a magneticflux matrix
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      * Return the current matrix as a magneticflux matrix, and provide a display unit.
866      * @param displayUnit the unit in which the value will be displayed
867      * @return MagneticFluxMatrix; the current matrix as a magneticflux matrix
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      * Return the current matrix as a mass matrix.
880      * @return MassMatrix; the current matrix as a mass matrix
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      * Return the current matrix as a mass matrix, and provide a display unit.
891      * @param displayUnit the unit in which the value will be displayed
892      * @return MassMatrix; the current matrix as a mass matrix
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      * Return the current matrix as a momentum matrix.
905      * @return MomentumMatrix; the current matrix as a momentum matrix
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      * Return the current matrix as a momentum matrix, and provide a display unit.
916      * @param displayUnit the unit in which the value will be displayed
917      * @return MomentumMatrix; the current matrix as a momentum matrix
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      * Return the current matrix as a power matrix.
930      * @return PowerMatrix; the current matrix as a power matrix
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      * Return the current matrix as a power matrix, and provide a display unit.
941      * @param displayUnit the unit in which the value will be displayed
942      * @return PowerMatrix; the current matrix as a power matrix
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      * Return the current matrix as a pressure matrix.
955      * @return PressureMatrix; the current matrix as a pressure matrix
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      * Return the current matrix as a pressure matrix, and provide a display unit.
966      * @param displayUnit the unit in which the value will be displayed
967      * @return PressureMatrix; the current matrix as a pressure matrix
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      * Return the current matrix as a radioactivity matrix.
980      * @return RadioActivityMatrix; the current matrix as a radioactivity matrix
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      * Return the current matrix as a radioactivity matrix, and provide a display unit.
991      * @param displayUnit the unit in which the value will be displayed
992      * @return RadioActivityMatrix; the current matrix as a radioactivity matrix
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      * Return the current matrix as a solidangle matrix.
1005      * @return SolidAngleMatrix; the current matrix as a solidangle matrix
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      * Return the current matrix as a solidangle matrix, and provide a display unit.
1016      * @param displayUnit the unit in which the value will be displayed
1017      * @return SolidAngleMatrix; the current matrix as a solidangle matrix
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      * Return the current matrix as a speed matrix.
1030      * @return SpeedMatrix; the current matrix as a speed matrix
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      * Return the current matrix as a speed matrix, and provide a display unit.
1041      * @param displayUnit the unit in which the value will be displayed
1042      * @return SpeedMatrix; the current matrix as a speed matrix
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      * Return the current matrix as a torque matrix.
1055      * @return TorqueMatrix; the current matrix as a torque matrix
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      * Return the current matrix as a torque matrix, and provide a display unit.
1066      * @param displayUnit the unit in which the value will be displayed
1067      * @return TorqueMatrix; the current matrix as a torque matrix
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      * Return the current matrix as a volume matrix.
1080      * @return VolumeMatrix; the current matrix as a volume matrix
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      * Return the current matrix as a volume matrix, and provide a display unit.
1091      * @param displayUnit the unit in which the value will be displayed
1092      * @return VolumeMatrix; the current matrix as a volume matrix
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      * Return the current matrix as a angle matrix.
1105      * @return AngleMatrix; the current matrix as a angle matrix
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      * Return the current matrix as a angle matrix, and provide a display unit.
1116      * @param displayUnit the unit in which the value will be displayed
1117      * @return AngleMatrix; the current matrix as a angle matrix
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      * Return the current matrix as a length matrix.
1130      * @return LengthMatrix; the current matrix as a length matrix
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      * Return the current matrix as a length matrix, and provide a display unit.
1141      * @param displayUnit the unit in which the value will be displayed
1142      * @return LengthMatrix; the current matrix as a length matrix
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      * Return the current matrix as a temperature matrix.
1155      * @return TemperatureMatrix; the current matrix as a temperature matrix
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      * Return the current matrix as a temperature matrix, and provide a display unit.
1166      * @param displayUnit the unit in which the value will be displayed
1167      * @return TemperatureMatrix; the current matrix as a temperature matrix
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      * Return the current matrix as a duration matrix.
1180      * @return DurationMatrix; the current matrix as a duration matrix
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      * Return the current matrix as a duration matrix, and provide a display unit.
1191      * @param displayUnit the unit in which the value will be displayed
1192      * @return DurationMatrix; the current matrix as a duration matrix
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 }