etomica.units
Class Dimension

java.lang.Object
  extended by etomica.units.Dimension
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Angle, Area, Charge, CompoundDimension, Current, DimensionRatio, Dipole, ElectricPotential, Energy, Force, Fraction, Length, LuminousIntensity, Mass, Null, Pressure, Pressure2D, Quantity, Temperature, Time, Undefined, Viscosity, Volume

public class Dimension
extends Object
implements Serializable

Parent of all Dimension classes, which describe the physical dimensions (e.g., mass, length, force) of a quantity. All dimensions are derived from seven base dimensions (length, mass, time, electrical current, temperature, number or mole, and luminosity). Dimension is coded as a "signature", which is an array of seven value that are the exponents of these base dimensions forming the specified dimension.

See Also:
Serialized Form

Field Summary
static Dimension MIXED
          Dimension used to indicate that a group of values are not all of the same dimension.
static int N_BASE
          Number of base dimensions, equal to seven.
 
Constructor Summary
Dimension(String name, double[] signature)
           
Dimension(String name, double length, double mass, double time)
           
Dimension(String name, double length, double mass, double time, double current, double temperature, double number, double luminosity)
           
 
Method Summary
 boolean equals(Object dim)
          Returns true if the given object is a Dimension instance with the same signature as this.
 Unit getUnit(UnitSystem unitSystem)
          Returns the unit of this dimension as derived in the given system of units.
static Dimension introspect(Object obj, String property, BeanInfo beaninfo)
          Method to determine the dimension of a property via introspection.
 double[] signature()
          The signature is the exponents of each of the base dimensions forming the given dimension.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

N_BASE

public static final int N_BASE
Number of base dimensions, equal to seven. Base dimensions are: length, mass, time, current, temperature, number, luminosity.

See Also:
Constant Field Values

MIXED

public static Dimension MIXED
Dimension used to indicate that a group of values are not all of the same dimension. Singleton. The equals method for this instance returns true only if its argument is the same instance.

Constructor Detail

Dimension

public Dimension(String name,
                 double length,
                 double mass,
                 double time)

Dimension

public Dimension(String name,
                 double length,
                 double mass,
                 double time,
                 double current,
                 double temperature,
                 double number,
                 double luminosity)

Dimension

public Dimension(String name,
                 double[] signature)
Method Detail

getUnit

public Unit getUnit(UnitSystem unitSystem)
Returns the unit of this dimension as derived in the given system of units. Default constructs a CompoundUnit using the base units of the unit system.


toString

public String toString()
Overrides:
toString in class Object

signature

public double[] signature()
The signature is the exponents of each of the base dimensions forming the given dimension. Base dimensions are, in order: length, mass, time, current, temperature, number, luminosity.


equals

public boolean equals(Object dim)
Returns true if the given object is a Dimension instance with the same signature as this.

Overrides:
equals in class Object

introspect

public static Dimension introspect(Object obj,
                                   String property,
                                   BeanInfo beaninfo)
Method to determine the dimension of a property via introspection.

Parameters:
obj - an instance of the object having the property of interest
property - the name of the property, such that getPROPERTYDimension would return the dimension of the property
beaninfo - BeanInfo class obtained by prior introspection of the object