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