getValue method

Number getValue(
  1. Units units
)

Gets this quantity's value in units.

  • The Dimensions of the specified units are checked for validity. This method throws a DimensionsException (a RuntimeException) if the units' Dimensions are not equal to this MiscQuantity object's Dimensions.
  • The value is returned in double precision even if the quantity's value is stored internally in arbitrary precision.

Implementation

Number getValue(Units units) {
  if (dimensions != (units as Quantity).dimensions) {
    throw DimensionsException('The units provided do not have proper dimensions for this Quantity.');
  }
  return super.valueInUnits(units);
}