import java.awt.Point; /**** * * This is an example of a simple Circle class with shallow versions of the * Constructor, equals, and getCenter methods. * */ public class ShallowCircle { private Point center; private double radius; /** * Construct this in a shallow manner by copying references of the given * Point parameter, rather than making a deep copy of it. */ public ShallowCircle(Point center, double radius) { this.center = center; this.radius = radius; } /** * Return a shallow reference to the center point, rather than a new Point. */ public Point getCenter() { return center; } /** * Check for equality in a shallow manner by comparing references, rather * than a deep comparison of data fields. */ public boolean equals(Object other) { if (other == null || !(other instanceof ShallowCircle)) { return false; } return center == ((ShallowCircle)other).center && radius == ((ShallowCircle)other).radius; } }