etomica.units
Class Prefix

java.lang.Object
  extended by etomica.units.Prefix
All Implemented Interfaces:
Serializable

public abstract class Prefix
extends Object
implements Serializable

Base class for all unit prefixes, such as kilo, micro, nano, etc. A prefix class is specified (with a Unit) to form a PrefixedUnit object. All standard prefixes are available as static fields of this class. These go from YOCTO (10^-24) to YOTTA (10^+24).

See Also:
PrefixedUnit, Serialized Form

Field Summary
static Prefix[] ALL
           
static boolean ALLOWED
          Constant used when invoking constructor of SimpleUnit class to indicate that the unit permits the use of a prefix.
static Prefix ATTO
          Prefix indicating 10-18.
static Prefix CENTI
          Prefix indicating 10-2 = 0.01.
static Prefix DECI
          Prefix indicating 10-1 = 0.1.
static Prefix DEKA
          Prefix indicating 10+1 = 10.
static Prefix EXA
          Prefix indicating 10+18.
static Prefix FEMTO
          Prefix indicating 10-15.
static Prefix GIGA
          Prefix indicating 10+9.
static Prefix HECTO
          Prefix indicating 10+2 = 100.
static Prefix KILO
          Prefix indicating 10+3 = 1000.
static Prefix MEGA
          Prefix indicating 10+6.
static Prefix MICRO
          Prefix indicating 10-6.
static Prefix MILLI
          Prefix indicating 10-3 = 0.001.
static Prefix NANO
          Prefix indicating 10-9.
static boolean NOT_ALLOWED
          Constant used when invoking constructor of SimpleUnit class to indicate that the unit does not permit the use of a prefix.
static Prefix NULL
          Prefix indicating 100 = 1.
static Prefix PETA
          Prefix indicating 10+15.
static Prefix PICO
          Prefix indicating 10-12.
static Prefix TERA
          Prefix indicating 10+12.
static Prefix YOCTO
          Prefix indicating 10-24.
static Prefix YOTTA
          Prefix indicating 10+24.
static Prefix ZEPTO
          Prefix indicating 10-21.
static Prefix ZETTA
          Prefix indicating 10+21.
 
Method Summary
static int intKeySelect(char aKey)
          Returns an integer code corresponding to the prefix for the given key.
static Prefix keySelect(char aKey)
          Returns a prefix corresponding to the given key.
abstract  String symbol()
           
abstract  String toString()
           
abstract  double value()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ALLOWED

public static final boolean ALLOWED
Constant used when invoking constructor of SimpleUnit class to indicate that the unit permits the use of a prefix.

See Also:
Constant Field Values

NOT_ALLOWED

public static final boolean NOT_ALLOWED
Constant used when invoking constructor of SimpleUnit class to indicate that the unit does not permit the use of a prefix.

See Also:
Constant Field Values

YOCTO

public static final Prefix YOCTO
Prefix indicating 10-24.


ZEPTO

public static final Prefix ZEPTO
Prefix indicating 10-21.


ATTO

public static final Prefix ATTO
Prefix indicating 10-18.


FEMTO

public static final Prefix FEMTO
Prefix indicating 10-15.


PICO

public static final Prefix PICO
Prefix indicating 10-12.


NANO

public static final Prefix NANO
Prefix indicating 10-9.


MICRO

public static final Prefix MICRO
Prefix indicating 10-6.


MILLI

public static final Prefix MILLI
Prefix indicating 10-3 = 0.001.


CENTI

public static final Prefix CENTI
Prefix indicating 10-2 = 0.01.


DECI

public static final Prefix DECI
Prefix indicating 10-1 = 0.1.


NULL

public static final Prefix NULL
Prefix indicating 100 = 1.


DEKA

public static final Prefix DEKA
Prefix indicating 10+1 = 10.


HECTO

public static final Prefix HECTO
Prefix indicating 10+2 = 100.


KILO

public static final Prefix KILO
Prefix indicating 10+3 = 1000.


MEGA

public static final Prefix MEGA
Prefix indicating 10+6.


GIGA

public static final Prefix GIGA
Prefix indicating 10+9.


TERA

public static final Prefix TERA
Prefix indicating 10+12.


PETA

public static final Prefix PETA
Prefix indicating 10+15.


EXA

public static final Prefix EXA
Prefix indicating 10+18.


ZETTA

public static final Prefix ZETTA
Prefix indicating 10+21.


YOTTA

public static final Prefix YOTTA
Prefix indicating 10+24.


ALL

public static final Prefix[] ALL
Method Detail

value

public abstract double value()

toString

public abstract String toString()
Overrides:
toString in class Object

symbol

public abstract String symbol()

keySelect

public static Prefix keySelect(char aKey)
Returns a prefix corresponding to the given key. For example, 'm' gives MILLI, 'M' give MEGA, 'f' gives FEMTO, etc. Returns null if the char does not correspond to any prefix.


intKeySelect

public static int intKeySelect(char aKey)
Returns an integer code corresponding to the prefix for the given key. The integers correspond to the index of the prefix in the ALL array. Returns -1 if the char does not correspond to any prefix.