public class CompassFormat extends NumberFormat
NumberFormat.Field
Modifier and Type | Field and Description |
---|---|
String[] |
directions
The directions.
|
FRACTION_FIELD, INTEGER_FIELD
Constructor and Description |
---|
CompassFormat()
Creates a new formatter using English identifiers.
|
CompassFormat(String[] directions)
Creates a new formatter using the specified identifiers.
|
CompassFormat(String n,
String e,
String s,
String w)
Creates a new formatter using the specified identifiers for
the base wind directions.
|
Modifier and Type | Method and Description |
---|---|
StringBuffer |
format(double number,
StringBuffer toAppendTo,
FieldPosition pos)
Formats a number into the specified string buffer.
|
StringBuffer |
format(long number,
StringBuffer toAppendTo,
FieldPosition pos)
Formats a number into the specified string buffer.
|
String |
getDirectionCode(double direction)
Returns a string representing the direction.
|
Number |
parse(String source,
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
format, formatToCharacterIterator, parseObject
public final String[] directions
public CompassFormat()
public CompassFormat(String n, String e, String s, String w)
n
- the code for NORTH.e
- the code for EAST.s
- the code for SOUTH.w
- the code for WEST.public CompassFormat(String[] directions)
directions
- an array containing 16 strings representing
the directions of a compass.public String getDirectionCode(double direction)
direction
- the direction.public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos)
format
in class NumberFormat
number
- the number to format.toAppendTo
- the string buffer.pos
- the field position (ignored here).public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos)
format
in class NumberFormat
number
- the number to format.toAppendTo
- the string buffer.pos
- the field position (ignored here).public Number parse(String source, ParsePosition parsePosition)
null
for all inputs. This class cannot
be used for parsing.parse
in class NumberFormat
source
- the source string.parsePosition
- the parse position.null
.Jas4pp 1.5 © Java Analysis Studio for Particle Physics