// Path: src/main/java/com/onkiup/minedroid/gui/events/Event.java
// public interface Event<Argument> {
//     /**
//      * Handles event
//      * @param event event information
//      */
//     void handle(Argument event);
// }


import com.onkiup.minedroid.gui.events.Event;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
package com.onkiup.minedroid;



/**
 * Parent class for all event emitters
 */
public class EventBase {
    protected HashMap<Class, ArrayList<WeakReference<Event>>> eventListeners = new HashMap<Class, ArrayList<WeakReference<Event>>>();

    /**
     * Binds event listener via WeakReference (event type is determined by listener class)
     * @param listener event listener
     */
    public void on(Event listener) {
        Class eventType = getEventClass(listener.getClass());
        if (!eventListeners.containsKey(eventType)) {
            eventListeners.put(eventType, new ArrayList<WeakReference<Event>>());
        }

// Path: src/main/java/com/onkiup/minedroid/gui/events/Event.java
// public interface Event<Argument> {
//     /**
//      * Handles event
//      * @param event event information
//      */
//     void handle(Argument event);
// }


// Path: src/main/java/com/onkiup/minedroid/EventBase.java
import com.onkiup.minedroid.gui.events.Event;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;

package com.onkiup.minedroid;



/**
 * Parent class for all event emitters
 */
public class EventBase {
    protected HashMap<Class, ArrayList<WeakReference<Event>>> eventListeners = new HashMap<Class, ArrayList<WeakReference<Event>>>();

    /**
     * Binds event listener via WeakReference (event type is determined by listener class)
     * @param listener event listener
     */
    public void on(Event listener) {
        Class eventType = getEventClass(listener.getClass());
        if (!eventListeners.containsKey(eventType)) {
            eventListeners.put(eventType, new ArrayList<WeakReference<Event>>());
        }

        eventListeners.get(eventType).add(new WeakReference<Event>(listener));