/** * returns the first piece at the specified location that is not marked as 'captured'. * * @param row one of Piece.ROW_.. * @param column one of Piece.COLUMN_.. * @return the first not captured piece at the specified location */ public Piece getNonCapturedPieceAtLocation(int row, int column) { for (Piece piece : this.pieces) { if (piece.getRow() == row && piece.getColumn() == column && piece.isCaptured() == false) { return piece; } } return null; }
/** * Checks whether there is a piece at the specified location that is not marked as 'captured' and * has the specified color. * * @param color one of Piece.COLOR_.. * @param row one of Piece.ROW_.. * @param column on of Piece.COLUMN_.. * @return true, if the location contains a not-captured piece of the specified color */ private boolean isNonCapturedPieceAtLocation(int color, int row, int column) { for (Piece piece : this.pieces) { if (piece.getRow() == row && piece.getColumn() == column && piece.isCaptured() == false && piece.getColor() == color) { return true; } } return false; }