jrummikub.util
Class Event2<T1,T2>
java.lang.Object
jrummikub.util.Event2<T1,T2>
- Type Parameters:
T1
- type of the first event parameterT2
- type of the second event parameter
- All Implemented Interfaces:
- IEvent2<T1,T2>
public class Event2<T1,T2>
- extends java.lang.Object
- implements IEvent2<T1,T2>
Simple single parameter event generator
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
listeners
private java.util.HashSet<IListener2<T1,T2>> listeners
Event2
public Event2()
add
public Connection add(IListener2<T1,T2> listener)
- Description copied from interface:
IEvent2
- Start to publish all events to a given listener
- Specified by:
add
in interface IEvent2<T1,T2>
- Parameters:
listener
- target listener
- Returns:
- a connection to remove the listener
remove
public void remove(IListener2<T1,T2> listener)
- Description copied from interface:
IEvent2
- Stop publishing events to a given listener
- Specified by:
remove
in interface IEvent2<T1,T2>
- Parameters:
listener
- target listener
emit
public void emit(T1 value1,
T2 value2)
- Generate a single event
- Parameters:
value1
- the first event parametervalue2
- the second event parameter