<commit_before>package xyz.openmodloader.event;

import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

/**
 * A bus for posting events to and registering event listeners.
 *
 * @see xyz.openmodloader.OpenModLoader#getEventBus()
 */
public class EventBus {
    private final ConcurrentHashMap<Class<? extends Event>, List<EventExecutor<?>>> map = new ConcurrentHashMap<>();

    /**
     * Registers a handler for the given event type.
     *
     * @param clazz   The event class.
     * @param handler The event handler.
     * @param <T>     The event type.
     */
    public <T extends Event> void register(Class<T> clazz, EventExecutor<T> handler) {
        if (!map.containsKey(clazz)) {
            map.put(clazz, new ArrayList<>());
        }
        map.get(clazz).add(handler);
    }

	/**
     * Registers all the methods of the given object that take a single parameter that extends {@link Event} and have {@link EventHandler}
     * @param object
     */
    public void register(Object object) {
        for (Method m : object.getClass().getDeclaredMethods()) {
            if (m.isAnnotationPresent(EventHandler.class)) {
                Parameter[] params = m.getParameters();
                if (params.length == 1 && Event.class.isAssignableFrom(params[0].getType())) {
                    m.setAccessible(true);<commit_msg>Fix tab<commit_after>package xyz.openmodloader.event;

import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

/**
 * A bus for posting events to and registering event listeners.
 *
 * @see xyz.openmodloader.OpenModLoader#getEventBus()
 */
public class EventBus {
    private final ConcurrentHashMap<Class<? extends Event>, List<EventExecutor<?>>> map = new ConcurrentHashMap<>();

    /**
     * Registers a handler for the given event type.
     *
     * @param clazz   The event class.
     * @param handler The event handler.
     * @param <T>     The event type.
     */
    public <T extends Event> void register(Class<T> clazz, EventExecutor<T> handler) {
        if (!map.containsKey(clazz)) {
            map.put(clazz, new ArrayList<>());
        }
        map.get(clazz).add(handler);
    }

    /**
     * Registers all the methods of the given object that take a single parameter that extends {@link Event} and have {@link EventHandler}
     * @param object
     */
    public void register(Object object) {
        for (Method m : object.getClass().getDeclaredMethods()) {
            if (m.isAnnotationPresent(EventHandler.class)) {
                Parameter[] params = m.getParameters();
                if (params.length == 1 && Event.class.isAssignableFrom(params[0].getType())) {
                    m.setAccessible(true);
{'fraction_non_alphanumeric': 0.11894121691302853, 'fraction_numerical': 0.0013750429700928155, 'mean_word_length': 2.864541832669323, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '3949736', 'n_tokens_mistral': 814, 'n_tokens_neox': 807, 'n_words': 230}