// Metric.java // by Scot Drysdale on 5/16/06 import java.awt.*; // Provides a distance measure from a shape to a point. // Different subclasses will supply different measures. public abstract class Metric { // Computes the distance from a shape to a point. public double distance(Shape s, Point p) { return distance(s,p.getX(), p.getY()); } // Computes the distance from a shape to an (x,y) pair. public abstract double distance(Shape s, double x, double y); }