Package uk.me.nxg.unity
Class UnitRepresentation
- java.lang.Object
-
- uk.me.nxg.unity.UnitRepresentation
-
- All Implemented Interfaces:
java.util.Iterator<UnitRepresentation>
public class UnitRepresentation extends java.lang.Object implements java.util.Iterator<UnitRepresentation>
A description of the way that a unit is represented in a particular syntax.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getAbbreviation()
Returns a symbolic abbreviation for this unit in this syntax.boolean
hasNext()
If there is more than one representation for this unit in this syntax, then this will return the next one.boolean
isDeprecated()
Indicates whether this syntax deprecates (but still permits) the use of this unit.boolean
mayHaveBinaryPrefixes()
Indicates whether this unit may be used with binary prefixes.boolean
mayHaveSIPrefixes()
Indicates whether this unit may be used with SI prefixes.UnitRepresentation
next()
Returns true ifhasNext()
would succeed.void
remove()
java.lang.String
toDebugString()
Produce a slightly more detailed representation of the object's fields.java.lang.String
toString()
Produce a compact string representation of the unit.
-
-
-
Method Detail
-
toString
public java.lang.String toString()
Produce a compact string representation of the unit. This is intended to be a human-readable unit string, such as"m"
for metres. If, however, you wish to get a unit-string representation of a unit expression, do not construct it yourself using this method, but instead useUnitExpr.toString()
, the output of which may differ from the output of this method in certain circumstances.- Overrides:
toString
in classjava.lang.Object
-
toDebugString
public java.lang.String toDebugString()
Produce a slightly more detailed representation of the object's fields. This is mostly for debugging purposes, and the format of the string is not necessarily stable.- Returns:
- a string with developer-ready extra information
-
mayHaveSIPrefixes
public boolean mayHaveSIPrefixes()
Indicates whether this unit may be used with SI prefixes.- Returns:
- true if this unit may have SI prefixes
-
mayHaveBinaryPrefixes
public boolean mayHaveBinaryPrefixes()
Indicates whether this unit may be used with binary prefixes.- Returns:
- true if this unit may have binary prefixes
-
isDeprecated
public boolean isDeprecated()
Indicates whether this syntax deprecates (but still permits) the use of this unit.- Returns:
- true if use of this unit is deprecated
-
getAbbreviation
public java.lang.String getAbbreviation()
Returns a symbolic abbreviation for this unit in this syntax. For example, it might return "m" for Metres.- Returns:
- a string abbreviation for this unit
-
hasNext
public boolean hasNext()
If there is more than one representation for this unit in this syntax, then this will return the next one.- Specified by:
hasNext
in interfacejava.util.Iterator<UnitRepresentation>
- Returns:
- true if there is a further representation of this unit
-
next
public UnitRepresentation next()
Returns true ifhasNext()
would succeed. return true if hasNext() would succeed.- Specified by:
next
in interfacejava.util.Iterator<UnitRepresentation>
-
remove
public void remove()
- Specified by:
remove
in interfacejava.util.Iterator<UnitRepresentation>
-
-