@Test public void testEquals() { LegendGraphic g1 = new LegendGraphic(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), Color.BLACK); LegendGraphic g2 = new LegendGraphic(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), Color.BLACK); assertEquals(g1, g2); assertEquals(g2, g1); g1.setShapeVisible(!g1.isShapeVisible()); assertFalse(g1.equals(g2)); g2.setShapeVisible(!g2.isShapeVisible()); assertEquals(g1, g2); g1.setShape(new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0)); assertFalse(g1.equals(g2)); g2.setShape(new Rectangle2D.Double(4.0, 3.0, 2.0, 1.0)); assertEquals(g1, g2); g1.setShapeFilled(!g1.isShapeFilled()); assertFalse(g1.equals(g2)); g2.setShapeFilled(!g2.isShapeFilled()); assertEquals(g1, g2); g1.setFillPaint(Color.green); assertFalse(g1.equals(g2)); g2.setFillPaint(Color.green); assertEquals(g1, g2); g1.setShapeOutlineVisible(!g1.isShapeOutlineVisible()); assertFalse(g1.equals(g2)); g2.setShapeOutlineVisible(!g2.isShapeOutlineVisible()); assertEquals(g1, g2); g1.setOutlinePaint(Color.green); assertFalse(g1.equals(g2)); g2.setOutlinePaint(Color.green); assertEquals(g1, g2); g1.setOutlineStroke(new BasicStroke(1.23f)); assertFalse(g1.equals(g2)); g2.setOutlineStroke(new BasicStroke(1.23f)); assertEquals(g1, g2); g1.setShapeAnchor(RectangleAnchor.BOTTOM_RIGHT); assertFalse(g1.equals(g2)); g2.setShapeAnchor(RectangleAnchor.BOTTOM_RIGHT); assertEquals(g1, g2); g1.setShapeLocation(RectangleAnchor.BOTTOM_RIGHT); assertFalse(g1.equals(g2)); g2.setShapeLocation(RectangleAnchor.BOTTOM_RIGHT); assertEquals(g1, g2); g1.setLineVisible(!g1.isLineVisible()); assertFalse(g1.equals(g2)); g2.setLineVisible(!g2.isLineVisible()); assertEquals(g1, g2); g1.setLine(new Line2D.Double(1.0, 2.0, 3.0, 4.0)); assertFalse(g1.equals(g2)); g2.setLine(new Line2D.Double(1.0, 2.0, 3.0, 4.0)); assertEquals(g1, g2); g1.setLinePaint(Color.green); assertFalse(g1.equals(g2)); g2.setLinePaint(Color.green); assertEquals(g1, g2); g1.setLineStroke(new BasicStroke(1.23f)); assertFalse(g1.equals(g2)); g2.setLineStroke(new BasicStroke(1.23f)); assertEquals(g1, g2); g1.setFillPaintTransformer(new StandardGradientPaintTransformer( GradientPaintTransformType.CENTER_HORIZONTAL)); assertFalse(g1.equals(g2)); g2.setFillPaintTransformer(new StandardGradientPaintTransformer( GradientPaintTransformType.CENTER_HORIZONTAL)); assertEquals(g1, g2); }
@Override public boolean equals(Object obj) { if (!(obj instanceof LegendGraphic)) { return false; } LegendGraphic that = (LegendGraphic) obj; if (this.shapeVisible != that.shapeVisible) { return false; } if (!ShapeUtilities.equal(this.shape, that.shape)) { return false; } if (this.shapeFilled != that.shapeFilled) { return false; } if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) { return false; } if (!ObjectUtilities.equal(this.fillPaintTransformer, that.fillPaintTransformer)) { return false; } if (this.shapeOutlineVisible != that.shapeOutlineVisible) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!ObjectUtilities.equal(this.outlineStroke, that.outlineStroke)) { return false; } if (this.shapeAnchor != that.shapeAnchor) { return false; } if (this.shapeLocation != that.shapeLocation) { return false; } if (this.lineVisible != that.lineVisible) { return false; } if (!ShapeUtilities.equal(this.line, that.line)) { return false; } if (!PaintUtilities.equal(this.linePaint, that.linePaint)) { return false; } if (!ObjectUtilities.equal(this.lineStroke, that.lineStroke)) { return false; } return super.equals(obj); }
LegendGraphic extends AbstractBlock implements Block, PublicCloneable { @Override public boolean equals(Object obj) { if (!(obj instanceof LegendGraphic)) { return false; } LegendGraphic that = (LegendGraphic) obj; if (this.shapeVisible != that.shapeVisible) { return false; } if (!ShapeUtilities.equal(this.shape, that.shape)) { return false; } if (this.shapeFilled != that.shapeFilled) { return false; } if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) { return false; } if (!ObjectUtilities.equal(this.fillPaintTransformer, that.fillPaintTransformer)) { return false; } if (this.shapeOutlineVisible != that.shapeOutlineVisible) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!ObjectUtilities.equal(this.outlineStroke, that.outlineStroke)) { return false; } if (this.shapeAnchor != that.shapeAnchor) { return false; } if (this.shapeLocation != that.shapeLocation) { return false; } if (this.lineVisible != that.lineVisible) { return false; } if (!ShapeUtilities.equal(this.line, that.line)) { return false; } if (!PaintUtilities.equal(this.linePaint, that.linePaint)) { return false; } if (!ObjectUtilities.equal(this.lineStroke, that.lineStroke)) { return false; } return super.equals(obj); } }
LegendGraphic extends AbstractBlock implements Block, PublicCloneable { @Override public boolean equals(Object obj) { if (!(obj instanceof LegendGraphic)) { return false; } LegendGraphic that = (LegendGraphic) obj; if (this.shapeVisible != that.shapeVisible) { return false; } if (!ShapeUtilities.equal(this.shape, that.shape)) { return false; } if (this.shapeFilled != that.shapeFilled) { return false; } if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) { return false; } if (!ObjectUtilities.equal(this.fillPaintTransformer, that.fillPaintTransformer)) { return false; } if (this.shapeOutlineVisible != that.shapeOutlineVisible) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!ObjectUtilities.equal(this.outlineStroke, that.outlineStroke)) { return false; } if (this.shapeAnchor != that.shapeAnchor) { return false; } if (this.shapeLocation != that.shapeLocation) { return false; } if (this.lineVisible != that.lineVisible) { return false; } if (!ShapeUtilities.equal(this.line, that.line)) { return false; } if (!PaintUtilities.equal(this.linePaint, that.linePaint)) { return false; } if (!ObjectUtilities.equal(this.lineStroke, that.lineStroke)) { return false; } return super.equals(obj); } LegendGraphic(Shape shape, Paint fillPaint); }
LegendGraphic extends AbstractBlock implements Block, PublicCloneable { @Override public boolean equals(Object obj) { if (!(obj instanceof LegendGraphic)) { return false; } LegendGraphic that = (LegendGraphic) obj; if (this.shapeVisible != that.shapeVisible) { return false; } if (!ShapeUtilities.equal(this.shape, that.shape)) { return false; } if (this.shapeFilled != that.shapeFilled) { return false; } if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) { return false; } if (!ObjectUtilities.equal(this.fillPaintTransformer, that.fillPaintTransformer)) { return false; } if (this.shapeOutlineVisible != that.shapeOutlineVisible) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!ObjectUtilities.equal(this.outlineStroke, that.outlineStroke)) { return false; } if (this.shapeAnchor != that.shapeAnchor) { return false; } if (this.shapeLocation != that.shapeLocation) { return false; } if (this.lineVisible != that.lineVisible) { return false; } if (!ShapeUtilities.equal(this.line, that.line)) { return false; } if (!PaintUtilities.equal(this.linePaint, that.linePaint)) { return false; } if (!ObjectUtilities.equal(this.lineStroke, that.lineStroke)) { return false; } return super.equals(obj); } LegendGraphic(Shape shape, Paint fillPaint); boolean isShapeVisible(); void setShapeVisible(boolean visible); Shape getShape(); void setShape(Shape shape); boolean isShapeFilled(); void setShapeFilled(boolean filled); Paint getFillPaint(); void setFillPaint(Paint paint); GradientPaintTransformer getFillPaintTransformer(); void setFillPaintTransformer(GradientPaintTransformer transformer); boolean isShapeOutlineVisible(); void setShapeOutlineVisible(boolean visible); Paint getOutlinePaint(); void setOutlinePaint(Paint paint); Stroke getOutlineStroke(); void setOutlineStroke(Stroke stroke); RectangleAnchor getShapeAnchor(); void setShapeAnchor(RectangleAnchor anchor); RectangleAnchor getShapeLocation(); void setShapeLocation(RectangleAnchor location); boolean isLineVisible(); void setLineVisible(boolean visible); Shape getLine(); void setLine(Shape line); Paint getLinePaint(); void setLinePaint(Paint paint); Stroke getLineStroke(); void setLineStroke(Stroke stroke); @Override Size2D arrange(Graphics2D g2, RectangleConstraint constraint); @Override void draw(Graphics2D g2, Rectangle2D area); @Override Object draw(Graphics2D g2, Rectangle2D area, Object params); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone(); }
LegendGraphic extends AbstractBlock implements Block, PublicCloneable { @Override public boolean equals(Object obj) { if (!(obj instanceof LegendGraphic)) { return false; } LegendGraphic that = (LegendGraphic) obj; if (this.shapeVisible != that.shapeVisible) { return false; } if (!ShapeUtilities.equal(this.shape, that.shape)) { return false; } if (this.shapeFilled != that.shapeFilled) { return false; } if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) { return false; } if (!ObjectUtilities.equal(this.fillPaintTransformer, that.fillPaintTransformer)) { return false; } if (this.shapeOutlineVisible != that.shapeOutlineVisible) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!ObjectUtilities.equal(this.outlineStroke, that.outlineStroke)) { return false; } if (this.shapeAnchor != that.shapeAnchor) { return false; } if (this.shapeLocation != that.shapeLocation) { return false; } if (this.lineVisible != that.lineVisible) { return false; } if (!ShapeUtilities.equal(this.line, that.line)) { return false; } if (!PaintUtilities.equal(this.linePaint, that.linePaint)) { return false; } if (!ObjectUtilities.equal(this.lineStroke, that.lineStroke)) { return false; } return super.equals(obj); } LegendGraphic(Shape shape, Paint fillPaint); boolean isShapeVisible(); void setShapeVisible(boolean visible); Shape getShape(); void setShape(Shape shape); boolean isShapeFilled(); void setShapeFilled(boolean filled); Paint getFillPaint(); void setFillPaint(Paint paint); GradientPaintTransformer getFillPaintTransformer(); void setFillPaintTransformer(GradientPaintTransformer transformer); boolean isShapeOutlineVisible(); void setShapeOutlineVisible(boolean visible); Paint getOutlinePaint(); void setOutlinePaint(Paint paint); Stroke getOutlineStroke(); void setOutlineStroke(Stroke stroke); RectangleAnchor getShapeAnchor(); void setShapeAnchor(RectangleAnchor anchor); RectangleAnchor getShapeLocation(); void setShapeLocation(RectangleAnchor location); boolean isLineVisible(); void setLineVisible(boolean visible); Shape getLine(); void setLine(Shape line); Paint getLinePaint(); void setLinePaint(Paint paint); Stroke getLineStroke(); void setLineStroke(Stroke stroke); @Override Size2D arrange(Graphics2D g2, RectangleConstraint constraint); @Override void draw(Graphics2D g2, Rectangle2D area); @Override Object draw(Graphics2D g2, Rectangle2D area, Object params); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone();  }