@Test public void testEquals() { ColorBlock b1 = new ColorBlock(Color.RED, 1.0, 2.0); ColorBlock b2 = new ColorBlock(Color.RED, 1.0, 2.0); assertEquals(b1, b2); assertEquals(b2, b2); b1 = new ColorBlock(Color.BLUE, 1.0, 2.0); assertFalse(b1.equals(b2)); b2 = new ColorBlock(Color.BLUE, 1.0, 2.0); assertEquals(b1, b2); b1 = new ColorBlock(Color.BLUE, 1.1, 2.0); assertFalse(b1.equals(b2)); b2 = new ColorBlock(Color.BLUE, 1.1, 2.0); assertEquals(b1, b2); b1 = new ColorBlock(Color.BLUE, 1.1, 2.2); assertFalse(b1.equals(b2)); b2 = new ColorBlock(Color.BLUE, 1.1, 2.2); assertEquals(b1, b2); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof ColorBlock)) { return false; } ColorBlock that = (ColorBlock) obj; if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } return super.equals(obj); }
ColorBlock extends AbstractBlock implements Block { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof ColorBlock)) { return false; } ColorBlock that = (ColorBlock) obj; if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } return super.equals(obj); } }
ColorBlock extends AbstractBlock implements Block { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof ColorBlock)) { return false; } ColorBlock that = (ColorBlock) obj; if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } return super.equals(obj); } ColorBlock(Paint paint, double width, double height); }
ColorBlock extends AbstractBlock implements Block { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof ColorBlock)) { return false; } ColorBlock that = (ColorBlock) obj; if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } return super.equals(obj); } ColorBlock(Paint paint, double width, double height); Paint getPaint(); @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); }
ColorBlock extends AbstractBlock implements Block { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof ColorBlock)) { return false; } ColorBlock that = (ColorBlock) obj; if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } return super.equals(obj); } ColorBlock(Paint paint, double width, double height); Paint getPaint(); @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);  }