ucar.units
Interface DerivableUnit

All Known Implementing Classes:
BaseUnit, DerivedUnitImpl, LogarithmicUnit, OffsetUnit, ScaledUnit, UnknownUnit

public interface DerivableUnit

Interface for units that can convert numeric values to and from an underlying derived unit.

Version:
$Id: DerivableUnit.java 64 2006-07-12 22:30:50Z edavis $
Author:
Steven R. Emmerson

Method Summary
 double fromDerivedUnit(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.
 float fromDerivedUnit(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.
 DerivedUnit getDerivedUnit()
          Returns the derived unit that underlies this unit.
 double toDerivedUnit(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.
 float toDerivedUnit(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 ConversionException
Converts a numeric value in this unit to the underlying derived unit. This method might fail even though convertTo() 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 ConversionException
Converts a numeric value in this unit to the underlying derived unit. This method might fail even though convertTo() 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 ConversionException
Converts numeric values in this unit to the underlying derived unit. This method might fail even though convertTo() succeeds.

Parameters:
input - The numeric values in this unit.
output - The equivalent numeric values in the underlying derived unit. May be the same array as input.
Returns:
output.
Throws:
ConversionException - Can't convert to derived unit.

toDerivedUnit

double[] toDerivedUnit(double[] input,
                       double[] output)
                       throws ConversionException
Converts numeric values in this unit to the underlying derived unit. This method might fail even though convertTo() succeeds.

Parameters:
input - The numeric values in this unit.
output - The equivalent numeric values in the underlying derived unit. May be the same array as input.
Returns:
output.
Throws:
ConversionException - Can't convert to derived unit.

fromDerivedUnit

float fromDerivedUnit(float amount)
                      throws ConversionException
Converts 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 ConversionException
Converts a numeric value from the underlying derived unit to this unit. This method might fail even though convertTo() 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 ConversionException
Converts numeric values from the underlying derived unit to this unit. This method might fail even though convertTo() succeeds.

Parameters:
input - The numeric values in the underlying derived unit.
output - The equivalent numeric values in this unit. May be same array as input.
Returns:
output.
Throws:
ConversionException - Can't convert from underlying derived unit.

fromDerivedUnit

double[] fromDerivedUnit(double[] input,
                         double[] output)
                         throws ConversionException
Converts numeric values from the underlying derived unit to this unit. This method might fail even though convertTo() succeeds.

Parameters:
input - The numeric values in the underlying derived unit.
output - The equivalent numeric values in this unit. May be same array as input.
Returns:
output.
Throws:
ConversionException - Can't convert from underlying derived unit.


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.