jrummikub.util
Class Event2<T1,T2>

java.lang.Object
  extended by jrummikub.util.Event2<T1,T2>
Type Parameters:
T1 - type of the first event parameter
T2 - 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


Field Summary
private  java.util.HashSet<IListener2<T1,T2>> listeners
           
 
Constructor Summary
Event2()
           
 
Method Summary
 Connection add(IListener2<T1,T2> listener)
          Start to publish all events to a given listener
 void emit(T1 value1, T2 value2)
          Generate a single event
 void remove(IListener2<T1,T2> listener)
          Stop publishing events to a given listener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listeners

private java.util.HashSet<IListener2<T1,T2>> listeners
Constructor Detail

Event2

public Event2()
Method Detail

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 parameter
value2 - the second event parameter