package ru.job4j.chess.model;

import ru.job4j.chess.exceptions.ImpossibleMoveException;

/**
 * This class describes the figure knight of the chess.
 *
 * @author Kucykh Vasily (mailto:basil135@mail.ru)
 * @version $Id$
 * @since 24.04.2017
 */
public class Knight extends Figure {

    /**
     * constructor of this figure.
     *
     * @param position is position on the board
     * @param fraction is the fraction
     */
    public Knight(Cell position, Fraction fraction) {
        super(position, fraction);
    }

    /**
     * method describes way of the figure from position to destination.
     *
     * @param destination is cell as destination on the board.
     * @return array of cell as way of the figure
     * @throws ImpossibleMoveException if this figure can not move from position to destination
     */
    @Override
    Cell[] way(Cell destination) throws ImpossibleMoveException {

        if ((Math.abs(position.getX() - destination.getX()) != 2 || Math.abs(position.getY() - destination.getY()) != 1)
         && (Math.abs(position.getX() - destination.getX()) != 1 || Math.abs(position.getY() - destination.getY()) != 2)) {
            throw new ImpossibleMoveException();
        }

        Cell[] result = new Cell[1];

        result[0] = destination;

        return result;

    }

}

@@ -1311,10 +1311,291 @@
 %0A    %7D%0A%0A
+    /**%0A     * method clone figure and return new figure.%0A     *%0A     * @param destination is cell as position of new figure%0A     * @return clone figure%0A     */%0A    @Override%0A    public Figure clone(Cell destination) %7B%0A        return new Knight(destination, this.fraction);%0A    %7D%0A%0A
 %7D%0A

Refactor Knight.java add method clone