package Strategy; // a position in 2-space, can be in any quadrant (negative coords okay) public class Position { private int x; // horizontal private int y; // vertical public Position() { setX(0); setY(0); } public Position(int x, int y) { this(); setX(x); setY(y); } // copy constructor public Position (Position p) { this(); if (p != null) { setX(p.getX()); setY(p.getY()); } } public Position clone() { return new Position(this); } public int getX() { return x; } public void setX(int x) { this.x = x; } public int getY() { return y; } public void setY(int y) { this.y = y; } public String toString() { return "(" + getX() + ", " + getY() + ")"; } // must be another position with same x and y public boolean equals(Object other) { if (other instanceof Position) { return ((Position)other).getX() == this.getX() && ((Position)other).getY() == this.getY(); } return false; } }