com.timjohnstondev.unitconverter.model
Class PropertyList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<Property>
              extended by com.timjohnstondev.unitconverter.model.PropertyList
All Implemented Interfaces:
Serializable, Cloneable, Iterable<Property>, Collection<Property>, List<Property>, RandomAccess

public class PropertyList
extends ArrayList<Property>

A collection of Propertys and their unit symbols/names from the data source.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
PropertyList()
           
 
Method Summary
 String getConversion(String propertyName, String fromSymbol, String toSymbol)
          Returns the Conversion factor or formula for the given Property for going from one set of units to another.
 List<String> getPropertyNames()
          Returns a list of all the Property names in the data source.
 List<String> getSymbols(String propertyName)
          Returns a list of all the symbols for the given Property in the data source.
 List<String> getSymbols(String property, String fromSymbol)
          Returns a list, minus the symbol provided, of the symbols for the given Property in the data source.
 String getUnitName(String propertyName, String unitSymbol)
          Returns this symbol's name in unabbreviated words for this Property.
 void setUnitSeparator(String symbol)
          Updates the unit separator symbol
 boolean usesMoles(String propertyName)
          Returns true if this Property can do mole to mass and mass to mole unit conversions, else false
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

PropertyList

public PropertyList()
Method Detail

getPropertyNames

public final List<String> getPropertyNames()
Returns a list of all the Property names in the data source. This list is organized by the order the properties appear in the data source.

Returns:
a list of the Property names

getConversion

public final String getConversion(String propertyName,
                                  String fromSymbol,
                                  String toSymbol)
Returns the Conversion factor or formula for the given Property for going from one set of units to another.

Parameters:
propertyName - the name of the Property that will be converted, such as temperature, pressure or length
fromSymbol - the original units
toSymbol - the desired units
Returns:
the Conversion factor or formula to perform the conversion

getSymbols

public final List<String> getSymbols(String propertyName)
Returns a list of all the symbols for the given Property in the data source. The order of the symbols is determined by the underlying Property. This list order was initially based on the order the symbols appear in the data source for the Property.

Parameters:
propertyName - the name of the Property that is the basis for the units
Returns:
a list of the symbols

getSymbols

public final List<String> getSymbols(String property,
                                     String fromSymbol)
Returns a list, minus the symbol provided, of the symbols for the given Property in the data source. The order of the symbols is determined by the underlying Property. This list order was initially based on the order the symbols appear in the data source for this Property.

Parameters:
property - the name of the Property that is the basis for the units
fromSymbol - the symbol to leave out of the list
Returns:
a list of the symbols

getUnitName

public final String getUnitName(String propertyName,
                                String unitSymbol)
Returns this symbol's name in unabbreviated words for this Property.

Parameters:
propertyName - the name of the Property that is the basis for this unit
unitSymbol - the symbol that represents the returned name
Returns:
the name for this symbol

setUnitSeparator

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

Parameters:
symbol - the new unit separator symbol

usesMoles

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

Parameters:
propertyName - name of the property
Returns:
true if this Property can do mole to mass and mass to mole unit conversions, else false


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