        /** Definition of a Ship's position.
         *  @author David J. Barnes (d.j.barnes@ukc.ac.uk)
         *  @version Version 2.0 (14th Apr 1999)<br>
         *  @see Ship
         */
public class Position {
        /** Create the (immutable) (x,y) pair.
         */
    public Position(double x, double y){
        this.x = x;
        this.y = y;
    }

        /** Return the X-value of this position.
         */
    public double getX(){
        return x;
    }

        /** Return the Y-value of this position.
         */
    public double getY(){
        return y;
    }

        /** Return a string representation of this position.
         */
    public String toString(){
        return "("+getX()+","+getY()+")";
    }

        /** Does this position match another?
         *  @return true if <i>o</i> is a Position with matching
         *  <i>x</i> and <i>y</i> attributes.
         */
    public boolean equals(Object o){
        if(o == null){
            return false;
        }
        else if(o instanceof Position){
            Position p = (Position) o;
            return (getX() == p.getX()) && (getY() == p.getY());
        }
        else{
            return false;
        }
    }

    private final double x, y;
}
