Package uk.me.nxg.unity
Class UnitRepresentation
java.lang.Object
uk.me.nxg.unity.UnitRepresentation
- All Implemented Interfaces:
Iterator<UnitRepresentation>
A description of the way that a unit is represented in a particular syntax.
-
Method Summary
Modifier and TypeMethodDescriptionReturns 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
Indicates whether this syntax deprecates (but still permits) the use of this unit.boolean
Indicates whether this unit may be used with binary prefixes.boolean
Indicates whether this unit may be used with SI prefixes.next()
Returns true ifhasNext()
would succeed.void
remove()
Produce a slightly more detailed representation of the object's fields.toString()
Produce a compact string representation of the unit.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Method Details
-
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. -
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
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 interfaceIterator<UnitRepresentation>
- Returns:
- true if there is a further representation of this unit
-
next
Returns true ifhasNext()
would succeed. return true if hasNext() would succeed.- Specified by:
next
in interfaceIterator<UnitRepresentation>
-
remove
public void remove()- Specified by:
remove
in interfaceIterator<UnitRepresentation>
-