@Test public void testEquals() { MeterNeedle n1 = new LineNeedle(); MeterNeedle n2 = new LineNeedle(); assertEquals(n1, n2); n1.setFillPaint(new GradientPaint(1.0f, 2.0f, Color.RED, 3.0f, 4.0f, Color.BLUE)); assertFalse(n1.equals(n2)); n2.setFillPaint(new GradientPaint(1.0f, 2.0f, Color.RED, 3.0f, 4.0f, Color.BLUE)); assertEquals(n1, n2); n1.setOutlinePaint(new GradientPaint(5.0f, 6.0f, Color.RED, 7.0f, 8.0f, Color.BLUE)); assertFalse(n1.equals(n2)); n2.setOutlinePaint(new GradientPaint(5.0f, 6.0f, Color.RED, 7.0f, 8.0f, Color.BLUE)); assertEquals(n1, n2); n1.setHighlightPaint(new GradientPaint(9.0f, 0.0f, Color.RED, 1.0f, 2.0f, Color.BLUE)); assertFalse(n1.equals(n2)); n2.setHighlightPaint(new GradientPaint(9.0f, 0.0f, Color.RED, 1.0f, 2.0f, Color.BLUE)); assertEquals(n1, n2); Stroke s = new BasicStroke(1.23f); n1.setOutlineStroke(s); assertFalse(n1.equals(n2)); n2.setOutlineStroke(s); assertEquals(n1, n2); n1.setRotateX(1.23); assertFalse(n1.equals(n2)); n2.setRotateX(1.23); assertEquals(n1, n2); n1.setRotateY(4.56); assertFalse(n1.equals(n2)); n2.setRotateY(4.56); assertEquals(n1, n2); n1.setSize(11); assertFalse(n1.equals(n2)); n2.setSize(11); assertEquals(n1, n2); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof MeterNeedle)) { return false; } MeterNeedle that = (MeterNeedle) obj; if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!ObjectUtilities.equal(this.outlineStroke, that.outlineStroke)) { return false; } if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) { return false; } if (!PaintUtilities.equal(this.highlightPaint, that.highlightPaint)) { return false; } if (this.size != that.size) { return false; } if (this.rotateX != that.rotateX) { return false; } if (this.rotateY != that.rotateY) { return false; } return true; }
MeterNeedle implements Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof MeterNeedle)) { return false; } MeterNeedle that = (MeterNeedle) obj; if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!ObjectUtilities.equal(this.outlineStroke, that.outlineStroke)) { return false; } if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) { return false; } if (!PaintUtilities.equal(this.highlightPaint, that.highlightPaint)) { return false; } if (this.size != that.size) { return false; } if (this.rotateX != that.rotateX) { return false; } if (this.rotateY != that.rotateY) { return false; } return true; } }
MeterNeedle implements Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof MeterNeedle)) { return false; } MeterNeedle that = (MeterNeedle) obj; if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!ObjectUtilities.equal(this.outlineStroke, that.outlineStroke)) { return false; } if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) { return false; } if (!PaintUtilities.equal(this.highlightPaint, that.highlightPaint)) { return false; } if (this.size != that.size) { return false; } if (this.rotateX != that.rotateX) { return false; } if (this.rotateY != that.rotateY) { return false; } return true; } MeterNeedle();  MeterNeedle(Paint outline, Paint fill, Paint highlight); }
MeterNeedle implements Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof MeterNeedle)) { return false; } MeterNeedle that = (MeterNeedle) obj; if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!ObjectUtilities.equal(this.outlineStroke, that.outlineStroke)) { return false; } if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) { return false; } if (!PaintUtilities.equal(this.highlightPaint, that.highlightPaint)) { return false; } if (this.size != that.size) { return false; } if (this.rotateX != that.rotateX) { return false; } if (this.rotateY != that.rotateY) { return false; } return true; } MeterNeedle();  MeterNeedle(Paint outline, Paint fill, Paint highlight); Paint getOutlinePaint(); void setOutlinePaint(Paint p); Stroke getOutlineStroke(); void setOutlineStroke(Stroke s); Paint getFillPaint(); void setFillPaint(Paint p); Paint getHighlightPaint(); void setHighlightPaint(Paint p); double getRotateX(); void setRotateX(double x); void setRotateY(double y); double getRotateY(); void draw(Graphics2D g2, Rectangle2D plotArea); void draw(Graphics2D g2, Rectangle2D plotArea, double angle); void draw(Graphics2D g2, Rectangle2D plotArea, Point2D rotate,
                     double angle); int getSize(); void setSize(int pixels); AffineTransform getTransform(); @Override boolean equals(Object obj); @Override int hashCode(); }
MeterNeedle implements Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof MeterNeedle)) { return false; } MeterNeedle that = (MeterNeedle) obj; if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!ObjectUtilities.equal(this.outlineStroke, that.outlineStroke)) { return false; } if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) { return false; } if (!PaintUtilities.equal(this.highlightPaint, that.highlightPaint)) { return false; } if (this.size != that.size) { return false; } if (this.rotateX != that.rotateX) { return false; } if (this.rotateY != that.rotateY) { return false; } return true; } MeterNeedle();  MeterNeedle(Paint outline, Paint fill, Paint highlight); Paint getOutlinePaint(); void setOutlinePaint(Paint p); Stroke getOutlineStroke(); void setOutlineStroke(Stroke s); Paint getFillPaint(); void setFillPaint(Paint p); Paint getHighlightPaint(); void setHighlightPaint(Paint p); double getRotateX(); void setRotateX(double x); void setRotateY(double y); double getRotateY(); void draw(Graphics2D g2, Rectangle2D plotArea); void draw(Graphics2D g2, Rectangle2D plotArea, double angle); void draw(Graphics2D g2, Rectangle2D plotArea, Point2D rotate,
                     double angle); int getSize(); void setSize(int pixels); AffineTransform getTransform(); @Override boolean equals(Object obj); @Override int hashCode();  }