<commit_before>package com.kduda.battleships.models.board;

import com.kduda.battleships.models.units.Unit;
import javafx.event.EventHandler;
import javafx.scene.Parent;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;

public class Board extends Parent {
    public int units = 19;
    private VBox column = new VBox();
    private boolean isEnemyBoard = false;


    public Board(boolean isEnemyBoard, EventHandler<? super MouseEvent> mouseClickHandler, EventHandler<? super MouseEvent> mouseMovedHandler) {
        this.isEnemyBoard = isEnemyBoard;
        for (int y = 0; y < 22; y++) {
            HBox row = new HBox();
            for (int x = 0; x < 14; x++) {
                Cell cell = new Cell(x, y, this);
                cell.setOnMouseClicked(mouseClickHandler);
                cell.setOnMouseMoved(mouseMovedHandler);
                row.getChildren().add(cell);
            }
            column.getChildren().add(row);
        }
        getChildren().add(column);
    }

    public boolean placeUnit(Unit unit, Position position) {
        return true;
    }

    public Cell getCell(Position position) {
//        return (Cell) ((HBox) column.getChildren().get(y)).getChildren().get(x);
    }


//    public boolean placeShip(Ship ship, int x, int y) {
//        if (canPlaceShip(ship, x, y)) {<commit_msg>Add getCell implementation<commit_after>package com.kduda.battleships.models.board;

import com.kduda.battleships.models.units.Unit;
import javafx.event.EventHandler;
import javafx.scene.Parent;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;

public class Board extends Parent {
    public int units = 19;
    private VBox column = new VBox();
    private boolean isEnemyBoard = false;


    public Board(boolean isEnemyBoard, EventHandler<? super MouseEvent> mouseClickHandler, EventHandler<? super MouseEvent> mouseMovedHandler) {
        this.isEnemyBoard = isEnemyBoard;
        for (int y = 0; y < 22; y++) {
            HBox row = new HBox();
            for (int x = 0; x < 14; x++) {
                Cell cell = new Cell(x, y, this);
                cell.setOnMouseClicked(mouseClickHandler);
                cell.setOnMouseMoved(mouseMovedHandler);
                row.getChildren().add(cell);
            }
            column.getChildren().add(row);
        }
        getChildren().add(column);
    }

    public boolean placeUnit(Unit unit, Position position) {
        return true;
    }

    public Cell getCell(Position position) {
        HBox row = (HBox) column.getChildren().get(position.getY());
        return (Cell) row.getChildren().get(position.getY());
    }


//    public boolean placeShip(Ship ship, int x, int y) {
//        if (canPlaceShip(ship, x, y)) {
{'fraction_non_alphanumeric': 0.11556185749734137, 'fraction_numerical': 0.005671747607231478, 'mean_word_length': 2.641290322580645, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, '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': '248315', 'n_tokens_mistral': 871, 'n_tokens_neox': 840, 'n_words': 209}