org.encog.parse.units
Class UnitConversion
java.lang.Object
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. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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.
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.