@Test public void testEquals() { XYTextAnnotation a1 = new XYTextAnnotation("Text", 10.0, 20.0); XYTextAnnotation a2 = new XYTextAnnotation("Text", 10.0, 20.0); assertEquals(a1, a2); a1 = new XYTextAnnotation("ABC", 10.0, 20.0); assertFalse(a1.equals(a2)); a2 = new XYTextAnnotation("ABC", 10.0, 20.0); assertEquals(a1, a2); a1 = new XYTextAnnotation("ABC", 11.0, 20.0); assertFalse(a1.equals(a2)); a2 = new XYTextAnnotation("ABC", 11.0, 20.0); assertEquals(a1, a2); a1 = new XYTextAnnotation("ABC", 11.0, 22.0); assertFalse(a1.equals(a2)); a2 = new XYTextAnnotation("ABC", 11.0, 22.0); assertEquals(a1, a2); a1.setFont(new Font("Serif", Font.PLAIN, 23)); assertFalse(a1.equals(a2)); a2.setFont(new Font("Serif", Font.PLAIN, 23)); assertEquals(a1, a2); GradientPaint gp1 = new GradientPaint(1.0f, 2.0f, Color.RED, 3.0f, 4.0f, Color.yellow); GradientPaint gp2 = new GradientPaint(1.0f, 2.0f, Color.RED, 3.0f, 4.0f, Color.yellow); a1.setPaint(gp1); assertFalse(a1.equals(a2)); a2.setPaint(gp2); assertEquals(a1, a2); a1.setRotationAnchor(TextAnchor.BASELINE_RIGHT); assertFalse(a1.equals(a2)); a2.setRotationAnchor(TextAnchor.BASELINE_RIGHT); assertEquals(a1, a2); a1.setRotationAngle(12.3); assertFalse(a1.equals(a2)); a2.setRotationAngle(12.3); assertEquals(a1, a2); a1.setTextAnchor(TextAnchor.BASELINE_RIGHT); assertFalse(a1.equals(a2)); a2.setTextAnchor(TextAnchor.BASELINE_RIGHT); assertEquals(a1, a2); a1.setBackgroundPaint(gp1); assertFalse(a1.equals(a2)); a2.setBackgroundPaint(gp1); assertEquals(a1, a2); a1.setOutlinePaint(gp1); assertFalse(a1.equals(a2)); a2.setOutlinePaint(gp1); assertEquals(a1, a2); a1.setOutlineStroke(new BasicStroke(1.2f)); assertFalse(a1.equals(a2)); a2.setOutlineStroke(new BasicStroke(1.2f)); assertEquals(a1, a2); a1.setOutlineVisible(!a1.isOutlineVisible()); assertFalse(a1.equals(a2)); a2.setOutlineVisible(a1.isOutlineVisible()); assertEquals(a1, a2); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof XYTextAnnotation)) { return false; } XYTextAnnotation that = (XYTextAnnotation) obj; if (!this.text.equals(that.text)) { return false; } if (this.x != that.x) { return false; } if (this.y != that.y) { return false; } if (!this.font.equals(that.font)) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!this.rotationAnchor.equals(that.rotationAnchor)) { return false; } if (this.rotationAngle != that.rotationAngle) { return false; } if (!this.textAnchor.equals(that.textAnchor)) { return false; } if (this.outlineVisible != that.outlineVisible) { return false; } if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint)) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!(this.outlineStroke.equals(that.outlineStroke))) { return false; } return super.equals(obj); }
XYTextAnnotation extends AbstractXYAnnotation implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof XYTextAnnotation)) { return false; } XYTextAnnotation that = (XYTextAnnotation) obj; if (!this.text.equals(that.text)) { return false; } if (this.x != that.x) { return false; } if (this.y != that.y) { return false; } if (!this.font.equals(that.font)) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!this.rotationAnchor.equals(that.rotationAnchor)) { return false; } if (this.rotationAngle != that.rotationAngle) { return false; } if (!this.textAnchor.equals(that.textAnchor)) { return false; } if (this.outlineVisible != that.outlineVisible) { return false; } if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint)) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!(this.outlineStroke.equals(that.outlineStroke))) { return false; } return super.equals(obj); } }
XYTextAnnotation extends AbstractXYAnnotation implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof XYTextAnnotation)) { return false; } XYTextAnnotation that = (XYTextAnnotation) obj; if (!this.text.equals(that.text)) { return false; } if (this.x != that.x) { return false; } if (this.y != that.y) { return false; } if (!this.font.equals(that.font)) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!this.rotationAnchor.equals(that.rotationAnchor)) { return false; } if (this.rotationAngle != that.rotationAngle) { return false; } if (!this.textAnchor.equals(that.textAnchor)) { return false; } if (this.outlineVisible != that.outlineVisible) { return false; } if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint)) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!(this.outlineStroke.equals(that.outlineStroke))) { return false; } return super.equals(obj); } XYTextAnnotation(String text, double x, double y); }
XYTextAnnotation extends AbstractXYAnnotation implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof XYTextAnnotation)) { return false; } XYTextAnnotation that = (XYTextAnnotation) obj; if (!this.text.equals(that.text)) { return false; } if (this.x != that.x) { return false; } if (this.y != that.y) { return false; } if (!this.font.equals(that.font)) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!this.rotationAnchor.equals(that.rotationAnchor)) { return false; } if (this.rotationAngle != that.rotationAngle) { return false; } if (!this.textAnchor.equals(that.textAnchor)) { return false; } if (this.outlineVisible != that.outlineVisible) { return false; } if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint)) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!(this.outlineStroke.equals(that.outlineStroke))) { return false; } return super.equals(obj); } XYTextAnnotation(String text, double x, double y); 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); double getX(); void setX(double x); double getY(); void setY(double y); Paint getBackgroundPaint(); void setBackgroundPaint(Paint paint); Paint getOutlinePaint(); void setOutlinePaint(Paint paint); Stroke getOutlineStroke(); void setOutlineStroke(Stroke stroke); boolean isOutlineVisible(); void setOutlineVisible(boolean visible); @Override void draw(Graphics2D g2, XYPlot plot, Rectangle2D dataArea,
                     ValueAxis domainAxis, ValueAxis rangeAxis,
                     int rendererIndex,
                     PlotRenderingInfo info); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone(); }
XYTextAnnotation extends AbstractXYAnnotation implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof XYTextAnnotation)) { return false; } XYTextAnnotation that = (XYTextAnnotation) obj; if (!this.text.equals(that.text)) { return false; } if (this.x != that.x) { return false; } if (this.y != that.y) { return false; } if (!this.font.equals(that.font)) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!this.rotationAnchor.equals(that.rotationAnchor)) { return false; } if (this.rotationAngle != that.rotationAngle) { return false; } if (!this.textAnchor.equals(that.textAnchor)) { return false; } if (this.outlineVisible != that.outlineVisible) { return false; } if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint)) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!(this.outlineStroke.equals(that.outlineStroke))) { return false; } return super.equals(obj); } XYTextAnnotation(String text, double x, double y); 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); double getX(); void setX(double x); double getY(); void setY(double y); Paint getBackgroundPaint(); void setBackgroundPaint(Paint paint); Paint getOutlinePaint(); void setOutlinePaint(Paint paint); Stroke getOutlineStroke(); void setOutlineStroke(Stroke stroke); boolean isOutlineVisible(); void setOutlineVisible(boolean visible); @Override void draw(Graphics2D g2, XYPlot plot, Rectangle2D dataArea,
                     ValueAxis domainAxis, ValueAxis rangeAxis,
                     int rendererIndex,
                     PlotRenderingInfo info); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone(); 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; }