Module platform

Class CompassFormat

java.lang.Object
java.text.Format
java.text.NumberFormat
org.jfree.chart.axis.CompassFormat
All Implemented Interfaces:
Serializable, Cloneable

public class CompassFormat extends NumberFormat
A formatter that displays numbers as directions.
See Also:
  • Field Details

    • directions

      public final String[] directions
      The directions.
  • Constructor Details

    • CompassFormat

      public CompassFormat()
      Creates a new formatter using English identifiers.
    • CompassFormat

      public CompassFormat(String n, String e, String s, String w)
      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

      public CompassFormat(String[] directions)
      Creates a new formatter using the specified identifiers.
      Parameters:
      directions - an array containing 16 strings representing the directions of a compass.
  • Method Details

    • getDirectionCode

      public String getDirectionCode(double direction)
      Returns a string representing the direction.
      Parameters:
      direction - the direction.
      Returns:
      A string.
    • format

      public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos)
      Formats a number into the specified string buffer.
      Specified by:
      format in class NumberFormat
      Parameters:
      number - the number to format.
      toAppendTo - the string buffer.
      pos - the field position (ignored here).
      Returns:
      The string buffer.
    • format

      public StringBuffer format(long number, StringBuffer toAppendTo, FieldPosition pos)
      Formats a number into the specified string buffer.
      Specified by:
      format in class NumberFormat
      Parameters:
      number - the number to format.
      toAppendTo - the string buffer.
      pos - the field position (ignored here).
      Returns:
      The string buffer.
    • parse

      public Number parse(String source, ParsePosition parsePosition)
      This method returns null for all inputs. This class cannot be used for parsing.
      Specified by:
      parse in class NumberFormat
      Parameters:
      source - the source string.
      parsePosition - the parse position.
      Returns:
      null.