
/** This class is used for representing moves in object form.  It has
methods used to set and return the source and destination square in row/column
form.*/
public class Move
{
        private int sourceRow, sourceCol, destRow, destCol;
        
	/** Builds a move object using the given data. */
	public Move(int sourceRow, int sourceCol, int destRow, int destCol)
	{
                this.sourceRow = sourceRow;
                this.sourceCol = sourceCol;
                this.destRow = destRow;
                this.destCol = destCol;
	}
        
        // Precondition: move must have length at least four
        public Move(String move)
        {
                sourceCol = move.charAt(0) - 'a';
                sourceRow = move.charAt(1) - '1';
                destCol = move.charAt(2) - 'a';
                destRow = move.charAt(3) - '1';
        }
	
	/** Returns the source row. */
	public int getSourceRow()
	{
		return sourceRow;
	}
	
	/** Returns the source column. */
	public int getSourceCol()
	{
		return sourceCol;
	}
	
	/** Returns the destination row. */
	public int getDestRow()
	{
		return destRow;
	}
	
	/** Returns the destination column. */
	public int getDestCol()
	{
		return destCol;
	}
	
	/** Sets the source square. */
	public void setSource(int sourceRow, int sourceCol)
	{
	}
	
	/** Sets the destination square. */
	public void setDestination(int destRow,  int destCol)
	{
	}
        
        public String toString() {
                return ("" + (char)('a' + sourceCol) + (1 + sourceRow) +
                        (char)('a' + destCol) + (1 + destRow));
        }
}