public abstract class AbstractEventStream extends java.lang.Object implements EventStream
Modifier and Type | Field and Description |
---|---|
private java.util.List<EventListener> |
listeners
Listeners that are notified of a new events.
|
Constructor and Description |
---|
AbstractEventStream() |
Modifier and Type | Method and Description |
---|---|
void |
addEventListener(EventListener listener)
Adds a listener.
|
protected void |
clearListeners(int code,
java.lang.String phrase)
Removes all listeners.
|
int |
getListenerCount()
Helper method that returns the current number of subscribed listeners.
|
protected void |
notifyListeners(Event event)
Notifies all listeners of an event
|
void |
removeEventListener(EventListener listener)
Removes a listener.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, isEventStreamClosed
private final java.util.List<EventListener> listeners
public void addEventListener(EventListener listener)
addEventListener
in interface EventStream
listener
- Reference to the class that implements EventListener
.public void removeEventListener(EventListener listener)
removeEventListener
in interface EventStream
listener
- Reference to the class that implements EventListener
.public int getListenerCount()
getListenerCount
in interface EventStream
protected void notifyListeners(Event event)
event
- the eventprotected void clearListeners(int code, java.lang.String phrase)
code
- an integer code to represent the reason for closingphrase
- a String representation of code