|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.me.nxg.unity.Dimensions
public class Dimensions
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. |
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public Dimensions multiply(Dimensions d)
public static Dimensions multiply(Iterable<Dimensions> dimlist)
public String getUri()
public float[] exponents()
public static Dimensions parse(String dimensionString) throws UnitParserException
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.
dimensionString
- a string composed of a sequence of dimension letters and numbers
UnitParserException
- if the string is malformed
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |