math
Class PostOfficeMetric

java.lang.Object
  extended by math.PostOfficeMetric
All Implemented Interfaces:
Metric

public class PostOfficeMetric
extends java.lang.Object
implements Metric

The Post Office metric (i.e., a notion of distance that makes sense if, to travel between two points, you have to go through a central post office located at the origin) This is sometimes also called the British Rail metric and/or the shuttle metric.

See Also:
"The Design and Implementation of Multimedia Software © 2011"

Constructor Summary
PostOfficeMetric()
           
 
Method Summary
 double distance(double[] x, double[] y)
          Calculate the distance between two n-dimensional points (required by Metric) Note: For simplicity, this method does not confirm that the two arrays are the same size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PostOfficeMetric

public PostOfficeMetric()
Method Detail

distance

public double distance(double[] x,
                       double[] y)
Calculate the distance between two n-dimensional points (required by Metric) Note: For simplicity, this method does not confirm that the two arrays are the same size. It uses the smaller size.

Specified by:
distance in interface Metric
Parameters:
x - One n-dimensional point
y - Another n-dimensional point
Returns:
The distance


Design and Implementation of Multimedia Software, Jones and Bartlett Publishers