Add EventNode#removeChild

This commit is contained in:
TheMode 2021-06-02 19:52:05 +02:00
parent 11bdcdf92a
commit aa5a182788
2 changed files with 7 additions and 0 deletions

View File

@ -33,6 +33,8 @@ public interface EventNode<T extends Event> {
void addChild(@NotNull EventNode<? extends T> child);
void removeChild(@NotNull EventNode<? extends T> child);
void addListener(@NotNull EventListener<? extends T> listener);
void removeListener(@NotNull EventListener<? extends T> listener);

View File

@ -52,6 +52,11 @@ class EventNodeImpl<T extends Event> implements EventNode<T> {
this.children.add((EventNode<T>) child);
}
@Override
public void removeChild(@NotNull EventNode<? extends T> child) {
this.children.remove(child);
}
@Override
public void addListener(@NotNull EventListener<? extends T> listener) {
this.listenerMap.computeIfAbsent(listener.type, aClass -> new CopyOnWriteArrayList<>())