<commit_before>package com.continuum.nova.input;

import java.util.HashMap;
import java.util.Map;

import com.continuum.nova.NovaNative;
import com.continuum.nova.NovaNative.mouse_button_event;
import com.continuum.nova.NovaNative.mouse_position_event;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;


public class Mouse {
    private static boolean created;
    private static int x;
    private static int y;
    private static int absolute_x;
    private static int absolute_y;
    private static int dx;
    private static int dy;
    private static int dwheel;
    private static int buttonCount = -1;
    private static boolean hasWheel;
    private static String[] buttonName;
    private static final Map<String, Integer> buttonMap = new HashMap(16);
    private static boolean initialized;
    private static int eventButton;
    private static boolean eventState;
    private static int event_dx;
    private static int event_dy;
    private static int event_dwheel;
    private static int event_x;
    private static int event_y;
    private static long event_nanos;
    private static int grab_x;
    private static int grab_y;
    private static int last_event_raw_x;
    private static int last_event_raw_y;
    private static boolean isGrabbed;

    private Mouse() {
    }

    public static boolean isClipMouseCoordinatesToWindow() {
        return false;
    }

    public static void setClipMouseCoordinatesToWindow(boolean clip) {

    }

    public static void setCursorPosition(int new_x, int new_y) {

    }

    private static void initialize() {
        if (!initialized) {
            buttonName = new String[16];

            for (int i = 0; i < 16; ++i) {
                buttonName[i] = "BUTTON" + i;
                buttonMap.put(buttonName[i], Integer.valueOf(i));
            }
            initialized = true;
        }
    }

    private static void resetMouse() {
        dwheel = 0;
        dy = 0;
        dx = 0;
    }


    public static void create() {
        if (!created) {
            initialize();
            created = true;
        }
    }

    public static boolean isCreated() {
        return created;
    }

    public static void destroy() {

    }


    public static boolean isButtonDown(int button) {
        return false;
    }

    public static String getButtonName(int button) {
        return button < buttonName.length && button >= 0 ? buttonName[button] : null;
    }

    public static int getButtonIndex(String buttonName) {
        Integer ret = (Integer) buttonMap.get(buttonName);
        return ret == null ? -1 : ret.intValue();
    }

    public static boolean next() {
        mouse_button_event e = NovaNative.INSTANCE.get_next_mouse_button_event();
        mouse_position_event p = NovaNative.INSTANCE.get_next_mouse_position_event();
        NovaNative.mouse_scroll_event s = NovaNative.INSTANCE.get_next_mouse_scroll_event();
        if (e.filled == 0 && p.filled==0 && s.filled == 0){
            return false;
        }
        if (e.filled == 1){
            eventButton = e.button;
            eventState = e.action == 1;
            LogManager.getRootLogger().info("button: " +e.button +";action: "+e.action+ ";mods: "+e.mods +"; filled: "+e.filled);

        }else{
            eventButton = -1;
            eventState = false;
        }
        if(p.filled == 1 ){
            dx += p.xpos - event_x;
            dy += p.ypos -event_y;
            event_x = p.xpos;
            event_y = p.ypos;
        }
        if(s.filled == 1){
            event_dwheel = (int )s.yoffset;
            LogManager.getRootLogger().info("button: " +e.button +";action: "+e.action+ ";mods: "+e.mods +"; filled: "+e.filled);
        }else{
            event_dwheel = 0;
        }
        return true;
    }

    public static int getEventButton() {<commit_msg>fixed missing method implementation in Mouse<commit_after>package com.continuum.nova.input;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;

import com.continuum.nova.NovaNative;
import com.continuum.nova.NovaNative.mouse_button_event;
import com.continuum.nova.NovaNative.mouse_position_event;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;


public class Mouse {
    private static boolean created;
    private static int x;
    private static int y;
    private static int absolute_x;
    private static int absolute_y;
    private static int dx;
    private static int dy;
    private static int dwheel;
    private static int buttonCount = -1;
    private static boolean hasWheel;
    private static String[] buttonName;
    private static final Map<String, Integer> buttonMap = new HashMap(16);
    private static final HashSet<Integer> buttonDownBuffer = new HashSet<>();
    private static boolean initialized;
    private static int eventButton;
    private static boolean eventState;
    private static int event_dx;
    private static int event_dy;
    private static int event_dwheel;
    private static int event_x;
    private static int event_y;
    private static long event_nanos;
    private static int grab_x;
    private static int grab_y;
    private static int last_event_raw_x;
    private static int last_event_raw_y;
    private static boolean isGrabbed;

    private Mouse() {
    }

    public static boolean isClipMouseCoordinatesToWindow() {
        return false;
    }

    public static void setClipMouseCoordinatesToWindow(boolean clip) {

    }

    public static void setCursorPosition(int new_x, int new_y) {

    }

    private static void initialize() {
        if (!initialized) {
            buttonName = new String[16];

            for (int i = 0; i < 16; ++i) {
                buttonName[i] = "BUTTON" + i;
                buttonMap.put(buttonName[i], Integer.valueOf(i));
            }
            initialized = true;
        }
    }

    private static void resetMouse() {
        dwheel = 0;
        dy = 0;
        dx = 0;
    }


    public static void create() {
        if (!created) {
            initialize();
            created = true;
        }
    }

    public static boolean isCreated() {
        return created;
    }

    public static void destroy() {

    }


    public static boolean isButtonDown(int button) {
        return buttonDownBuffer.contains(button);
    }

    public static String getButtonName(int button) {
        return button < buttonName.length && button >= 0 ? buttonName[button] : null;
    }

    public static int getButtonIndex(String buttonName) {
        Integer ret = (Integer) buttonMap.get(buttonName);
        return ret == null ? -1 : ret.intValue();
    }

    public static boolean next() {
        mouse_button_event e = NovaNative.INSTANCE.get_next_mouse_button_event();
        mouse_position_event p = NovaNative.INSTANCE.get_next_mouse_position_event();
        NovaNative.mouse_scroll_event s = NovaNative.INSTANCE.get_next_mouse_scroll_event();
        if (e.filled == 0 && p.filled==0 && s.filled == 0){
            return false;
        }
        if (e.filled == 1){
            if (e.action ==1){
                buttonDownBuffer.add(e.button);

            } else{
                buttonDownBuffer.remove(e.button);
            }
            eventButton = e.button;
            eventState = e.action == 1;
            LogManager.getRootLogger().info("button: " +e.button +";action: "+e.action+ ";mods: "+e.mods +"; filled: "+e.filled);

        }else{
            eventButton = -1;
            eventState = false;
        }
        if(p.filled == 1 ){
            dx += p.xpos - event_x;
            dy += p.ypos -event_y;
            event_x = p.xpos;
            event_y = p.ypos;
        }
        if(s.filled == 1){
            event_dwheel = (int )s.yoffset;
            LogManager.getRootLogger().info("button: " +e.button +";action: "+e.action+ ";mods: "+e.mods +"; filled: "+e.filled);
        }else{
            event_dwheel = 0;
        }
        return true;
    }

    public static int getEventButton() {
{'fraction_non_alphanumeric': 0.09828528827037773, 'fraction_numerical': 0.006088469184890656, 'mean_word_length': 2.2786150712830957, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '2973815', 'n_tokens_mistral': 2384, 'n_tokens_neox': 2306, 'n_words': 638}