public class EventEmitter extends Object
Modifier and Type | Class | Description |
---|---|---|
static interface |
EventEmitter.EventObserver<C> |
Observes events emitted by EventEmitter
|
Modifier and Type | Field | Description |
---|---|---|
private Map<Class<?>,List<EventEmitter.EventObserver>> |
events |
|
private Deque<Object[]> |
pendingOps |
Constructor | Description |
---|---|
EventEmitter() |
EventEmitter that allows unknown events; must use concurrent collection
for multithreading since new event classes may be added at any time.
|
EventEmitter(Class... knownEventClasses) |
EventEmitter with a fixed set of known events; the 'events' map
can then be made unmodifiable and non-concurrent for speed.
|
Modifier and Type | Method | Description |
---|---|---|
void |
emit(Class eventClass,
Object... params) |
|
boolean |
isActive(Class event) |
|
protected List<EventEmitter.EventObserver> |
newObserverList() |
|
void |
off(Class<?> event,
EventEmitter.EventObserver o) |
|
void |
on(Class<?> event,
EventEmitter.EventObserver o) |
|
void |
set(EventEmitter.EventObserver o,
boolean enable,
Class... events) |
for enabling many events at the same time
|
void |
synch() |
private final Map<Class<?>,List<EventEmitter.EventObserver>> events
public EventEmitter()
public EventEmitter(Class... knownEventClasses)
protected List<EventEmitter.EventObserver> newObserverList()
public final boolean isActive(Class event)
public void synch()
public void on(Class<?> event, EventEmitter.EventObserver o)
public void off(Class<?> event, EventEmitter.EventObserver o)
event
- o
- public void set(EventEmitter.EventObserver o, boolean enable, Class... events)
Copyright © 2020 OpenNARS. All rights reserved.