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