|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.me.nxg.unity.OneUnit
public abstract class OneUnit
A single unit.
The class's instances are immutable.
Method Summary | |
---|---|
abstract UnitDefinition |
getBaseUnitDefinition()
Returns the known base unit. |
abstract String |
getBaseUnitName()
Returns the name of this unit. |
abstract String |
getBaseUnitString()
Returns the base unit string, which will only be non-null if this unit was an unrecognised one. |
abstract Dimensions |
getDimensions()
Return the dimensions of the unit, if it is a recognised one. |
float |
getExponent()
Obtains the power the unit is raised to. |
abstract int |
getPrefix()
Returns the prefix of the unit, as a base-ten log. |
abstract boolean |
isRecognisedUnit(Syntax syntax)
Indicates whether the base unit is one of those recognised within the specification of the given syntax. |
abstract boolean |
isRecommendedUnit(Syntax syntax)
Indicates whether the base unit is one of those recommended within the specification of the given syntax. |
abstract boolean |
satisfiesUsageConstraints(Syntax syntax)
Indicates whether the unit is being used in a way which satisfies any usage constraints. |
abstract String |
toDebugString()
Write out the unit in a testable format. |
abstract String |
toString()
Format this unit in some sort of canonical form. |
abstract String |
toString(Syntax syntax)
Format this unit in some sort of canonical form appropriate to the given syntax. |
abstract String |
unitString(Syntax syntax)
Obtains the string representation of the unit, including prefix, in the given syntax. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public abstract int getPrefix()
public abstract UnitDefinition getBaseUnitDefinition()
getBaseUnitString()
will not.
Note that the 'base unit' is simply the unit without the prefix, and doesn't refer to the fundamental SI base units. Thus in the expression "MW", it is 'W', Watt, that is the base unit.
public abstract String getBaseUnitName()
public abstract String getBaseUnitString()
public abstract Dimensions getDimensions()
public float getExponent()
public abstract boolean isRecognisedUnit(Syntax syntax)
Note that this checks that the unit is a recommended one: we don't (currently) check whether the abbreviation that got us here is a recommended one (for example, "pixel" is a valid FITS/CDS name for pixels, and "pix" is a FITS and OGIP one).
syntax
- one of the syntaxes of Syntax
isRecommendedUnit(uk.me.nxg.unity.Syntax)
public abstract boolean isRecommendedUnit(Syntax syntax)
Note that this checks that the unit is a recommended one: we don't (currently) check whether the abbreviation that got us here is a recommended one (for example, "pixel" is a valid FITS/CDS name for pixels, and "pix" is a FITS and OGIP one).
syntax
- one of the syntaxes of Syntax
isRecognisedUnit(uk.me.nxg.unity.Syntax)
public abstract boolean satisfiesUsageConstraints(Syntax syntax)
An unrecognised unit has no constraints, and so will always satisfy them; this extends to units which are unrecognised in a particular syntax.
syntax
- one of the syntaxes of Syntax
public abstract String toString()
UnitExpr.toString()
.
toString
in class Object
public abstract String toString(Syntax syntax)
UnitExpr.toString()
.
public abstract String unitString(Syntax syntax) throws UnitParserException
syntax
- one of the syntaxes of Syntax
UnitParserException
- if the syntax is unrecognisedpublic abstract String toDebugString()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |