@Test public void testEquals() { Stroke stroke = new BasicStroke(2.0f); XYLineAnnotation a1 = new XYLineAnnotation(10.0, 20.0, 100.0, 200.0, stroke, Color.BLUE); XYLineAnnotation a2 = new XYLineAnnotation(10.0, 20.0, 100.0, 200.0, stroke, Color.BLUE); assertEquals(a1, a2); assertEquals(a2, a1); a1 = new XYLineAnnotation(11.0, 20.0, 100.0, 200.0, stroke, Color.BLUE); assertFalse(a1.equals(a2)); a2 = new XYLineAnnotation(11.0, 20.0, 100.0, 200.0, stroke, Color.BLUE); assertEquals(a1, a2); a1 = new XYLineAnnotation(11.0, 21.0, 100.0, 200.0, stroke, Color.BLUE); assertFalse(a1.equals(a2)); a2 = new XYLineAnnotation(11.0, 21.0, 100.0, 200.0, stroke, Color.BLUE); assertEquals(a1, a2); a1 = new XYLineAnnotation(11.0, 21.0, 101.0, 200.0, stroke, Color.BLUE); assertFalse(a1.equals(a2)); a2 = new XYLineAnnotation(11.0, 21.0, 101.0, 200.0, stroke, Color.BLUE); assertEquals(a1, a2); a1 = new XYLineAnnotation(11.0, 21.0, 101.0, 201.0, stroke, Color.BLUE); assertFalse(a1.equals(a2)); a2 = new XYLineAnnotation(11.0, 21.0, 101.0, 201.0, stroke, Color.BLUE); assertEquals(a1, a2); Stroke stroke2 = new BasicStroke(0.99f); a1 = new XYLineAnnotation(11.0, 21.0, 101.0, 200.0, stroke2, Color.BLUE); assertFalse(a1.equals(a2)); a2 = new XYLineAnnotation(11.0, 21.0, 101.0, 200.0, stroke2, Color.BLUE); assertEquals(a1, a2); GradientPaint g1 = new GradientPaint(1.0f, 2.0f, Color.RED, 3.0f, 4.0f, Color.WHITE); GradientPaint g2 = new GradientPaint(1.0f, 2.0f, Color.RED, 3.0f, 4.0f, Color.WHITE); a1 = new XYLineAnnotation(11.0, 21.0, 101.0, 200.0, stroke2, g1); assertFalse(a1.equals(a2)); a2 = new XYLineAnnotation(11.0, 21.0, 101.0, 200.0, stroke2, g2); assertEquals(a1, a2); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof XYLineAnnotation)) { return false; } XYLineAnnotation that = (XYLineAnnotation) obj; if (this.x1 != that.x1) { return false; } if (this.y1 != that.y1) { return false; } if (this.x2 != that.x2) { return false; } if (this.y2 != that.y2) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!ObjectUtilities.equal(this.stroke, that.stroke)) { return false; } return true; }
XYLineAnnotation extends AbstractXYAnnotation implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof XYLineAnnotation)) { return false; } XYLineAnnotation that = (XYLineAnnotation) obj; if (this.x1 != that.x1) { return false; } if (this.y1 != that.y1) { return false; } if (this.x2 != that.x2) { return false; } if (this.y2 != that.y2) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!ObjectUtilities.equal(this.stroke, that.stroke)) { return false; } return true; } }
XYLineAnnotation extends AbstractXYAnnotation implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof XYLineAnnotation)) { return false; } XYLineAnnotation that = (XYLineAnnotation) obj; if (this.x1 != that.x1) { return false; } if (this.y1 != that.y1) { return false; } if (this.x2 != that.x2) { return false; } if (this.y2 != that.y2) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!ObjectUtilities.equal(this.stroke, that.stroke)) { return false; } return true; } XYLineAnnotation(double x1, double y1, double x2, double y2);  XYLineAnnotation(double x1, double y1, double x2, double y2,
                            Stroke stroke, Paint paint); }
XYLineAnnotation extends AbstractXYAnnotation implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof XYLineAnnotation)) { return false; } XYLineAnnotation that = (XYLineAnnotation) obj; if (this.x1 != that.x1) { return false; } if (this.y1 != that.y1) { return false; } if (this.x2 != that.x2) { return false; } if (this.y2 != that.y2) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!ObjectUtilities.equal(this.stroke, that.stroke)) { return false; } return true; } XYLineAnnotation(double x1, double y1, double x2, double y2);  XYLineAnnotation(double x1, double y1, double x2, double y2,
                            Stroke stroke, Paint paint); @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(); }
XYLineAnnotation extends AbstractXYAnnotation implements Cloneable, PublicCloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof XYLineAnnotation)) { return false; } XYLineAnnotation that = (XYLineAnnotation) obj; if (this.x1 != that.x1) { return false; } if (this.y1 != that.y1) { return false; } if (this.x2 != that.x2) { return false; } if (this.y2 != that.y2) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!ObjectUtilities.equal(this.stroke, that.stroke)) { return false; } return true; } XYLineAnnotation(double x1, double y1, double x2, double y2);  XYLineAnnotation(double x1, double y1, double x2, double y2,
                            Stroke stroke, Paint paint); @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();  }