package ola.jsame;

public class GridPoint implements Comparable
{
    public int row, col;

    public GridPoint()
    {
        this.row = this.col = 0;
    }
    
    public GridPoint(int row, int col)
    {
        this.row = row;
        this.col = col;
    }

    public boolean equals(Object o)
    {
	GridPoint p = (GridPoint) o;
	return this.row == p.row && this.col == p.col;
    }

    public int compareTo(Object o)
    {
        GridPoint p = (GridPoint) o;
        int rowDiff = this.row - p.row;
        int colDiff = this.col - p.col;
        
        if  (rowDiff == 0) {
            return colDiff;
        }
        return rowDiff;
    }
}
