jtransc.game.util.Signal Maven / Gradle / Ivy
package jtransc.game.util;
import java.util.ArrayList;
public class Signal {
public interface Handler {
void handle(T value);
}
ArrayList> handlers = null;
public void add(Handler value) {
if (handlers == null) {
handlers = new ArrayList>();
}
handlers.add(value);
}
public void remove(Handler value) {
if (handlers != null) {
handlers.remove(value);
}
}
public void dispatch(T value) {
if (handlers != null) {
for (Handler handler : handlers) {
handler.handle(value);
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy