import java.awt.Point;

/****
 *
 * This is an example of a simple Circle class with deep versions of the
 * Constructor, equals, and getCenter methods.
 *
 */
public class DeepCircle {

    private Point center;
    private double radius;

    /**
     * Construct this in a deep manner by making a new copy of the Point
     * parameter.
     */
    public DeepCircle(Point center, double radius) {
        this.center = new Point(center.x, center.y);
        this.radius = radius;
    }

    /**
     * Return a new copy of the center point.
     */
    public Point getCenter() {
        return new Point(center.x, center.y);
    }

    /**
     * Check for equality in a deep manner by comparing the two data fields.
     * Note that we use .equals to compare the points, NOT ==.  A fully deep
     * comparison uses equals for non-primitive data fields, and assumes that
     * the underlying implementations of equals are also deep comparisons.  For
     * example, here we're assuming that Point.equals is a deep implementation.
     */
    public boolean equals(Object other) {
        if (other == null || !(other instanceof DeepCircle)) {
            return false;
        }
        return center.equals(((DeepCircle)other).center) &&
            radius == ((DeepCircle)other).radius;
    }

}