Package ucar.units
Interface DerivableUnit
-
- All Known Implementing Classes:
BaseUnit,DerivedUnitImpl,LogarithmicUnit,OffsetUnit,ScaledUnit,UnknownUnit
public interface DerivableUnitInterface for units that can convert numeric values to and from an underlying derived unit.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description doublefromDerivedUnit(double amount)Converts a numeric value from the underlying derived unit to this unit.double[]fromDerivedUnit(double[] input, double[] output)Converts numeric values from the underlying derived unit to this unit.floatfromDerivedUnit(float amount)Converts numeric values from the underlying derived unit to this unit.float[]fromDerivedUnit(float[] input, float[] output)Converts numeric values from the underlying derived unit to this unit.DerivedUnitgetDerivedUnit()Returns the derived unit that underlies this unit.doubletoDerivedUnit(double amount)Converts a numeric value in this unit to the underlying derived unit.double[]toDerivedUnit(double[] input, double[] output)Converts numeric values in this unit to the underlying derived unit.floattoDerivedUnit(float amount)Converts a numeric value in this unit to the underlying derived unit.float[]toDerivedUnit(float[] input, float[] output)Converts numeric values in this unit to the underlying derived unit.
-
-
-
Method Detail
-
getDerivedUnit
DerivedUnit getDerivedUnit()
Returns the derived unit that underlies this unit.- Returns:
- The derived unit that underlies this unit.
-
toDerivedUnit
float toDerivedUnit(float amount) throws ConversionExceptionConverts a numeric value in this unit to the underlying derived unit. This method might fail even thoughconvertTo()succeeds.- Parameters:
amount- The numeric values in this unit.- Returns:
- The numeric value in the underlying derived unit.
- Throws:
ConversionException- Can't convert values to underlying derived unit.
-
toDerivedUnit
double toDerivedUnit(double amount) throws ConversionExceptionConverts a numeric value in this unit to the underlying derived unit. This method might fail even thoughconvertTo()succeeds.- Parameters:
amount- The numeric value in this unit.- Returns:
- The equivalent numeric value in the underlying derived unit.
- Throws:
ConversionException- Can't convert to derived unit.
-
toDerivedUnit
float[] toDerivedUnit(float[] input, float[] output) throws ConversionExceptionConverts numeric values in this unit to the underlying derived unit. This method might fail even thoughconvertTo()succeeds.- Parameters:
input- The numeric values in this unit.output- The equivalent numeric values in the underlying derived unit. May be the same array asinput.- Returns:
output.- Throws:
ConversionException- Can't convert to derived unit.
-
toDerivedUnit
double[] toDerivedUnit(double[] input, double[] output) throws ConversionExceptionConverts numeric values in this unit to the underlying derived unit. This method might fail even thoughconvertTo()succeeds.- Parameters:
input- The numeric values in this unit.output- The equivalent numeric values in the underlying derived unit. May be the same array asinput.- Returns:
output.- Throws:
ConversionException- Can't convert to derived unit.
-
fromDerivedUnit
float fromDerivedUnit(float amount) throws ConversionExceptionConverts numeric values from the underlying derived unit to this unit.- Parameters:
amount- The numeric values in the underlying derived unit.- Returns:
- The numeric values in this unit.
- Throws:
ConversionException- Can't convert values from underlying derived unit.
-
fromDerivedUnit
double fromDerivedUnit(double amount) throws ConversionExceptionConverts a numeric value from the underlying derived unit to this unit. This method might fail even thoughconvertTo()succeeds.- Parameters:
amount- The numeric value in the underlying derived unit.- Returns:
- The equivalent numeric value in this unit.
- Throws:
ConversionException- Can't convert from underlying derived unit.
-
fromDerivedUnit
float[] fromDerivedUnit(float[] input, float[] output) throws ConversionExceptionConverts numeric values from the underlying derived unit to this unit. This method might fail even thoughconvertTo()succeeds.- Parameters:
input- The numeric values in the underlying derived unit.output- The equivalent numeric values in this unit. May be same array asinput.- Returns:
output.- Throws:
ConversionException- Can't convert from underlying derived unit.
-
fromDerivedUnit
double[] fromDerivedUnit(double[] input, double[] output) throws ConversionExceptionConverts numeric values from the underlying derived unit to this unit. This method might fail even thoughconvertTo()succeeds.- Parameters:
input- The numeric values in the underlying derived unit.output- The equivalent numeric values in this unit. May be same array asinput.- Returns:
output.- Throws:
ConversionException- Can't convert from underlying derived unit.
-
-