// ASSIGNMENT 4
// Position.java: implementation of a coordinate-pair class
// Author: Kiri Wagstaff
// Date: July 7, 2001
// ----- Do not modify! ------

public class Position
{
    // Store an x and y coordinate pair.
    private int xPos, yPos;
    
    // Constructor: creates a new Position object
    // Input: an x and a y coordinate
    // Output: note no return type! It doesn't return anything,
    // just creates a new object of type Position.
    public Position(int x, int y)
    {
			xPos = x;
			yPos = y;
    }

    // getX: returns the x coordinate
    public int getX()
    {
			return xPos;
    }

    // getY: returns the y coordinate
    public int getY()
    {
			return yPos;
    }

    // toString: returns a nice String version
    public String toString()
    {
			return new String("(" + xPos + "," + yPos + ")");
    }

    // equals: checks for equality
    // Input: another Position object
    // Output: true if they're at the same position, otherwise false
    public boolean equals(Position p)
    {
			if (xPos == p.getX() && yPos == p.getY())
      {
	    	return true;
			}
			// Otherwise, return false
			return false;
    }
}
