@Test public void testEquals() { EmptyBlock b1 = new EmptyBlock(1.0, 2.0); EmptyBlock b2 = new EmptyBlock(1.0, 2.0); assertEquals(b1, b2); assertEquals(b2, b2); b1.setID("Test"); assertFalse(b1.equals(b2)); b2.setID("Test"); assertEquals(b1, b2); b1.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertFalse(b1.equals(b2)); b2.setMargin(new RectangleInsets(1.0, 2.0, 3.0, 4.0)); assertEquals(b1, b2); b1.setFrame(new BlockBorder(Color.RED)); assertFalse(b1.equals(b2)); b2.setFrame(new BlockBorder(Color.RED)); assertEquals(b1, b2); b1.setPadding(new RectangleInsets(2.0, 4.0, 6.0, 8.0)); assertFalse(b1.equals(b2)); b2.setPadding(new RectangleInsets(2.0, 4.0, 6.0, 8.0)); assertEquals(b1, b2); b1.setWidth(1.23); assertFalse(b1.equals(b2)); b2.setWidth(1.23); assertEquals(b1, b2); b1.setHeight(4.56); assertFalse(b1.equals(b2)); b2.setHeight(4.56); assertEquals(b1, b2); b1.setBounds(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0)); assertFalse(b1.equals(b2)); b2.setBounds(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0)); assertEquals(b1, b2); b1 = new EmptyBlock(1.1, 2.0); assertFalse(b1.equals(b2)); b2 = new EmptyBlock(1.1, 2.0); assertEquals(b1, b2); b1 = new EmptyBlock(1.1, 2.2); assertFalse(b1.equals(b2)); b2 = new EmptyBlock(1.1, 2.2); assertEquals(b1, b2); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof AbstractBlock)) { return false; } AbstractBlock that = (AbstractBlock) obj; if (!ObjectUtilities.equal(this.id, that.id)) { return false; } if (!this.frame.equals(that.frame)) { return false; } if (!this.bounds.equals(that.bounds)) { return false; } if (!this.margin.equals(that.margin)) { return false; } if (!this.padding.equals(that.padding)) { return false; } if (this.height != that.height) { return false; } if (this.width != that.width) { return false; } return true; }
AbstractBlock implements Cloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof AbstractBlock)) { return false; } AbstractBlock that = (AbstractBlock) obj; if (!ObjectUtilities.equal(this.id, that.id)) { return false; } if (!this.frame.equals(that.frame)) { return false; } if (!this.bounds.equals(that.bounds)) { return false; } if (!this.margin.equals(that.margin)) { return false; } if (!this.padding.equals(that.padding)) { return false; } if (this.height != that.height) { return false; } if (this.width != that.width) { return false; } return true; } }
AbstractBlock implements Cloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof AbstractBlock)) { return false; } AbstractBlock that = (AbstractBlock) obj; if (!ObjectUtilities.equal(this.id, that.id)) { return false; } if (!this.frame.equals(that.frame)) { return false; } if (!this.bounds.equals(that.bounds)) { return false; } if (!this.margin.equals(that.margin)) { return false; } if (!this.padding.equals(that.padding)) { return false; } if (this.height != that.height) { return false; } if (this.width != that.width) { return false; } return true; } protected  AbstractBlock(); }
AbstractBlock implements Cloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof AbstractBlock)) { return false; } AbstractBlock that = (AbstractBlock) obj; if (!ObjectUtilities.equal(this.id, that.id)) { return false; } if (!this.frame.equals(that.frame)) { return false; } if (!this.bounds.equals(that.bounds)) { return false; } if (!this.margin.equals(that.margin)) { return false; } if (!this.padding.equals(that.padding)) { return false; } if (this.height != that.height) { return false; } if (this.width != that.width) { return false; } return true; } protected  AbstractBlock(); String getID(); void setID(String id); double getWidth(); void setWidth(double width); double getHeight(); void setHeight(double height); RectangleInsets getMargin(); void setMargin(RectangleInsets margin); void setMargin(double top, double left, double bottom,
                          double right); void setBorder(double top, double left, double bottom,
                          double right); BlockFrame getFrame(); void setFrame(BlockFrame frame); RectangleInsets getPadding(); void setPadding(RectangleInsets padding); void setPadding(double top, double left, double bottom,
                           double right); double getContentXOffset(); double getContentYOffset(); Size2D arrange(Graphics2D g2); Size2D arrange(Graphics2D g2, RectangleConstraint constraint); Rectangle2D getBounds(); void setBounds(Rectangle2D bounds); @Override boolean equals(Object obj); @Override Object clone(); }
AbstractBlock implements Cloneable, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof AbstractBlock)) { return false; } AbstractBlock that = (AbstractBlock) obj; if (!ObjectUtilities.equal(this.id, that.id)) { return false; } if (!this.frame.equals(that.frame)) { return false; } if (!this.bounds.equals(that.bounds)) { return false; } if (!this.margin.equals(that.margin)) { return false; } if (!this.padding.equals(that.padding)) { return false; } if (this.height != that.height) { return false; } if (this.width != that.width) { return false; } return true; } protected  AbstractBlock(); String getID(); void setID(String id); double getWidth(); void setWidth(double width); double getHeight(); void setHeight(double height); RectangleInsets getMargin(); void setMargin(RectangleInsets margin); void setMargin(double top, double left, double bottom,
                          double right); void setBorder(double top, double left, double bottom,
                          double right); BlockFrame getFrame(); void setFrame(BlockFrame frame); RectangleInsets getPadding(); void setPadding(RectangleInsets padding); void setPadding(double top, double left, double bottom,
                           double right); double getContentXOffset(); double getContentYOffset(); Size2D arrange(Graphics2D g2); Size2D arrange(Graphics2D g2, RectangleConstraint constraint); Rectangle2D getBounds(); void setBounds(Rectangle2D bounds); @Override boolean equals(Object obj); @Override Object clone();  }