Rename event and listener methods
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@81 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
bcc3f95847
commit
6161c4b1d4
12 changed files with 69 additions and 69 deletions
|
@ -4,22 +4,22 @@ import java.util.HashSet;
|
|||
|
||||
/** Simple parameterless event generator */
|
||||
public class Event implements IEvent {
|
||||
private HashSet<IListener> listeners = new HashSet<IListener>();
|
||||
private HashSet<IListener> listeners = new HashSet<IListener>();
|
||||
|
||||
@Override
|
||||
public void add(IListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
@Override
|
||||
public void add(IListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(IListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
@Override
|
||||
public void remove(IListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
/** Generate a single event */
|
||||
public void fire() {
|
||||
for (IListener listener : listeners) {
|
||||
listener.fire();
|
||||
}
|
||||
}
|
||||
/** Generate a single event */
|
||||
public void emit() {
|
||||
for (IListener listener : listeners) {
|
||||
listener.handle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,9 +27,9 @@ public class Event1<T> implements IEvent1<T> {
|
|||
* @param value
|
||||
* the event parameter
|
||||
*/
|
||||
public void fire(T value) {
|
||||
public void emit(T value) {
|
||||
for (IListener1<T> listener : listeners) {
|
||||
listener.fire(value);
|
||||
listener.handle(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,9 +31,9 @@ public class Event2<T1, T2> implements IEvent2<T1, T2> {
|
|||
* @param value2
|
||||
* the second event parameter
|
||||
*/
|
||||
public void fire(T1 value1, T2 value2) {
|
||||
public void emit(T1 value1, T2 value2) {
|
||||
for (IListener2<T1, T2> listener : listeners) {
|
||||
listener.fire(value1, value2);
|
||||
listener.handle(value1, value2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,6 @@ package jrummikub.util;
|
|||
* Interface for classes that can receive parameterless events
|
||||
*/
|
||||
public interface IListener {
|
||||
/** This method is called whenever a class we're listening to emits an event */
|
||||
public void fire();
|
||||
/** This method is called whenever a class we're listening to emits an event */
|
||||
public void handle();
|
||||
}
|
||||
|
|
|
@ -14,5 +14,5 @@ public interface IListener1<T> {
|
|||
* @param value
|
||||
* the event parameter
|
||||
*/
|
||||
public void fire(T value);
|
||||
public void handle(T value);
|
||||
}
|
||||
|
|
|
@ -18,5 +18,5 @@ public interface IListener2<T1, T2> {
|
|||
* @param value2
|
||||
* the second event parameter
|
||||
*/
|
||||
public void fire(T1 value1, T2 value2);
|
||||
public void handle(T1 value1, T2 value2);
|
||||
}
|
||||
|
|
Reference in a new issue