Dimensions (The Unity library)
Date: 2014-05-13

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uk.me.nxg.unity
Class Dimensions

    java.lang.Object
      uk.me.nxg.unity.Dimensions

    public class Dimensions

extends Object

A dimensions specification is a record of the measurement dimensions of a quantity.

This is derived from the QUDT framework of quantities, units and dimensions, although it is not necessary to be familiar with that framework in order to use the Dimensions class. The methods here are primarily intended to be used to query the dimensions of an existing object, but there is a parser to create new dimension quantities, should that be necessary.

The known dimensions are

Symbol | Name | SI base unit
--- | --- | ---
U | Dimensionless | Unity
L | Length | Metre
M | Mass | Kilogramme
T | Time | Second
I | Electric current | Ampère
Θ | Thermodynamic temperature | Kelvin
N | Amount of substance | Mole
J | Luminous intensity | Candela

Method Summary
`float[]` | `exponents()` Return the numerical dimensions of the quantities in the expression.
`String` | `getURI()` Return a URI naming one of the dimensions in the QUDT dimensions ontology.
`Dimensions` | `multiply(Dimensions d)` Respond with a Dimensions object which is the result of multiplying the dimensions of this object by the dimensions of another.
`Dimensions` | `multiply(Dimensions d, float pow)` Respond with a Dimensions object which is the result of multiplying the dimensions of this object by the dimensions of another raised to the given power.
`static Dimensions` | `multiply(Iterable<Dimensions> dimlist)` Multiplies several dimensions together, and returns a (new) object representing the dimensions of the result.
`static Dimensions` | `parse(String dimensionString)` Parse a dimension string to produce a new dimension object.
`String` | `toString()` Return a string representation of the dimension.
`static Dimensions` | `unity()` Returns a new Dimensions object representing 1.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Method Detail

### unity

    public static final Dimensions unity()

  Returns a new Dimensions object representing 1.

### multiply

    public Dimensions multiply(Dimensions d)

  Respond with a Dimensions object which is the result of multiplying the dimensions of this object by the dimensions of another. This will be a new object, if the resulting dimensions are different.

### multiply

    public Dimensions multiply(Dimensions d,
                               float pow)

  Respond with a Dimensions object which is the result of multiplying the dimensions of this object by the dimensions of another raised to the given power. This will be a new object, if the resulting dimensions are different.

### multiply

    public static Dimensions multiply(Iterable<Dimensions> dimlist)

  Multiplies several dimensions together, and returns a (new) object representing the dimensions of the result. If any of the Dimensions in the list are null, the result is null (and not an error)

### getURI

    public String getURI()

  Return a URI naming one of the dimensions in the QUDT dimensions ontology. We construct this based on the dimensions of the current quantity, using the QUDT system, rather than looking it up; it's therefore possible to construct a dimension which isn't included in that set.

### toString

    public String toString()

  Return a string representation of the dimension. The format of this string is not specified here, but it is intended to be (roughly) human-readable.

  Overrides:
    `toString` in class `Object`

### exponents

    public float[] exponents()

  Return the numerical dimensions of the quantities in the expression. The result is an array of the exponents of the base dimensions, in the order 'U', 'L', 'M', 'T', 'I', 'Θ', 'N', 'J'.

### parse

    public static Dimensions parse(String dimensionString)
                            throws UnitParserException

  Parse a dimension string to produce a new dimension object. If the string is not parseable, throw an exception.

  A dimensions string consists of a sequence of capital letter dimensions, and powers, for example "M L2T-2" for the dimensions of "kg m2 s-2". The dimensions are as discussed in the class overview above.

  Since the domain is so restricted, the parsing can be very liberal, and everything which isn't a letter, or part of a number, is ignored (for example '^'). That means, by the way, that a string like 'ML2/T2' wouldn't have the same dimensions as the example above. If any letters appear which are not one of the known dimension letters, we throw an exception.

  Parameters:
    `dimensionString` - a string composed of a sequence of dimension letters and numbers
  Throws:
    `UnitParserException` - if the string is malformed

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD