com.timjohnstondev.unitconverter.model
Class Property

java.lang.Object
  extended by com.timjohnstondev.unitconverter.model.Property
All Implemented Interfaces:
Comparable<Property>

public class Property
extends Object
implements Comparable<Property>

A Property, such as temperature, pressure or length, has units and conversion factors or formulas to convert between the different units.


Constructor Summary
Property(String newName, boolean isFormulaBased, boolean canUseMoles)
          Constructs a Property with the given name and specifies if it uses formulas or factors for unit conversion.
 
Method Summary
 void addConversion(Conversion conversion)
          Adds a Conversion which is a formula or factor that is used to perform unit conversions.
 int compareTo(Property prop)
           
 String getName()
          Returns this Property's name
 int getOrder()
          Returns this Property's sort order
 boolean hasFormula()
          Returns true if this Property uses formulas for unit conversion, else false
 void setOrder(int newOrder)
          Sets this Property's sort order
 void setUnitSeparator(String symbol)
          Updates the unit separator symbol
 boolean usesMoles()
          Returns true if this Property can do mole to mass and mass to mole unit conversions, else false
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Property

public Property(String newName,
                boolean isFormulaBased,
                boolean canUseMoles)
Constructs a Property with the given name and specifies if it uses formulas or factors for unit conversion.

Parameters:
newName - the descriptive name of this Property
isFormulaBased - determines if this Property will use formulas or factors for unit conversion
canUseMoles - determines if this Property can do mole to mass and mass to mole unit conversions
Method Detail

getOrder

public final int getOrder()
Returns this Property's sort order

Returns:
the sort order of this property

setOrder

public final void setOrder(int newOrder)
Sets this Property's sort order

Parameters:
newOrder - the new sort order of this property

getName

public final String getName()
Returns this Property's name

Returns:
the name of this property

usesMoles

public final boolean usesMoles()
Returns true if this Property can do mole to mass and mass to mole unit conversions, else false

Returns:
true if this Property can do mole to mass and mass to mole unit conversions, else false

hasFormula

public final boolean hasFormula()
Returns true if this Property uses formulas for unit conversion, else false

Returns:
true if this Property uses formulas for unit conversion, else false

addConversion

public final void addConversion(Conversion conversion)
Adds a Conversion which is a formula or factor that is used to perform unit conversions.

Parameters:
conversion - factor or formula to perform the conversion

setUnitSeparator

public final void setUnitSeparator(String symbol)
Updates the unit separator symbol

Parameters:
symbol - the new unit separator symbol

compareTo

public final int compareTo(Property prop)
Specified by:
compareTo in interface Comparable<Property>


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