@Override protected Percentage doRestore(final String data) { return new Percentage(Float.valueOf(data).floatValue()); }
public Percentage multiply(final float value) { return new Percentage((floatValue() * value)); }
public Percentage subtract(final Percentage value) { return add(-value.floatValue()); }
@Override public int hashCode() { // multiply by 100 just in case the percentage is being stored as 0.0 to // 1.0 return (int) (floatValue() * 100); }
@Override public boolean equals(final Object other) { if (this == other) { return true; } if (other == null) { return false; } return other.getClass() == this.getClass() && equals((Percentage) other); }
public Percentage subtract(final float value) { return add(-value); }
@Override public int hashCode() { // multiply by 100 just in case the percentage is being stored as 0.0 to // 1.0 return (int) (floatValue() * 100); }
@Override public boolean equals(final Object other) { if (this == other) { return true; } if (other == null) { return false; } return other.getClass() == this.getClass() && equals((Percentage) other); }
public Percentage subtract(final float value) { return add(-value); }
TableColumnModel model = table.getColumnModel(); model.getColumn(0).setCellRenderer(new LineNumberRenderer()); model.getColumn(1).setCellRenderer(new ErrorRenederer()); model.getColumn(2).setCellRenderer(new FixProposedRenderer()); model.getColumn(3).setCellRenderer(new Percentage());
public Percentage add(final float value) { return new Percentage((floatValue() + value)); }
public Percentage add(final Percentage value) { return add(value.floatValue()); }
@Override protected String doEncode(final Object object) { final Percentage per = (Percentage) object; return String.valueOf(per.floatValue()); }
@Test public void testEquals() { assertEquals(p1, p2); assertNotSame(p1, p2); assertFalse(p1.equals(p3)); }
@Override protected Percentage doParse(final Object context, final String text) { try { return new Percentage(new Float(format.parse(text).floatValue())); } catch (final ParseException e) { try { return new Percentage(asFloat(text)); } catch (final ParseException ee) { throw new TextEntryParseException("Not a number " + text, ee); } } }
public Percentage add(final float value) { return new Percentage((floatValue() + value)); }
public Percentage subtract(final Percentage value) { return add(-value.floatValue()); }
private String titleString(final NumberFormat formatter, final Object value) { return value == null ? "" : format.format(((Percentage) value).floatValue()); }
@Before public void setUp() throws Exception { p1 = new Percentage(10.5f); p2 = new Percentage(10.5f); p3 = new Percentage(12.0f); }