/** * Determines whether or not the specified <code>Object</code> is equal to this <code>Rectangle2D * </code>. The specified <code>Object</code> is equal to this <code>Rectangle2D</code> if it is * an instance of <code>Rectangle2D</code> and if its location and size are the same as this * <code>Rectangle2D</code>. * * @param obj an <code>Object</code> to be compared with this <code>Rectangle2D</code>. * @return <code>true</code> if <code>obj</code> is an instance of <code>Rectangle2D</code> and * has the same values; <code>false</code> otherwise. * @since 1.2 */ public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof Rectangle2D) { Rectangle2D r2d = (Rectangle2D) obj; return ((getX() == r2d.getX()) && (getY() == r2d.getY()) && (getWidth() == r2d.getWidth()) && (getHeight() == r2d.getHeight())); } return false; }
/** * Sets this <code>Rectangle2D</code> to be the same as the specified <code>Rectangle2D</code>. * * @param r the specified <code>Rectangle2D</code> * @since 1.2 */ public void setRect(Rectangle2D r) { setRect(r.getX(), r.getY(), r.getWidth(), r.getHeight()); }
/** * {@inheritDoc} * * @since 1.2 */ public void setRect(Rectangle2D r) { this.x = r.getX(); this.y = r.getY(); this.width = r.getWidth(); this.height = r.getHeight(); }