@Test public void testEquals() { TextAnnotation a1 = new CategoryTextAnnotation("Test", "Category", 1.0); TextAnnotation a2 = new CategoryTextAnnotation("Test", "Category", 1.0); assertEquals(a1, a2); a1.setText("Text"); assertFalse(a1.equals(a2)); a2.setText("Text"); assertEquals(a1, a2); a1.setFont(new Font("Serif", Font.BOLD, 18)); assertFalse(a1.equals(a2)); a2.setFont(new Font("Serif", Font.BOLD, 18)); assertEquals(a1, a2); a1.setPaint(new GradientPaint(1.0f, 2.0f, Color.RED, 3.0f, 4.0f, Color.pink)); assertFalse(a1.equals(a2)); a2.setPaint(new GradientPaint(1.0f, 2.0f, Color.RED, 3.0f, 4.0f, Color.pink)); assertEquals(a1, a2); a1.setTextAnchor(TextAnchor.BOTTOM_LEFT); assertFalse(a1.equals(a2)); a2.setTextAnchor(TextAnchor.BOTTOM_LEFT); assertEquals(a1, a2); a1.setRotationAnchor(TextAnchor.BOTTOM_LEFT); assertFalse(a1.equals(a2)); a2.setRotationAnchor(TextAnchor.BOTTOM_LEFT); assertEquals(a1, a2); a1.setRotationAngle(Math.PI); assertFalse(a1.equals(a2)); a2.setRotationAngle(Math.PI); assertEquals(a1, a2); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TextAnnotation)) { return false; } TextAnnotation that = (TextAnnotation) obj; if (!ObjectUtilities.equal(this.text, that.getText())) { return false; } if (!ObjectUtilities.equal(this.font, that.getFont())) { return false; } if (!PaintUtilities.equal(this.paint, that.getPaint())) { return false; } if (!ObjectUtilities.equal(this.textAnchor, that.getTextAnchor())) { return false; } if (!ObjectUtilities.equal(this.rotationAnchor, that.getRotationAnchor())) { return false; } if (this.rotationAngle != that.getRotationAngle()) { return false; } return true; }
TextAnnotation extends AbstractAnnotation implements Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TextAnnotation)) { return false; } TextAnnotation that = (TextAnnotation) obj; if (!ObjectUtilities.equal(this.text, that.getText())) { return false; } if (!ObjectUtilities.equal(this.font, that.getFont())) { return false; } if (!PaintUtilities.equal(this.paint, that.getPaint())) { return false; } if (!ObjectUtilities.equal(this.textAnchor, that.getTextAnchor())) { return false; } if (!ObjectUtilities.equal(this.rotationAnchor, that.getRotationAnchor())) { return false; } if (this.rotationAngle != that.getRotationAngle()) { return false; } return true; } }
TextAnnotation extends AbstractAnnotation implements Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TextAnnotation)) { return false; } TextAnnotation that = (TextAnnotation) obj; if (!ObjectUtilities.equal(this.text, that.getText())) { return false; } if (!ObjectUtilities.equal(this.font, that.getFont())) { return false; } if (!PaintUtilities.equal(this.paint, that.getPaint())) { return false; } if (!ObjectUtilities.equal(this.textAnchor, that.getTextAnchor())) { return false; } if (!ObjectUtilities.equal(this.rotationAnchor, that.getRotationAnchor())) { return false; } if (this.rotationAngle != that.getRotationAngle()) { return false; } return true; } protected  TextAnnotation(String text); }
TextAnnotation extends AbstractAnnotation implements Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TextAnnotation)) { return false; } TextAnnotation that = (TextAnnotation) obj; if (!ObjectUtilities.equal(this.text, that.getText())) { return false; } if (!ObjectUtilities.equal(this.font, that.getFont())) { return false; } if (!PaintUtilities.equal(this.paint, that.getPaint())) { return false; } if (!ObjectUtilities.equal(this.textAnchor, that.getTextAnchor())) { return false; } if (!ObjectUtilities.equal(this.rotationAnchor, that.getRotationAnchor())) { return false; } if (this.rotationAngle != that.getRotationAngle()) { return false; } return true; } protected  TextAnnotation(String text); String getText(); void setText(String text); Font getFont(); void setFont(Font font); Paint getPaint(); void setPaint(Paint paint); TextAnchor getTextAnchor(); void setTextAnchor(TextAnchor anchor); TextAnchor getRotationAnchor(); void setRotationAnchor(TextAnchor anchor); double getRotationAngle(); void setRotationAngle(double angle); @Override boolean equals(Object obj); @Override int hashCode(); }
TextAnnotation extends AbstractAnnotation implements Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TextAnnotation)) { return false; } TextAnnotation that = (TextAnnotation) obj; if (!ObjectUtilities.equal(this.text, that.getText())) { return false; } if (!ObjectUtilities.equal(this.font, that.getFont())) { return false; } if (!PaintUtilities.equal(this.paint, that.getPaint())) { return false; } if (!ObjectUtilities.equal(this.textAnchor, that.getTextAnchor())) { return false; } if (!ObjectUtilities.equal(this.rotationAnchor, that.getRotationAnchor())) { return false; } if (this.rotationAngle != that.getRotationAngle()) { return false; } return true; } protected  TextAnnotation(String text); String getText(); void setText(String text); Font getFont(); void setFont(Font font); Paint getPaint(); void setPaint(Paint paint); TextAnchor getTextAnchor(); void setTextAnchor(TextAnchor anchor); TextAnchor getRotationAnchor(); void setRotationAnchor(TextAnchor anchor); double getRotationAngle(); void setRotationAngle(double angle); @Override boolean equals(Object obj); @Override int hashCode(); static final Font DEFAULT_FONT; static final Paint DEFAULT_PAINT; static final TextAnchor DEFAULT_TEXT_ANCHOR; static final TextAnchor DEFAULT_ROTATION_ANCHOR; static final double DEFAULT_ROTATION_ANGLE; }