com.timjohnstondev.unitconverter.model
Class ConversionFormula

java.lang.Object
  extended by com.timjohnstondev.unitconverter.model.ConversionFormula
All Implemented Interfaces:
Conversion

public class ConversionFormula
extends Object
implements Conversion

This is a unit of measure with its related conversion formula to another unit.


Constructor Summary
ConversionFormula(String newUnitName, String newUnitSymbol, String newToUnitSymbol, String newFormula)
          Constructs a ConversionFormula setting its name, symbol, to-symbol and formula.
 
Method Summary
 String getConversion()
          Returns this Conversion's factor or formula used to convert from one set of units to another.
 String getFormattedUnitSymbol()
          Returns the html formatted unit symbol (used to show exponents correctly) for this Conversion.
 String getToUnitSymbol()
          Returns the raw text symbol for the unit being converted to.
 String getUnitName()
          Returns this symbol's name in unabbreviated words for this Conversion.
 String getUnitSymbol()
          Returns the raw text unit symbol for this Conversion.
 void setUnitSeparator(String symbol)
          Updates the unit separator symbol
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConversionFormula

public ConversionFormula(String newUnitName,
                         String newUnitSymbol,
                         String newToUnitSymbol,
                         String newFormula)
Constructs a ConversionFormula setting its name, symbol, to-symbol and formula.

Parameters:
newUnitName - the name of the unit in unabbreviated words
newUnitSymbol - the symbol of the unit
newToUnitSymbol - the symbol of the unit to be converted to
newFormula - the formula to perform the conversion
Method Detail

getUnitName

public final String getUnitName()
Description copied from interface: Conversion
Returns this symbol's name in unabbreviated words for this Conversion.

Specified by:
getUnitName in interface Conversion
Returns:
the name for this symbol

getToUnitSymbol

public final String getToUnitSymbol()
Returns the raw text symbol for the unit being converted to.

Returns:
the unit symbol

getUnitSymbol

public final String getUnitSymbol()
Description copied from interface: Conversion
Returns the raw text unit symbol for this Conversion.

Specified by:
getUnitSymbol in interface Conversion
Returns:
the unit symbol

getFormattedUnitSymbol

public final String getFormattedUnitSymbol()
Description copied from interface: Conversion
Returns the html formatted unit symbol (used to show exponents correctly) for this Conversion.

Specified by:
getFormattedUnitSymbol in interface Conversion
Returns:
the html formatted unit symbol

getConversion

public final String getConversion()
Description copied from interface: Conversion
Returns this Conversion's factor or formula used to convert from one set of units to another.

Specified by:
getConversion in interface Conversion
Returns:
this Conversion's factor or formula to perform the conversion

setUnitSeparator

public final void setUnitSeparator(String symbol)
Description copied from interface: Conversion
Updates the unit separator symbol

Specified by:
setUnitSeparator in interface Conversion
Parameters:
symbol - the new unit separator symbol


Copyright © 2009 Tim Johnston Development, LLC. All Rights Reserved.