|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.me.nxg.unity.UnitDefinition
public class UnitDefinition
Describes a unit.
A 'unit' is a notion like 'metre', or 'pixel', and is not
dependent on a particular syntax. The syntax-specific aspects of
this (described by UnitDefinition.Syntax
) are how the unit
is abbreviated, and indeed whether it is permitted in that syntax.
Nested Class Summary | |
---|---|
class |
UnitDefinition.Syntax
Describes the per-syntax information about a unit. |
Constructor Summary | |
---|---|
UnitDefinition(String name,
String type,
String notes,
String latexForm)
|
Method Summary | |
---|---|
boolean |
addSyntax(String syntax,
String abbrev,
String syntaxSpec)
Add a new syntax to this unit definition. |
UnitDefinition.Syntax |
getSyntax(String syntax)
Return the syntax-specific information about this unit. |
Set<String> |
getSyntaxes()
Produces a set of the syntax names for this unit |
String |
latexForm()
A LaTeX version of the unit abbrev, or null if a syntax-specific abbrev should be used |
String |
name()
The name of this unit, for example 'metre' |
String |
notes()
Further remarks about this unit, or other comments |
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 |
Constructor Detail |
---|
public UnitDefinition(String name, String type, String notes, String latexForm)
Method Detail |
---|
public String name()
public String type()
public String notes()
public String latexForm()
public UnitDefinition.Syntax getSyntax(String syntax)
As a special case, if the syntax is given as
null
, then return any syntax (the
caller is presumably scratching around for something to print).
syntax
- a string name for the syntax, which should be one
of the syntaxes of UnitParser
, or null if we want any
syntax at all
public Set<String> getSyntaxes()
public String toString()
UnitExpr.toString()
.
toString
in class Object
public boolean addSyntax(String syntax, String abbrev, String syntaxSpec) throws UnitParserException
This is not generally useful for clients -- it is intended for use while building the package.
syntax
- the syntax being updated (eg "fits")abbrev
- the permissible name for this unit in this syntax (eg "m" for metre)syntaxSpec
- a string describing the syntax
UnitParserException
- if the syntax is not a recognised one
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |