|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectetomica.units.SimpleUnit
public class SimpleUnit
Superclass for all base unit classes. These classes provide a means for
indicating the physical units of a given quantity, and present methods for
converting between units. A BaseUnit can be used as is, or combined with a
Prefix to form a PrefixedUnit. Units are employed by I/O classes (usually a
Device or Display) to handle unit conversions and labeling of graphic
elements.
By convention, each subclass of any base unit will contain a static field
named UNIT, which is a handle to an instance of that unit. One can access an
instance of any unit class through this static member.
Each general base unit type (i.e., dimension) is defined as an abstract
class. Each of these abstract classes contains an inner static subclass
(named Sim) that defines the unit as derived from the basic simulation units
(Dalton-A-ps) Thus an instance of the base simulation units for any
dimensioned quantity can be accessed by the handle BaseUnit.Energy.Sim.UNIT
(e.g. for the energy unit).
| Constructor Summary | |
|---|---|
SimpleUnit(Dimension dimension,
double toSim,
String name,
String symbol,
boolean prefixAllowed)
Constructor. |
|
| Method Summary | |
|---|---|
Dimension |
dimension()
Returns the dimension of this base unit. |
double |
fromSim(double x)
Takes the given value in simulation units and converts it to class units. |
boolean |
prefixAllowed()
Returns flag indicating whether a prefix is allowed with this unit. |
String |
symbol()
Accessor for symbol of unit |
double |
toSim(double x)
Takes the given value in class units and converts it to simulation units. |
String |
toString()
Accessor for common name of unit |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleUnit(Dimension dimension,
double toSim,
String name,
String symbol,
boolean prefixAllowed)
to - conversion factor from this unit to simulation unitsname - string describing this unitsymbol - symbol for this unitprefixAllowed - flag indicating if this unit is suitable for use with a prefix
(e.g., kilo, nano)| Method Detail |
|---|
public Dimension dimension()
dimension in interface Unitpublic final double toSim(double x)
toSim in interface Unitx - a value in units of this class
public final double fromSim(double x)
fromSim in interface Unitx - a value in simulation units
public String toString()
toString in class Objectpublic String symbol()
symbol in interface Unitpublic boolean prefixAllowed()
prefixAllowed in interface Unit
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||