public interface Behaviors extends Capacity
Modifier and Type | Method and Description |
---|---|
EventListener |
asEventListener()
Replies the interface to dispatch an event to agent's Behaviors.
|
ConcurrentCollection<Behavior> |
getRegisteredBehaviors()
Replies the registered behaviors.
|
boolean |
hasRegisteredBehavior()
Replies
true if at least a behavior is registered. |
Behavior |
registerBehavior(attitude : Behavior,
[filter : (Event)=>Boolean],
initializationParameters : Object*)
Register a Behavior for the owner agent.
|
Behavior |
unregisterBehavior(attitude : Behavior)
Unregisters a behavior for the owner agent.
|
void |
wake(behavior : Behavior,
event : Event)
Wake a specific agent's behavior reacting to the Event evt.
|
void |
wake(event : Event,
[scope : Scope<Address>])
Wake the agent's behaviors reacting to the Event evt.
|
void |
wake(behaviors : Iterable<Behavior>,
event : Event)
Wake a set of specific agent's behaviors reacting to the Event evt.
|
@Pure
def
hasRegisteredBehavior() : boolean
Behaviors
true
if at least a behavior is registered.
A registered behavior is not necessary running. It may wait for events.
true
if a behavior is registered; otherwise false
.@Pure
def
getRegisteredBehaviors() : ConcurrentCollection<Behavior>
Behaviors
A registered behavior is not necessary running. It may wait for events.
def
registerBehavior(attitude : Behavior,
[filter : (Event)=>Boolean],
initializationParameters : Object*) : Behavior
Behaviors
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.
This function does nothing if one of the following conditions evaluates to true:
attitude
- the behavior to add to the agent.filter
- the filter that enables to indicates if an event is accepted by a behavior.initializationParameters
- the set of parameters to pass to the behavior within the Initialize
event.filter
parameter.def
unregisterBehavior(attitude : Behavior) : Behavior
Behaviors
attitude
- the behavior to remove to the agent.def
wake(event : Event,
[scope : Scope<Address>]) : void
Behaviors
Note that the scope parameter could be used only for filtering the agents (the current receiving agent)
in order to determine the ones that will receive the event.
The behaviors of the current agent (registered with
#registerBehavior(Behavior, Function1, Object[])
will always
receive the event if the current agent is not discarded. Because the behaviors have no associated address,
they cannot be filtered individually.
This function does nothing if one of the following conditions evaluates to true:
event
- the event to emit to the agent's behaviors and in the internal context.scope
- the definition of the scope that will be used for selected the receivers of the events.def
wake(behavior : Behavior,
event : Event) : void
Behaviors
This function does nothing if one of the following conditions evaluates to true:
behavior
- the agent's behavior to wake up.event
- the event to emit to the agent's behaviors and in the internal context.def
wake(behaviors : Iterable<Behavior>,
event : Event) : void
Behaviors
This function does nothing if one of the following conditions evaluates to true:
behaviors
- the agent's behaviors to wake up.event
- the event to emit to the agent's behaviors and in the internal context.@Pure
def
asEventListener() : EventListener
Behaviors
Copyright © 2021 the original authors or authors.