package Rectangles;

import Rectangles.Vertex;

public class Point extends Vertex implements Cloneable {
	public Point( int x, int y ) throws Exception {
		super( x, y );
	}

	public int distanceTo( Vertex point ) throws Exception {
		return( distanceTo( point.xpos(), point.ypos() ) );
	}

	public int distanceTo( int x, int y ) throws Exception {
		return( Math.abs( xpos() - x ) + Math.abs( ypos() - y ) );
	}

	protected Object clone() throws CloneNotSupportedException {
		try {
			return( new Point( xpos(), ypos() ) );
		}
		catch( Exception e ) {
			throw new CloneNotSupportedException( e.toString() );
		}
	}
}
