/**
 * A little convenience class to encapsulate  a move
 * 
 * @author gtowell
 *
 */
public class Amove
{
	/**
	 * Determine if two moves are the same
	 * @param aa the move to be compared with "this" one
	 * @return true iff the moves are the same
	 */
	public boolean same(Amove aa)
	{
		return aa.getStartX()==startx &&
				 aa.getStartY()==starty &&
				 aa.getEndX()==endx &&
				 aa.getEndY()==endy;
	}
	/**
	 * the x loc of the place moved from
	 **/
	private int startx;
	
	/**
	 * The y loc of the place moved from
	 */
	private int starty;
	
	/**
	 * The x loc of the place moved to
	 */
	private int endx;
	
	/**
	 * the y loc of the place moved to
	 */
	private int endy;
	
	/**
	 * A readable representation of the move
	 */
	public String toString()
	{
			return "move from <"+startx+","+starty+"> to <"+endx+","+endy+">";
	}
	
	/*
	 * Get accessor for the x starting location
	 */
	public int getStartX()
	{
		return startx;
	}
	
	/*
	 * Get accessor for the y starting location
	 */
	public int getStartY()
	{
		return starty;
	}
	
	/*
	 * Get accessor for the x to location
	 */
	public int getEndX()
	{
		return endx;
	}
	
	/**
	 * Get accessor for the y to location
	 * @return
	 */
	public int getEndY()
	{
		return endy;
	}
	
	/**
	 * * Constructor taking the locations as input as 4 integers
	 * @param sx
	 * @param sy
	 * @param ex
	 * @param ey
	 */
	public Amove(int sx, int sy, int ex, int ey)
	{
		startx=sx;
		starty=sy;
		endx=ex;
		endy=ey;
	}
	
	/**
	 * Constructor takinf the locations as input when contained in a string
	 * @param s
	 * @throws Exception
	 */
	public Amove(String s) throws Exception
	{
		String[] ss = s.split(" ");
		startx=Integer.parseInt(ss[0]);
		starty=Integer.parseInt(ss[1]);
		endx=Integer.parseInt(ss[2]);
		endy=Integer.parseInt(ss[3]);
	}
}
