<commit_before>package ships.model;

import java.util.ArrayList;
import java.util.List;

/**
 * @author <NAME>
 */
public class Ship {

    /**
     * @return the size
     */
    public Size getSize() {
        return size;
    }

    /**
     * @return the position
     */
    public Field getPosition() {
        return position;
    }

    /**
     * @return the direction
     */
    public Direction getDirection() {
        return direction;
    }

    public enum Size {
        ONE(1), TWO(2), THREE(3), FOUR(4);

        private final int size;

        Size(int size) {
            this.size = size;
        }

        public int getSize() {
            return size;
        }
    }

    public enum Direction {
        HORIZONTAL, VERTICAL
    }

    private Size size;
    private Field position;
    private Direction direction;
    private Integer lives;

    /**
     * @param shipSize
     * @param startPosition
     * @param direction     <b>true</b> if vertical, <b>false</b> otherwise
     */
    public Ship(Size shipSize, Field startPosition, Direction direction) {
        this.size = shipSize;
        this.position = startPosition;
        this.direction = direction;
        this.lives = shipSize.getSize();
    }

    public void hitTheShip() {
        if (lives > 0) {
            lives--;
        }
    }

    public boolean isSunken() {
        return lives == 0;
    }
}<commit_msg>Implement generating list of fields occupied by ship<commit_after>package ships.model;

import java.util.ArrayList;
import java.util.List;

/**
 * @author <NAME>
 */
public class Ship {

    /**
     * @return the size
     */
    public Size getSize() {
        return size;
    }

    /**
     * @return the position
     */
    public Field getPosition() {
        return position;
    }

    /**
     * @return the direction
     */
    public Direction getDirection() {
        return direction;
    }

    public enum Size {
        ONE(1), TWO(2), THREE(3), FOUR(4);

        private final int size;

        Size(int size) {
            this.size = size;
        }

        public int getSize() {
            return size;
        }
    }

    public enum Direction {
        HORIZONTAL, VERTICAL
    }

    private Size size;
    private Field position;
    private Direction direction;
    private Integer lives;

    /**
     * @param shipSize
     * @param startPosition
     * @param direction     <b>true</b> if vertical, <b>false</b> otherwise
     */
    public Ship(Size shipSize, Field startPosition, Direction direction) {
        this.size = shipSize;
        this.position = startPosition;
        this.direction = direction;
        this.lives = shipSize.getSize();
    }

    public void hitTheShip() {
        if (lives > 0) {
            lives--;
        }
    }

    public boolean isSunken() {
        return lives == 0;
    }

    public List<Field> getFieldList() {
        List<Field> result = new ArrayList<>();
        for (int i = 0; i < this.getSize().getSize(); i++) {
            if (this.direction == Direction.HORIZONTAL) {
                result.add(new FieldImpl(
                        position.getRow(), position.getCol() + i));
            }
            else {
                result.add(new FieldImpl(
                        position.getRow() + i, position.getCol()));
            }
        }
        return result;
    }

}
{'fraction_non_alphanumeric': 0.11140661938534278, 'fraction_numerical': 0.0038416075650118202, 'mean_word_length': 1.6569858712715855, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5432211', 'n_tokens_mistral': 995, 'n_tokens_neox': 956, 'n_words': 259}