@Test public void test_float_match() { assertThat(format( 1.0, "1[yes]"), is("yes")); assertThat(format( 1.0, "+1[yes]"), is("yes")); assertThat(format(-1.0, "-1[yes]"), is("yes")); assertThat(format( 1.0, "0[yes]"), is("")); assertThat(format( 1.0, "1.0[yes]"), is("yes")); assertThat(format( NaN, "NaN[yes]"), is("yes")); assertThat(format( Inf, "Infinity[yes]"), is("yes")); assertThat(format(-Inf,"-Infinity[yes]"), is("yes")); }
@Override public int format(FormatterAPI formatter, Object value, Locale locale, String flags, int width, int precision, String formatString, int position) throws IOException { ensureNoWidth(width); ensureNoPrecision(precision); ensureNoFlags(flags); return new Conditional(formatter, value, formatString, position).apply() - position; }
ConditionalConversion extends FormatConversionBase { @Override public int format(FormatterAPI formatter, Object value, Locale locale, String flags, int width, int precision, String formatString, int position) throws IOException { ensureNoWidth(width); ensureNoPrecision(precision); ensureNoFlags(flags); return new Conditional(formatter, value, formatString, position).apply() - position; } }
ConditionalConversion extends FormatConversionBase { @Override public int format(FormatterAPI formatter, Object value, Locale locale, String flags, int width, int precision, String formatString, int position) throws IOException { ensureNoWidth(width); ensureNoPrecision(precision); ensureNoFlags(flags); return new Conditional(formatter, value, formatString, position).apply() - position; }  }
ConditionalConversion extends FormatConversionBase { @Override public int format(FormatterAPI formatter, Object value, Locale locale, String flags, int width, int precision, String formatString, int position) throws IOException { ensureNoWidth(width); ensureNoPrecision(precision); ensureNoFlags(flags); return new Conditional(formatter, value, formatString, position).apply() - position; }  void register(FormatterConfiguration conf); @Override int format(FormatterAPI formatter, Object value, Locale locale, String flags, int width, int precision, String formatString, int position); }
ConditionalConversion extends FormatConversionBase { @Override public int format(FormatterAPI formatter, Object value, Locale locale, String flags, int width, int precision, String formatString, int position) throws IOException { ensureNoWidth(width); ensureNoPrecision(precision); ensureNoFlags(flags); return new Conditional(formatter, value, formatString, position).apply() - position; }  void register(FormatterConfiguration conf); @Override int format(FormatterAPI formatter, Object value, Locale locale, String flags, int width, int precision, String formatString, int position); static final ConditionalConversion INSTANCE; }