<commit_before>package com.example.pac.pacman;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;

public class Labyrinth {

    private final int _width = 20;
    private final int _height = 20;

    private enum LayoutType {
        Space,
        WallHorizontal,
        WallVertical,
    }
    private LayoutType layout[][] = new LayoutType[_width][_height];

    private RectF _bounds;
    private float _cellWidth;
    private float _cellHeight;

    private Paint _backgroundPaint;
    private Paint _wallPaint;

    public Labyrinth() {
        init();
    }

    private void init() {
        initTestLabyrinth();

        _backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        _backgroundPaint.setStyle(Paint.Style.FILL);
        _backgroundPaint.setColor(Color.BLACK);

        _wallPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        _wallPaint.setColor(Color.BLUE);
        _wallPaint.setStrokeWidth(5);
    }

    private void initTestLabyrinth() {
        for (int i = 0; i < _width; i++) {
            layout[i][0] = LayoutType.WallHorizontal;
            layout[i][_height-1] = LayoutType.WallHorizontal;
        }
        for (int i = 0; i < _height; i++) {
            layout[0][i] = LayoutType.WallVertical;
            layout[_width-1][i] = LayoutType.WallVertical;
        }
    }

    public void setBounds(RectF bounds) {
        _bounds = bounds;
        _cellWidth = bounds.width() / _width;
        _cellHeight = bounds.height() / _height;
    }

    public void draw(Canvas canvas) {
        canvas.drawRect(_bounds, _backgroundPaint);

        for (int i = 0; i < _width; i++) {
            for (int j = 0; j < _height; j++) {
                if (layout[i][j] == LayoutType.WallVertical) {
                    float startX = _cellWidth*i+_cellWidth/2;
                    float startY = _cellHeight*j;
                    float stopX = startX;
                    float stopY = startY*(j+1);
                    canvas.drawLine(startX, startY, stopX, stopY, _wallPaint);
                } else if (layout[i][j] == LayoutType.WallHorizontal) {
                    float startX = _cellWidth*i;
                    float startY = _cellHeight*j+_cellWidth/2;
                    float stopX = _cellWidth*(i+1);
                    float stopY = startY;
                    canvas.drawLine(startX, startY, stopX, stopY, _wallPaint);
                }
            }
        }
    }
}<commit_msg>Labyrinth invalidate - stub for the future<commit_after>package com.example.pac.pacman;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;

public class Labyrinth {

    private final int _width = 20;
    private final int _height = 20;

    private enum LayoutType {
        Space,
        WallHorizontal,
        WallVertical,
    }
    private LayoutType layout[][] = new LayoutType[_width][_height];

    private RectF _bounds;
    private float _cellWidth;
    private float _cellHeight;

    private Paint _backgroundPaint;
    private Paint _wallPaint;

    public Labyrinth() {
        init();
    }

    private void init() {
        initTestLabyrinth();

        _backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        _backgroundPaint.setStyle(Paint.Style.FILL);
        _backgroundPaint.setColor(Color.BLACK);

        _wallPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        _wallPaint.setColor(Color.BLUE);
        _wallPaint.setStrokeWidth(5);
    }

    private void initTestLabyrinth() {
        for (int i = 0; i < _width; i++) {
            layout[i][0] = LayoutType.WallHorizontal;
            layout[i][_height-1] = LayoutType.WallHorizontal;
        }
        for (int i = 0; i < _height; i++) {
            layout[0][i] = LayoutType.WallVertical;
            layout[_width-1][i] = LayoutType.WallVertical;
        }
    }

    public void setBounds(RectF bounds) {
        _bounds = bounds;
        _cellWidth = bounds.width() / _width;
        _cellHeight = bounds.height() / _height;
    }

    public void draw(Canvas canvas) {
        canvas.drawRect(_bounds, _backgroundPaint);

        for (int i = 0; i < _width; i++) {
            for (int j = 0; j < _height; j++) {
                if (layout[i][j] == LayoutType.WallVertical) {
                    float startX = _cellWidth*i+_cellWidth/2;
                    float startY = _cellHeight*j;
                    float stopX = startX;
                    float stopY = startY*(j+1);
                    canvas.drawLine(startX, startY, stopX, stopY, _wallPaint);
                } else if (layout[i][j] == LayoutType.WallHorizontal) {
                    float startX = _cellWidth*i;
                    float startY = _cellHeight*j+_cellWidth/2;
                    float stopX = _cellWidth*(i+1);
                    float stopY = startY;
                    canvas.drawLine(startX, startY, stopX, stopY, _wallPaint);
                }
            }
        }
    }

    /*
        TODO Stub for the future
        Redraw given rectangle
     */
    public void invalidate(RectF bounds) {}
}
{'fraction_non_alphanumeric': 0.10277831746648533, 'fraction_numerical': 0.006605789780454634, 'mean_word_length': 1.9637305699481866, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, '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': '5827602', 'n_tokens_mistral': 1568, 'n_tokens_neox': 1474, 'n_words': 345}