|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.me.nxg.unity.OneUnit
public class OneUnit
A single unit. For example, the string "m s^-2" will result in two OneUnit instances, corresponding to "m" and "s^-2".
Method Summary | |
---|---|
String |
getBaseUnit()
Returns the base unit for this string, in a default syntax |
String |
getBaseUnit(String syntaxName)
Returns the base unit for this string, in the given syntax |
UnitDefinition |
getBaseUnitDefinition()
|
double |
getExponent()
Obtains the power the unit is raised to. |
double |
getPower()
Returns the power to which this unit is raised. |
int |
getPrefix()
Returns the prefix of the unit, as a base-ten log. |
boolean |
isRecognisedUnit(String syntax)
Indicates whether the base unit is one of those recognised within the specification of the given syntax. |
boolean |
isRecommendedUnit(String syntax)
Indicates whether the base unit is one of those recommended within the specification of the given syntax. |
boolean |
satisfiesUsageConstraints(String syntax)
Indicates whether the unit is being used in a way which satisfies any usage constraints. |
String |
toDebugString()
Write out the unit in a testable format. |
String |
toString()
Format this unit in some sort of canonical form. |
String |
unitString()
Obtains the string form of the unit, including prefix, with a default syntax. |
String |
unitString(String syntaxName)
Obtains the string form 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 int getPrefix()
public double getPower()
public String toString()
UnitExpr.toString()
.
toString
in class Object
public String unitString(String syntaxName)
public UnitDefinition getBaseUnitDefinition()
public String getBaseUnit()
public String getBaseUnit(String syntaxName)
syntaxName
- one of the syntaxes of UnitParser
public String unitString()
public double getExponent()
public boolean isRecognisedUnit(String 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 UnitParser
isRecommendedUnit(java.lang.String)
public boolean isRecommendedUnit(String 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 UnitParser
isRecognisedUnit(java.lang.String)
public boolean satisfiesUsageConstraints(String 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 UnitParser
public String toDebugString()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |