edu.asu.cri.MirkE.dataStructures
Class Unit

java.lang.Object
  extended byedu.asu.cri.MirkE.dataStructures.Unit

public class Unit
extends java.lang.Object

Author:
jafaleon

Constructor Summary
protected Unit()
          Parameter-free JavaBean constructor (for Hibernate)
 
Method Summary
 double convertTo(double quantity, Unit resultUnit)
          Method converTo converts the given amount of this unit to its corresponding value measured with the other unit
static Unit createUnit(java.lang.String unitName)
           
static Unit createUnit(java.lang.String unitName, double unitConversionMultiplier, double unitConversionOffset, Unit referenceUnit)
           
static Unit createUnit(java.lang.String unitName, java.lang.String unitAbbreviation, double unitConversionMultiplier, double unitConversionOffset, Unit referenceUnit)
           
 boolean equals(java.lang.Object object)
           
 long getId()
           
 java.lang.String getUnitAbbreviation()
           
 double getUnitConversionMultiplier()
           
 double getUnitConversionOffset()
           
 java.lang.String getUnitField()
           
 java.lang.String getUnitName()
           
 boolean isCompatible(Unit unit)
          Method to know if two units are compatible.
 void setId(long id)
           
protected  void setUnitAbbreviation(java.lang.String unitAbbreviation)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Unit

protected Unit()
Parameter-free JavaBean constructor (for Hibernate)

Method Detail

getId

public long getId()
Returns:
id

setId

public void setId(long id)
Parameters:
id -

getUnitAbbreviation

public java.lang.String getUnitAbbreviation()
Returns:
Returns the unitAbbreviation.

setUnitAbbreviation

protected void setUnitAbbreviation(java.lang.String unitAbbreviation)
Parameters:
unitAbbreviation - The unitAbbreviation to set.

getUnitConversionMultiplier

public double getUnitConversionMultiplier()
Returns:
Returns the unitConversionMultiplier.

getUnitConversionOffset

public double getUnitConversionOffset()
Returns:
Returns the unitConversionOffset.

getUnitField

public java.lang.String getUnitField()
Returns:
Returns the unitField.

getUnitName

public java.lang.String getUnitName()
Returns:
Returns the unitName.

convertTo

public double convertTo(double quantity,
                        Unit resultUnit)
Method converTo converts the given amount of this unit to its corresponding value measured with the other unit

Parameters:
quantity - the amount in this unit
resultUnit - the units in wich the result will be given.
Returns:
the conversion rate from this unit to the resultUnit.

isCompatible

public boolean isCompatible(Unit unit)
Method to know if two units are compatible.

Parameters:
unit - the other unit
Returns:
true if they are compatible.

toString

public java.lang.String toString()
Returns:
stringValue

equals

public boolean equals(java.lang.Object object)
See Also:
Object.equals(java.lang.Object)

createUnit

public static Unit createUnit(java.lang.String unitName)
Parameters:
unitName -
Returns:
an instance of Unit with name unitName

createUnit

public static Unit createUnit(java.lang.String unitName,
                              double unitConversionMultiplier,
                              double unitConversionOffset,
                              Unit referenceUnit)
Parameters:
unitName -
unitConversionMultiplier -
unitConversionOffset -
referenceUnit -
Returns:
an instance of Unit with name unitName = unitConversionMultiplier*referenceUnit + unitConversionOffset

createUnit

public static Unit createUnit(java.lang.String unitName,
                              java.lang.String unitAbbreviation,
                              double unitConversionMultiplier,
                              double unitConversionOffset,
                              Unit referenceUnit)
Parameters:
unitName -
unitAbbreviation -
unitConversionMultiplier -
unitConversionOffset -
referenceUnit -
Returns:
an instance of Unit with name unitName = unitConversionMultiplier*referenceUnit + unitConversionOffset


Copyright © 2004-2005 Arizona State University - Cancer Research Institute - hosted by Sourceforge. All Rights Reserved.