JScience v2.0

org.jscience.physics.units
Class Dimension

java.lang.Object
  extended by org.jscience.physics.units.Dimension
All Implemented Interfaces:
java.io.Serializable

public final class Dimension
extends java.lang.Object
implements java.io.Serializable

This class represents an unit dimension. Two units u1 and u2 are compatible if and only if (u1.getDimension() == u2.getDimension())

Version:
1.1 May 24, 2005
Author:
Jean-Marie Dautelle
See Also:
Unit.getDimension(), Serialized Form

Field Summary
static Dimension AMOUNT_OF_SUBSTANCE
          Holds amount of substance dimension (N).
static Dimension ELECTRIC_CURRENT
          Holds electric current dimension (I).
static Dimension LENGTH
          Holds length dimension (L).
static Dimension LUMINOUS_INTENSITY
          Holds luminous intensity dimension (J).
static Dimension MASS
          Holds mass dimension (M).
static Dimension NONE
          Holds dimensionless.
static Dimension TEMPERATURE
          Holds temperature dimension (θ).
static Dimension TIME
          Holds time dimension (T).
 
Constructor Summary
Dimension(char symbol)
          Creates a new dimension associated to the specified symbol.
 
Method Summary
 Dimension divide(Dimension that)
          Returns the quotient of this dimension with the one specified.
 Dimension multiply(Dimension that)
          Returns the product of this dimension with the one specified.
 Dimension pow(int n)
          Returns this dimension raised to an exponent.
protected  java.lang.Object readResolve()
          Overrides readResolve() to ensure that deserialization maintains dimension unicity.
 Dimension root(int n)
          Returns the given root of this dimension.
 java.lang.String toString()
          Returns the standard String representation of this dimenstion.
 Text toText()
          Returns the textual representation of this dimension.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final Dimension NONE
Holds dimensionless.


LENGTH

public static final Dimension LENGTH
Holds length dimension (L).


MASS

public static final Dimension MASS
Holds mass dimension (M).


TIME

public static final Dimension TIME
Holds time dimension (T).


ELECTRIC_CURRENT

public static final Dimension ELECTRIC_CURRENT
Holds electric current dimension (I).


TEMPERATURE

public static final Dimension TEMPERATURE
Holds temperature dimension (θ).


AMOUNT_OF_SUBSTANCE

public static final Dimension AMOUNT_OF_SUBSTANCE
Holds amount of substance dimension (N).


LUMINOUS_INTENSITY

public static final Dimension LUMINOUS_INTENSITY
Holds luminous intensity dimension (J).

Constructor Detail

Dimension

public Dimension(char symbol)
Creates a new dimension associated to the specified symbol.

Parameters:
symbol - the symbol for this dimension.
Throws:
java.lang.IllegalArgumentException - if the specified symbol is already associated to an existing dimension.
Method Detail

multiply

public final Dimension multiply(Dimension that)
Returns the product of this dimension with the one specified.

Parameters:
that - the dimension multiplicand.
Returns:
this * that

divide

public final Dimension divide(Dimension that)
Returns the quotient of this dimension with the one specified.

Parameters:
that - the dimension divisor.
Returns:
this / that

pow

public final Dimension pow(int n)
Returns this dimension raised to an exponent.

Parameters:
n - the exponent.
Returns:
the result of raising this dimension to the exponent.

root

public final Dimension root(int n)
Returns the given root of this dimension.

Parameters:
n - the root's order.
Returns:
the result of taking the given root of this dimension.
Throws:
java.lang.ArithmeticException - if n == 0.

toText

public Text toText()
Returns the textual representation of this dimension.

Returns:
the text representation of this dimension.

toString

public final java.lang.String toString()
Returns the standard String representation of this dimenstion.

Overrides:
toString in class java.lang.Object
Returns:
toText().toString();

readResolve

protected java.lang.Object readResolve()
Overrides readResolve() to ensure that deserialization maintains dimension unicity.

Returns:
a new dimension or an existing dimension.

JScience v2.0

Copyright © 2005 JScience.