public interface InternalEventBusCapacity extends Capacity
This capacity is provided by the SRE kernel, not SARL.
Modifier and Type | Method and Description |
---|---|
void |
fireEvent(event : Event)
Fire the given event into the agent context, and do not wait for the termination of the event handlers.
|
void |
fireEvent(event : Event,
listener : Object)
Fire the given event into the agent context, and do not wait for the termination of the event handlers.
|
void |
fireEventAndWait(event : Event,
thrownExceptions : boolean)
Fire the given event into the agent context, and wait for the execution of all the event handlers.
|
void |
fireEventAndWait(event : Event,
thrownExceptions : boolean,
forceEventHandlerExecution : boolean,
listener : Object)
Fire the given event into the agent context, and wait for the execution of all the event handlers.
|
boolean |
fireEventAndWaitWithEventGathering(event : Event,
thrownExceptions : boolean,
bufferedEvents : OutParameter<List<org.eclipse.xtext.xbase.lib.Pair<Event,Object>>>,
beforeEventFiringHandler : org.eclipse.xtext.xbase.lib.Procedures.Procedure0,
beforeReturnHandler : BooleanSupplier)
Fire the given event into the agent context, and wait for the execution of all the event handlers.
|
InformedEventListener |
getAssociatedEventBusListener()
Replies the event listener linked to the owner of this capacity.
|
EventBus |
getEventBus()
Replies the backend event bus.
|
<T extends EventBus> |
getEventBus(type : Class<T>)
Replies the backend event bus.
|
<T> ConcurrentCollection<T> |
getRegisteredEventBusListeners(type : Class<T>)
Replies the registered listeners.
|
void |
registerEventBusListener(listener : Object,
[filter : (Event)=>Boolean],
[callback : (Object)=>void])
Register the given object on the event bus for receiving any event.
|
void |
unregisterEventBusListener(listenerType : Class<?>,
[callback : (Object)=>Boolean])
Unregister the listeners of the given type on the event bus for receiving any event.
|
void |
unregisterEventBusListener(listener : Object,
[callback : (Object)=>void])
Unregister the given object on the event bus for receiving any event.
|
def
registerEventBusListener(listener : Object,
[filter : (Event)=>Boolean],
[callback : (Object)=>void]) : void
InternalEventBusCapacity
If the filter is provided, it will be used for determining if the given behavior accepts a specific event.
If the filter function replies true
for a specific event as argument, the event is fired in the
behavior context. If the filter function replies false
, the event is not fired in the behavior context.
listener
- the listener on the SARL events.filter
- the filter function.callback
- function which is invoked just after the first registration of the object. It could be null
.def
unregisterEventBusListener(listener : Object,
[callback : (Object)=>void]) : void
InternalEventBusCapacity
listener
- the listener on the SARL events.callback
- function which is invoked just before the object is unregistered.def
unregisterEventBusListener(listenerType : Class<?>,
[callback : (Object)=>Boolean]) : void
InternalEventBusCapacity
listenerType
- the type of the listeners on the SARL events.callback
- function which is invoked just before the object is unregistered.
The callback functions replies true
if it should be called on the next removed object.
If it replies false
, it will be not called anymore.def
fireEventAndWait(event : Event,
thrownExceptions : boolean,
forceEventHandlerExecution : boolean,
listener : Object) : void
InternalEventBusCapacity
This function does not set the event's source if it is not already set.
All the exceptions thrown by the event handlers are gathered and fired into a single exception after all the event handlers have been executed or failed.
The events that are received during the execution of this function treated in the normal way, i.e. associated event handlers are run.
This function considers the agent's state for determining of the event should be fired or not. In other words, the given event may be fired or buffered depending on the event buffering flag.
event
- the event to fire.thrownExceptions
- indicates if any exception, which occurs into the event handler should be thrown outside this function.
If true
, an exception is thrown outside and should be catch. If false
, the exceptions are logging out
to the agent's logger, and never thrown outside this function.forceEventHandlerExecution
- indicates if the event handler execution must be forced even if the event
gathering feature is activated. Give a true
value with caution.listener
- the sole receiver of the event. If null
, all the listeners on the event bus will
receive the event. If not null
, only the given listener will receive the event.def
fireEventAndWait(event : Event,
thrownExceptions : boolean) : void
InternalEventBusCapacity
This function does not set the event's source if it is not already set.
All the exceptions thrown by the event handlers are gathered and fired into a single exception after all the event handlers have been executed or failed.
The events that are received during the execution of this function treated in the normal way, i.e. associated event handlers are run.
This function considers the agent's state for determining of the event should be fired or not. In other words, the given event may be fired or buffered depending on the event buffering flag.
event
- the event to fire.thrownExceptions
- indicates if any exception, which occurs into the event handler should be thrown outside this function.
If true
, an exception is thrown outside and should be catch. If false
, the exceptions are logging out
to the agent's logger, and never thrown outside this function.def
fireEventAndWaitWithEventGathering(event : Event,
thrownExceptions : boolean,
bufferedEvents : OutParameter<List<org.eclipse.xtext.xbase.lib.Pair<Event,Object>>>,
beforeEventFiringHandler : org.eclipse.xtext.xbase.lib.Procedures.Procedure0,
beforeReturnHandler : BooleanSupplier) : boolean
InternalEventBusCapacity
This function does not set the event's source if it is not already set.
All the exceptions thrown by the event handlers are gathered and fired into a single exception after all the event handlers have been executed or failed.
The events that are received during the execution of this function are gathered and replied.
This function does not considered the agent's state for determining of the event should be fired. In other words, the given event is always fired, whatever the agent's state or if the event buffering was turned on.
The event buffering is turned off at the return of this function.
event
- the event to fire.thrownExceptions
- indicates if any exception, which occurs into the event handler should be thrown outside this function.
If true
, an exception is thrown outside and should be catch. If false
, the exceptions are logging out
to the agent's logger, and never thrown outside this function.bufferedEvents
- the events that were received during the execution of this function. These events are not fired into the agent context yet.
The pairs are composed by the event, and the optional listener that is supposed to receive the event.beforeEventFiringHandler
- that is invoked just before the firing of the event. If null
, it is ignore.beforeReturn
- this is invoked just before the function return and the event buffering is turn off.beforeReturn
or true
if beforeReturn
is null
.def
fireEvent(event : Event) : void
InternalEventBusCapacity
This function does not set the event's source if it is not already set.
Any exception thrown by an event handler is catch by the associated thread.
This function considers the agent's state for determining of the event should be fired or not. In other words, the given event may be fired or buffered depending on the event buffering flag.
event
- the event to fire.def
fireEvent(event : Event,
listener : Object) : void
InternalEventBusCapacity
This function does not set the event's source if it is not already set.
Any exception thrown by an event handler is catch by the associated thread.
This function considers the agent's state for determining of the event should be fired or not. In other words, the given event may be fired or buffered depending on the event buffering flag.
event
- the event to fire.listener
- the sole receiver of the event. If null
, all the listeners on the event bus will
receive the event. If not null
, only the given listener will receive the event.@Pure
def
getAssociatedEventBusListener() : InformedEventListener
InternalEventBusCapacity
@Puredef
getRegisteredEventBusListeners(type : Class<T>) : ConcurrentCollection<T>with
<T>
InternalEventBusCapacity
T
- the type of the listeners.type
- the type of the listeners.@Pure
def
getEventBus() : EventBus
InternalEventBusCapacity
@Puredef
getEventBus(type : Class<T>) : Twith
<T extends EventBus>
InternalEventBusCapacity
type
- the expected type of the event bus.Copyright © 2021 the original authors or authors.