@Test public void testDefaultConstructor() { final CompassFormat fmt = new CompassFormat(); assertEquals("N", fmt.getDirectionCode(0)); assertEquals("N", fmt.getDirectionCode(360)); }
public String getDirectionCode(double direction) { direction = direction % 360; if (direction < 0.0) { direction = direction + 360.0; } int index = ((int) Math.floor(direction / 11.25) + 1) / 2; return directions[index]; }
CompassFormat extends NumberFormat { public String getDirectionCode(double direction) { direction = direction % 360; if (direction < 0.0) { direction = direction + 360.0; } int index = ((int) Math.floor(direction / 11.25) + 1) / 2; return directions[index]; } }
CompassFormat extends NumberFormat { public String getDirectionCode(double direction) { direction = direction % 360; if (direction < 0.0) { direction = direction + 360.0; } int index = ((int) Math.floor(direction / 11.25) + 1) / 2; return directions[index]; } CompassFormat();  CompassFormat(String n, String e, String s, String w);  CompassFormat(String[] directions); }
CompassFormat extends NumberFormat { public String getDirectionCode(double direction) { direction = direction % 360; if (direction < 0.0) { direction = direction + 360.0; } int index = ((int) Math.floor(direction / 11.25) + 1) / 2; return directions[index]; } CompassFormat();  CompassFormat(String n, String e, String s, String w);  CompassFormat(String[] directions); String getDirectionCode(double direction); @Override StringBuffer format(double number, StringBuffer toAppendTo,
                               FieldPosition pos); @Override StringBuffer format(long number, StringBuffer toAppendTo,
                               FieldPosition pos); @Override Number parse(String source, ParsePosition parsePosition); }
CompassFormat extends NumberFormat { public String getDirectionCode(double direction) { direction = direction % 360; if (direction < 0.0) { direction = direction + 360.0; } int index = ((int) Math.floor(direction / 11.25) + 1) / 2; return directions[index]; } CompassFormat();  CompassFormat(String n, String e, String s, String w);  CompassFormat(String[] directions); String getDirectionCode(double direction); @Override StringBuffer format(double number, StringBuffer toAppendTo,
                               FieldPosition pos); @Override StringBuffer format(long number, StringBuffer toAppendTo,
                               FieldPosition pos); @Override Number parse(String source, ParsePosition parsePosition); final String[] directions; }