blob: 93e8228e34739cddb79b686b769b3108eb0d2982 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package jrummikub.util;
import java.util.HashSet;
public class MockEvent2<T1, T2> implements IEvent2<T1, T2> {
public HashSet<IListener2<T1, T2>> listeners = new HashSet<IListener2<T1, T2>>();
@Override
public void add(IListener2<T1, T2> listener) {
listeners.add(listener);
}
@Override
public void remove(IListener2<T1, T2> listener) {
listeners.remove(listener);
}
public void emit(T1 value1, T2 value2) {
for (IListener2<T1, T2> listener : listeners) {
listener.handle(value1, value2);
}
}
}
|