uk.me.nxg.unity
Class UnitDefinition

java.lang.Object
  extended by uk.me.nxg.unity.UnitDefinition
All Implemented Interfaces:
Serializable

public class UnitDefinition
extends Object
implements Serializable

Describes a unit.

A 'unit' is a notion like 'metre', or 'pixel', and is not dependent on a particular syntax. The information here includes a readable name for a quantity (such as 'Metre' or 'Julian year'), a URI uniquely naming it, and its dimensions.

The URI unique name is derived from the QUDT framework of quantities, units and dimensions, though it is not restricted to the set of units and quantities defined there.

The syntax-specific aspects of describing units concern how the unit is abbreviated, and indeed whether it is permitted or recommended in a particular syntax, and this is described by the class UnitRepresentation.

See Also:
Serialized Form

Method Summary
 String description()
          Further remarks about this unit, or other comments
 Dimensions dimensions()
          The dimensions of this unit
 UnitRepresentation getRepresentation(String syntax)
          Return the syntax-specific information about this unit.
 String getUri()
          The Kind of this unit, named by a URI
 String latexForm()
          A LaTeX version of the unit symbol, if there is one defined
 String name()
          The name of this unit, for example 'metre'
 String toString()
          Produces a representation of this unit as a string.
 String type()
          A description of the type of this unit, for example 'length'
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

name

public String name()
The name of this unit, for example 'metre'


type

public String type()
A description of the type of this unit, for example 'length'


description

public String description()
Further remarks about this unit, or other comments


latexForm

public String latexForm()
A LaTeX version of the unit symbol, if there is one defined


dimensions

public Dimensions dimensions()
The dimensions of this unit


getUri

public String getUri()
The Kind of this unit, named by a URI

Returns:
a string representing the unit's URI

getRepresentation

public UnitRepresentation getRepresentation(String syntax)
Return the syntax-specific information about this unit. Returns null if the syntax is unknown for this unit, meaning that the given syntax does not recognise this unit as a recommended one.

Parameters:
syntax - a non-null string name for the syntax, which should be one of the syntaxes of UnitParser
Returns:
the syntax details for this unit in this syntax, or null if the syntax is unknown

toString

public String toString()
Produces a representation of this unit as a string. This should not generally be used for formatting expressions: for that, use UnitExpr.toString().

Overrides:
toString in class Object