<commit_before>package joshie.enchiridion.gui.book.features;

import com.google.common.collect.Lists;
import joshie.enchiridion.api.EnchiridionAPI;
import joshie.enchiridion.api.book.IBook;
import joshie.enchiridion.api.book.IFeatureProvider;
import joshie.enchiridion.api.book.IPage;
import joshie.enchiridion.api.gui.ISimpleEditorFieldProvider;
import joshie.enchiridion.gui.book.GuiBook;
import joshie.enchiridion.gui.book.GuiSimpleEditor;
import joshie.enchiridion.gui.book.GuiSimpleEditorGeneric;
import joshie.enchiridion.helpers.JumpHelper;
import net.minecraft.client.renderer.GlStateManager;
import org.lwjgl.opengl.GL11;

import static org.lwjgl.opengl.GL11.GL_SCISSOR_TEST;
import static org.lwjgl.opengl.GL11.glDisable;

public class FeaturePreviewWindow extends FeatureAbstract implements ISimpleEditorFieldProvider {
    public int pageNumber;
    public transient IPage page;
    public transient IBook book;
    public transient IPage thisPage;
    public transient boolean isDragging;
    public transient int startY;

    public FeaturePreviewWindow() {}
    public FeaturePreviewWindow(int page) {
        this.pageNumber = page;
    }

    @Override
    public void onFieldsSet(String field) {
        page = JumpHelper.getPageByNumber(book, pageNumber - 1);
    }

    @Override
    public FeaturePreviewWindow copy() {
        return new FeaturePreviewWindow(pageNumber);
    }

    @Override
    public String getName() {
        return "Scroll: " + page;
    }

    @Override
    public void update(IFeatureProvider position) {
        super.update(position);
        thisPage = position.getPage();
        book = position.getPage().getBook();
        page = JumpHelper.getPageByNumber(book, pageNumber);
    }

    @Override
    public boolean getAndSetEditMode() {
        GuiSimpleEditor.INSTANCE.setEditor(GuiSimpleEditorGeneric.INSTANCE.setFeature(this));
        return false;
    }

    private boolean isOverScrollY(int yCheck, int x, int y) {
        return x >= position.getRight() - 10 && x <= position.getRight() && y >= position.getTop() + yCheck && y <= position.getTop() + yCheck + 10;
    }<commit_msg>Damn nulls.<commit_after>package joshie.enchiridion.gui.book.features;

import com.google.common.collect.Lists;
import joshie.enchiridion.api.EnchiridionAPI;
import joshie.enchiridion.api.book.IBook;
import joshie.enchiridion.api.book.IFeatureProvider;
import joshie.enchiridion.api.book.IPage;
import joshie.enchiridion.api.gui.ISimpleEditorFieldProvider;
import joshie.enchiridion.gui.book.GuiBook;
import joshie.enchiridion.gui.book.GuiSimpleEditor;
import joshie.enchiridion.gui.book.GuiSimpleEditorGeneric;
import joshie.enchiridion.helpers.JumpHelper;
import net.minecraft.client.renderer.GlStateManager;
import org.lwjgl.opengl.GL11;

import static org.lwjgl.opengl.GL11.GL_SCISSOR_TEST;
import static org.lwjgl.opengl.GL11.glDisable;

public class FeaturePreviewWindow extends FeatureAbstract implements ISimpleEditorFieldProvider {
    public int pageNumber;
    public transient IPage page;
    public transient IBook book;
    public transient IPage thisPage;
    public transient boolean isDragging;
    public transient int startY;

    public FeaturePreviewWindow() {}
    public FeaturePreviewWindow(int page) {
        this.pageNumber = page;
    }

    @Override
    public void onFieldsSet(String field) {
        page = JumpHelper.getPageByNumber(book, pageNumber - 1);
    }

    @Override
    public FeaturePreviewWindow copy() {
        return new FeaturePreviewWindow(pageNumber);
    }

    @Override
    public String getName() {
        return "Scroll: " + page;
    }

    @Override
    public void update(IFeatureProvider position) {
        super.update(position);
        thisPage = position.getPage();
        book = position.getPage().getBook();
        if (book != null && book.getPages() != null) {
            page = JumpHelper.getPageByNumber(book, pageNumber);
        }
    }

    @Override
    public boolean getAndSetEditMode() {
        GuiSimpleEditor.INSTANCE.setEditor(GuiSimpleEditorGeneric.INSTANCE.setFeature(this));
        return false;
    }

    private boolean isOverScrollY(int yCheck, int x, int y) {
        return x >= position.getRight() - 10 && x <= position.getRight() && y >= position.getTop() + yCheck && y <= position.getTop() + yCheck + 10;
    }
{'fraction_non_alphanumeric': 0.09652953344058837, 'fraction_numerical': 0.00505630889450701, 'mean_word_length': 3.7304347826086954, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4444227', 'n_tokens_mistral': 1402, 'n_tokens_neox': 1335, 'n_words': 272}