etomica.units
Class CompoundUnit

java.lang.Object
  extended by etomica.units.CompoundUnit
All Implemented Interfaces:
Unit, Serializable
Direct Known Subclasses:
UnitRatio

public class CompoundUnit
extends Object
implements Unit

See Also:
Serialized Form

Constructor Summary
CompoundUnit(Unit[] units, double[] exponents)
           
CompoundUnit(Unit[] units, double[] exponents, String name, String symbol)
           
 
Method Summary
 Dimension dimension()
          Returns the dimension of the unit.
 double fromSim(double x)
          Takes the given value in simulation units and converts it to class units (considering prefix).
 boolean prefixAllowed()
          Indicates if the unit is appropriate for use with a prefix.
 String symbol()
          Returns the symbol of unit, such as "g" for grams.
 double toSim(double x)
          Takes the given value in class units (considering prefix) and converts it to simulation units.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompoundUnit

public CompoundUnit(Unit[] units,
                    double[] exponents)

CompoundUnit

public CompoundUnit(Unit[] units,
                    double[] exponents,
                    String name,
                    String symbol)
Method Detail

dimension

public Dimension dimension()
Description copied from interface: Unit
Returns the dimension of the unit. For example, the dimension of grams is mass.

Specified by:
dimension in interface Unit

toSim

public double toSim(double x)
Description copied from interface: Unit
Takes the given value in class units (considering prefix) and converts it to simulation units.

Specified by:
toSim in interface Unit
Parameters:
x - a value in units of the class
Returns:
the value converted to simulation units

fromSim

public double fromSim(double x)
Description copied from interface: Unit
Takes the given value in simulation units and converts it to class units (considering prefix).

Specified by:
fromSim in interface Unit
Parameters:
x - a value in simulation units
Returns:
the value converted to units of the class

symbol

public String symbol()
Description copied from interface: Unit
Returns the symbol of unit, such as "g" for grams.

Specified by:
symbol in interface Unit

prefixAllowed

public boolean prefixAllowed()
Description copied from interface: Unit
Indicates if the unit is appropriate for use with a prefix.

Specified by:
prefixAllowed in interface Unit