The Encog Project

org.encog.parse.units
Class UnitConversion

java.lang.Object
  extended by org.encog.parse.units.UnitConversion

public class UnitConversion
extends java.lang.Object

Used to provide unit conversion for the parser.

Author:
jheaton

Constructor Summary
UnitConversion(java.lang.String from, java.lang.String to, double addPreRatio, double addPostRatio, double ratio)
          Used to specify how a unit conversion works.
 
Method Summary
 double convert(double input)
          Perform the conversion.
 double getAddPostRatio()
           
 double getAddPreRatio()
           
 java.lang.String getFrom()
           
 double getRatio()
           
 java.lang.String getTo()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnitConversion

public UnitConversion(java.lang.String from,
                      java.lang.String to,
                      double addPreRatio,
                      double addPostRatio,
                      double ratio)
Used to specify how a unit conversion works.

Parameters:
from - The from unit.
to - The to unit.
addPreRatio - The number to be added before the ratio.
addPostRatio - The number to be added after the ratio.
ratio - The ratio.
Method Detail

convert

public double convert(double input)
Perform the conversion.

Parameters:
input - The number to convert.
Returns:
The converted value.

getAddPostRatio

public double getAddPostRatio()
Returns:
The value to add before the ratio is applied.

getAddPreRatio

public double getAddPreRatio()
Returns:
The value to add after the ratio is applied.

getFrom

public java.lang.String getFrom()
Returns:
The conversion ratio.

getRatio

public double getRatio()
Returns:
The conversion ratio.

getTo

public java.lang.String getTo()
Returns:
The to unit.

The Encog Project