public class BehaviorGuardEvaluatorRegistry extends Object
BehaviorGuardEvaluator
classes containing a method to evaluate the guard of a
given behavior (on clause in SARL behavior).
This class is thread-safe.
Modifier and Type | Class and Description |
---|---|
static class |
BehaviorGuardEvaluatorRegistry.GuardedEvaluator
Description of a set of guard evaluators with a shared activation guard.
|
Constructor and Description |
---|
BehaviorGuardEvaluatorRegistry()
Instanciates a new registry linked with the
PerceptGuardEvaluator annotation. |
Modifier and Type | Method and Description |
---|---|
ConcurrentLinkedDeque<BehaviorGuardEvaluator> |
getBehaviorGuardEvaluators(event : Event)
Gets an iterator representing an immutable snapshot of all BehaviorGuardEvaluators to the given event at the time this method is called.
|
ConcurrentLinkedDeque<BehaviorGuardEvaluator> |
getBehaviorGuardEvaluatorsFor(event : Event,
listener : Object)
Gets an iterator representing an immutable snapshot of all BehaviorGuardEvaluators of the given listener
to the given event at the time this method is called.
|
ConcurrentHashMap<Class<? extends Event>,CopyOnWriteArraySet<BehaviorGuardEvaluatorRegistry.GuardedEvaluator>> |
getInternalDataStructure()
Replies the internal data structure.
|
<T> ConcurrentSkipListSet<T> |
getRegisteredEventListeners(type : Class<T>)
Extract the registered listeners with the given type.
|
<T> int |
getRegisteredEventListeners(type : Class<T>,
collection : Collection<? super T>)
Deprecated.
|
<T> int |
getRegisteredEventListeners(type : Class<T>,
collection : Set<? super T>)
Extract the registered listeners with the given type.
|
boolean |
hasRegisteredEventListener(type : Class<?>)
Replies if a listener with the given type is registered.
|
void |
register(listener : Object,
filter : (Event)=>Boolean,
[callback : (Object)=>void])
Registers all
PerceptGuardEvaluator methods on the given listener object. |
void |
register(listener : Object,
[callback : (Object)=>void])
Registers all
PerceptGuardEvaluator methods on the given listener object. |
void |
unregister(listenerType : Class<?>,
callback : (Object)=>Boolean)
Unregisters all BehaviorGuardEvaluators on the listener objects of the given type.
|
void |
unregister(listener : Object,
callback : (Object)=>void)
Unregisters all BehaviorGuardEvaluators on the given listener object.
|
void |
unregisterAll(callback : (Object)=>Boolean)
Unregisters all BehaviorGuardEvaluators on all the listener objects.
|
public new
()
PerceptGuardEvaluator
annotation.
The registry will use concurrent data structures.
internalMap
- the internal map.@Pure
public def
getInternalDataStructure() : ConcurrentHashMap<Class<? extends Event>,CopyOnWriteArraySet<BehaviorGuardEvaluatorRegistry.GuardedEvaluator>>
BehaviorGuardEvaluatorRegistry
public def
register(listener : Object,
[callback : (Object)=>void]) : void
BehaviorGuardEvaluatorRegistry
PerceptGuardEvaluator
methods on the given listener object.listener
- the new BehaviorGuardEvaluator
to addcallback
- function which is invoked just after the first registration of the object. It could be null
.public def
register(listener : Object,
filter : (Event)=>Boolean,
[callback : (Object)=>void]) : void
BehaviorGuardEvaluatorRegistry
PerceptGuardEvaluator
methods on the given listener object.
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 new BehaviorGuardEvaluator
to addfilter
- the filter function.callback
- function which is invoked just after the registration of the object. It could be null
.public def
unregisterAll(callback : (Object)=>Boolean) : void
BehaviorGuardEvaluatorRegistry
callback
- function which is invoked just before the object is unregistered. It could be null
.
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.public def
unregister(listener : Object,
callback : (Object)=>void) : void
BehaviorGuardEvaluatorRegistry
listener
- the new BehaviorGuardEvaluator
to removecallback
- function which is invoked just before the object is unregistered. It could be null
.public def
unregister(listenerType : Class<?>,
callback : (Object)=>Boolean) : void
BehaviorGuardEvaluatorRegistry
listenerType
- the type of the BehaviorGuardEvaluator
to removecallback
- function which is invoked just before the object is unregistered. It could be null
.
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.@Pure
public def
hasRegisteredEventListener(type : Class<?>) : boolean
BehaviorGuardEvaluatorRegistry
type
- the type of listener.true
if a listener of the given type is registered.@Pure
public def
getBehaviorGuardEvaluators(event : Event) : ConcurrentLinkedDeque<BehaviorGuardEvaluator>
BehaviorGuardEvaluatorRegistry
event
- -the event to process@Pure
public def
getBehaviorGuardEvaluatorsFor(event : Event,
listener : Object) : ConcurrentLinkedDeque<BehaviorGuardEvaluator>
BehaviorGuardEvaluatorRegistry
Caution: This function does not apply filtering function given to
#register(Object, Function1, Procedure1)
.
event
- -the event to processlistener
- the owner of the BehaviorGuardEvaluators (never null
).@Pure publicdef
getRegisteredEventListeners(type : Class<T>, collection : Set<? super T>) : intwith
<T>
BehaviorGuardEvaluatorRegistry
T
- the type of the listeners.type
- the type of the listeners.collection
- the collection of listeners that is filled by this function. This argument could be null
.@Deprecated @Pure publicdef
getRegisteredEventListeners(type : Class<T>, collection : Collection<? super T>) : intwith
<T>
BehaviorGuardEvaluatorRegistry.getRegisteredEventListeners(Class,Set)
.BehaviorGuardEvaluatorRegistry
T
- the type of the listeners.type
- the type of the listeners.collection
- the collection of listeners that is filled by this function. This argument could be null
.@Pure publicdef
getRegisteredEventListeners(type : Class<T>) : ConcurrentSkipListSet<T>with
<T>
BehaviorGuardEvaluatorRegistry
T
- the type of the listeners.type
- the type of the listeners.Copyright © 2020 the original authors or authors.