UnitDefinition (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 UnitDefinition

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

All Implemented Interfaces:
  Serializable, Comparable<UnitDefinition>

    public class UnitDefinition

extends Object
implements Serializable, Comparable<UnitDefinition>

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
`int` | `compareTo(UnitDefinition o)`
`String` | `description()` Further remarks about this unit, or other comments
`Dimensions` | `dimensions()` The dimensions of this unit
`boolean` | `equals(Object o)`
`UnitRepresentation` | `getRepresentation()` Return a representation of this unit, from any syntax that knows of one.
`UnitRepresentation` | `getRepresentation(Syntax 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
`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(Syntax 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 `Syntax`
  Returns:
    the syntax details for this unit in this syntax, or null if the syntax is unknown

### getRepresentation

    public UnitRepresentation getRepresentation()

  Return a representation of this unit, from any syntax that knows of one. Since every known unit appears in at least one map, this will never return null.

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `Object`

### compareTo

    public int compareTo(UnitDefinition o)

  Specified by:
    `compareTo` in interface `Comparable<UnitDefinition>`

### 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`

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