etomica.units
Interface Unit

All Superinterfaces:
Serializable
All Known Implementing Classes:
Ampere, Angstrom, Bar, Barye, Calorie, Candela, CompoundUnit, Coulomb, Count, CubicCentimeter, CubicMeter, Dalton, Debye, Decimal, Degree, Dyne, Electron, ElectronVolt, Erg, Gram, Joule, Kelvin, Liter, LJ.LJUnit, Meter, Mole, Newton, Pascal, Percent, Picosecond, Pixel, Poise, PrefixedUnit, Radian, Second, SimpleUnit, Statcoulomb, UnitRatio, Volt

public interface Unit
extends Serializable

Interface used to specify the physical units to be used when inputting or outputting a quantity. All internal calculations are performed using simulation units, which are all derived from the picosecond, Dalton, and Angstrom. Classes implementing this interface convert the simulation units to a more common unit for interfacing with the user.
I/O classes (normally Device and Display) have associated with them a class that implements the Unit interface. In addition to providing conversions, the unit class also provides textual labels that can be used by a Device or Display to indicate the units is it using.


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.
 

Method Detail

dimension

Dimension dimension()
Returns the dimension of the unit. For example, the dimension of grams is mass.


toSim

double toSim(double x)
Takes the given value in class units (considering prefix) and converts it to simulation units.

Parameters:
x - a value in units of the class
Returns:
the value converted to simulation units

fromSim

double fromSim(double x)
Takes the given value in simulation units and converts it to class units (considering prefix).

Parameters:
x - a value in simulation units
Returns:
the value converted to units of the class

symbol

String symbol()
Returns the symbol of unit, such as "g" for grams.


prefixAllowed

boolean prefixAllowed()
Indicates if the unit is appropriate for use with a prefix.