|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
@Revision(value="$Revision: 1.13 $",
date="$Date: 2006/12/15 20:37:49 $",
tag="$Name: $")
public interface EventSyndicate
A syndicate which distributes events from a single EventSource to many
EventSinks, according to the Class of the event
and the class of events for which the event sink was registered with
add(Reference, Class). For a more in depth discussion
of the event model, see rcf.core.concurrent.events.
Note that the methods of this interface are compatible with both
Collection and
MapCollection. This is vital as it means
that this interface can be easily implemented by either a map or a
collection.
TODO: Javadoc review, Seal/Finalize
| Method Summary | ||
|---|---|---|
|
add(Reference<EventSink<? super E>> _sinkReference,
Class<E> _class)
Register an event sink to receive all of the events from the EventSource for this syndicate, which are
assignable to the
specified class. |
|
boolean |
event(Event event)
Report the event to all EventSinks which have been registered
through add(Reference, Class) with
_class.isAssignableFrom(event.getClass()). |
|
boolean |
isEmpty()
Check if this event syndicate is empty; . |
|
|
remove(Reference<EventSink<? super E>> _sinkReference,
Class<E> _class)
Deregister an event sink to stop receiving events from the EventSource for this syndicate. |
|
int |
size()
Get the number of event sinks which have been registered with the syndicate. |
|
| Method Detail |
|---|
<E extends Event> ImmutableIterator<?> add(Reference<EventSink<? super E>> _sinkReference,
Class<E> _class)
EventSource for this syndicate, which are
assignable to the
specified class.
_sinkReference - A reference to the event sink, which this
syndicate is supposed to call
EventSink.event(Event) on. Notice
that this is a reference, so that
WeakReferences
can be used to avoid having this syndicate
send events to an event sink which would
otherwise have been garbage collected._class - The class of events the EventSink
specified by _sinkReference
wants to receive from this syndicate.
Collection and
MapCollection.boolean event(Event event)
EventSinks which have been registered
through add(Reference, Class) with
_class.isAssignableFrom(event.getClass()). Note the the
reporting of an event will be interrupted if the
Event.isCancelled() method returns true. An
event syndicate must not report a cancelled event to any event
sink, however it may report an event which will later be cancelled.
event in interface EventSink<Event>event - The event from the EventSource, which is to be
reported to all of the EventSinks registered
through add(Reference, Class).
true if the syndicate isn't empty.
false to indicate that the syndicate can
be freed.EventSink.event(rcf.core.concurrent.events.Event)boolean isEmpty()
size() == 0.
true if this syndicate is empty.
<E extends Event> ImmutableIterator<?> remove(Reference<EventSink<? super E>> _sinkReference,
Class<E> _class)
EventSource for this syndicate.
_sinkReference - A reference to the event sink, which this
syndicate should no longer report events to.
Note that the
Reference.type()
of the reference is immaterial._class - The class of events the EventSink
specified by _sinkReference
was to receiving from this syndicate.
Collection and
MapCollection.int size()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||