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