Package ucar.units
Class ConverterImpl
- java.lang.Object
-
- ucar.units.ConverterImpl
-
- All Implemented Interfaces:
Converter
- Direct Known Subclasses:
TimeScaleUnit.MyConverter,UnitImpl.MyConverter
public abstract class ConverterImpl extends Object implements Converter
Provides support for implementations of unit converters. A unit converter class may be created by subclassing this class and implementing the methodsconvert(double),convert(float[] input, float[] output), andconvert(double[] input, double[] output)of interfaceConverter.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedConverterImpl(Unit fromUnit, Unit toUnit)Constructs from a "from" unit and a "to" unit.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]convert(double[] amounts)Converts an array of numeric values.floatconvert(float amount)Converts a numeric value.float[]convert(float[] amounts)Converts an array of numeric values.static Convertercreate(Unit fromUnit, Unit toUnit)Factory method for creating a unit converter.
-
-
-
Constructor Detail
-
ConverterImpl
protected ConverterImpl(Unit fromUnit, Unit toUnit) throws ConversionException
Constructs from a "from" unit and a "to" unit.- Parameters:
fromUnit- The unit from which to convert.toUnit- The unit to which to convert.- Throws:
ConversionException- The units are not convertible.
-
-
Method Detail
-
create
public static Converter create(Unit fromUnit, Unit toUnit) throws ConversionException
Factory method for creating a unit converter.- Parameters:
fromUnit- The unit from which to convert.toUnit- The unit to which to convert.- Throws:
ConversionException- The units are not convertible.
-
convert
public final float convert(float amount)
Converts a numeric value.
-
convert
public final float[] convert(float[] amounts)
Converts an array of numeric values.
-
-