jrummikub.util
Class Event1<T>

java.lang.Object
  extended by jrummikub.util.Event1<T>
Type Parameters:
T - type of the event parameter
All Implemented Interfaces:
IEvent1<T>

public class Event1<T>
extends java.lang.Object
implements IEvent1<T>

Simple single parameter event generator


Field Summary
private  java.util.HashSet<IListener1<T>> listeners
           
 
Constructor Summary
Event1()
           
 
Method Summary
 Connection add(IListener1<T> listener)
          Start to publish all events to a given listener
 void emit(T value)
          Generate a single event
 void remove(IListener1<T> 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<IListener1<T>> listeners
Constructor Detail

Event1

public Event1()
Method Detail

add

public Connection add(IListener1<T> listener)
Description copied from interface: IEvent1
Start to publish all events to a given listener

Specified by:
add in interface IEvent1<T>
Parameters:
listener - target listener
Returns:
a connection to remove the listener

remove

public void remove(IListener1<T> listener)
Description copied from interface: IEvent1
Stop publishing events to a given listener

Specified by:
remove in interface IEvent1<T>
Parameters:
listener - target listener

emit

public void emit(T value)
Generate a single event

Parameters:
value - the event parameter