Package org.jfree.chart.axis
Class CompassFormat
java.lang.Object
java.text.Format
java.text.NumberFormat
org.jfree.chart.axis.CompassFormat
- All Implemented Interfaces:
Serializable
,Cloneable
A formatter that displays numbers as directions.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.text.NumberFormat
NumberFormat.Field, NumberFormat.Style
-
Field Summary
Fields inherited from class java.text.NumberFormat
FRACTION_FIELD, INTEGER_FIELD
-
Constructor Summary
ConstructorDescriptionCreates 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. -
Method Summary
Modifier and TypeMethodDescriptionformat
(double number, StringBuffer toAppendTo, FieldPosition pos) Formats a number into the specified string buffer.format
(long number, StringBuffer toAppendTo, FieldPosition pos) Formats a number into the specified string buffer.getDirectionCode
(double direction) Returns a string representing the direction.parse
(String source, ParsePosition parsePosition) This method returnsnull
for all inputs.Methods inherited from class java.text.NumberFormat
clone, equals, format, format, format, getAvailableLocales, getCompactNumberInstance, getCompactNumberInstance, 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
Methods inherited from class java.text.Format
format, formatToCharacterIterator, parseObject
-
Field Details
-
directions
The directions.
-
-
Constructor Details
-
CompassFormat
public CompassFormat()Creates a new formatter using English identifiers. -
CompassFormat
Creates a new formatter using the specified identifiers for the base wind directions.- Parameters:
n
- the code for NORTH.e
- the code for EAST.s
- the code for SOUTH.w
- the code for WEST.
-
CompassFormat
Creates a new formatter using the specified identifiers.- Parameters:
directions
- an array containing 16 strings representing the directions of a compass.
-
-
Method Details
-
getDirectionCode
Returns a string representing the direction.- Parameters:
direction
- the direction.- Returns:
- A string.
-
format
Formats a number into the specified string buffer.- Specified by:
format
in classNumberFormat
- Parameters:
number
- the number to format.toAppendTo
- the string buffer.pos
- the field position (ignored here).- Returns:
- The string buffer.
-
format
Formats a number into the specified string buffer.- Specified by:
format
in classNumberFormat
- Parameters:
number
- the number to format.toAppendTo
- the string buffer.pos
- the field position (ignored here).- Returns:
- The string buffer.
-
parse
This method returnsnull
for all inputs. This class cannot be used for parsing.- Specified by:
parse
in classNumberFormat
- Parameters:
source
- the source string.parsePosition
- the parse position.- Returns:
null
.
-