package hu.kazocsaba.gamecracker.game.tictactoe;

import hu.kazocsaba.gamecracker.game.Move;
import hu.kazocsaba.gamecracker.game.SquareSymmetry;

/**
 * A move in Tic Tac Toe.
 * @author Kazó Csaba
 */
public class TicTacToeMove extends Move<TicTacToeMove, SquareSymmetry> {
	private int x, y;

	/**
	 * Returns a move where the player marks the cell at the intersection of column x and row y.
	 * @param x the column index
	 * @param y the row index
	 */
	public static TicTacToeMove get(int x, int y) {
		return new TicTacToeMove(x, y);
	}
	
	private TicTacToeMove(int x, int y) {
		if (x<0 || x>=3) throw new IllegalArgumentException("Invalid x: "+x);
		if (y<0 || y>=3) throw new IllegalArgumentException("Invalid y: "+y);
		this.x = x;
		this.y = y;
	}
	
	@Override
	public TicTacToeMove transform(SquareSymmetry t) {
		return new TicTacToeMove(t.transformX(x, y, 3), t.transformY(x, y, 3));
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}

	@Override
	public String toString() {
		return String.format("%s%s", 'a'+x, y+1);
	}

	@Override
	public int hashCode() {
		return 4*x+y;
	}

	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof TicTacToeMove)) return false;
		final TicTacToeMove other = (TicTacToeMove)obj;
		return x==other.x && y==other.y;
	}

}

@@ -900,43 +900,272 @@
 %7D%0A%0A%09
-public int getX() %7B%0A%09%09return x;%0A%09%7D%0A
+/**%0A%09 * Returns the x coordinate of the move.%0A%09 * %0A%09 * @return the index of the column where the move is made%0A%09 */%0A%09public int getX() %7B%0A%09%09return x;%0A%09%7D%0A%0A%09/**%0A%09 * Returns the y coordinate of the move.%0A%09 * %0A%09 * @return the index of the row where the move is made%0A%09 */
 %0A%09pu

Add missing Javadoc to TicTacToeMove.