public class CompassFormat extends java.text.NumberFormat
Modifier and Type | Field and Description |
---|---|
java.lang.String[] |
directions
The directions.
|
Constructor and Description |
---|
CompassFormat()
Creates a new formatter using English identifiers.
|
CompassFormat(java.lang.String[] directions)
Creates a new formatter using the specified identifiers.
|
CompassFormat(java.lang.String n,
java.lang.String e,
java.lang.String s,
java.lang.String w)
Creates a new formatter using the specified identifiers for
the base wind directions.
|
Modifier and Type | Method and Description |
---|---|
java.lang.StringBuffer |
format(double number,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Formats a number into the specified string buffer.
|
java.lang.StringBuffer |
format(long number,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Formats a number into the specified string buffer.
|
java.lang.String |
getDirectionCode(double direction)
Returns a string representing the direction.
|
java.lang.Number |
parse(java.lang.String source,
java.text.ParsePosition parsePosition)
This method returns
null for all inputs. |
clone, equals, format, format, format, getAvailableLocales, getCurrency, getCurrencyInstance, getCurrencyInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getMaximumFractionDigits, getMaximumIntegerDigits, getMinimumFractionDigits, getMinimumIntegerDigits, getNumberInstance, getNumberInstance, getPercentInstance, getPercentInstance, getRoundingMode, hashCode, isGroupingUsed, isParseIntegerOnly, parse, parseObject, setCurrency, setGroupingUsed, setMaximumFractionDigits, setMaximumIntegerDigits, setMinimumFractionDigits, setMinimumIntegerDigits, setParseIntegerOnly, setRoundingMode
public final java.lang.String[] directions
public CompassFormat()
public CompassFormat(java.lang.String n, java.lang.String e, java.lang.String s, java.lang.String w)
n
- the code for NORTH.e
- the code for EAST.s
- the code for SOUTH.w
- the code for WEST.public CompassFormat(java.lang.String[] directions)
directions
- an array containing 16 strings representing
the directions of a compass.public java.lang.String getDirectionCode(double direction)
direction
- the direction.public java.lang.StringBuffer format(double number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
format
in class java.text.NumberFormat
number
- the number to format.toAppendTo
- the string buffer.pos
- the field position (ignored here).public java.lang.StringBuffer format(long number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
format
in class java.text.NumberFormat
number
- the number to format.toAppendTo
- the string buffer.pos
- the field position (ignored here).public java.lang.Number parse(java.lang.String source, java.text.ParsePosition parsePosition)
null
for all inputs. This class cannot
be used for parsing.parse
in class java.text.NumberFormat
source
- the source string.parsePosition
- the parse position.null
.