This type is part of the private API. Use with caution.
io.sarl.lang.core
Class SREutils
final class SREutils
extends java.lang.Object
Utilities for accessing to the part of the SARL API that is dedicated to the SARL run-time environments (SRE).

These utilities are provided for enabling the implementation of high-performance SRE by giving storage area into the instances of SARL concepts.

The data that is set and get by the functions in this utility class are SRE-dependent. The instance type of the data is known only by the SRE.

Note that any SRE-specific data stored into a SARL object has the following properties:
  • it is transient, i.e. it is not serialized;
  • it is used in the implementation of the equals(Object) function;
  • it is used in the implementation of the hashCode() function;
  • it is used in the implementation of the toString() function.
Maven Group Identifier:
io.sarl.lang
Maven Artifact Identifier:
core
Since:
0.5
Action Summary
Modifier and type Action and description
static S castInternalSkillReference(AbstractSkillContainer,AtomicSkillReference,Class<T>)
Casts the internal skill reference of a skill container.
static void doBehaviorInstallation(Behavior)
Do the installation of the given behavior.
static void doBehaviorUninstallation(Behavior)
Do the uninstallation of the given behavior.
static void doEvaluateBehaviorGuards(IBehaviorGuardEvaluatorReceiver,Object,Collection<E>)
Do the guard evaluations of the behavior units.
static void doGetSupportedEvents(IBehaviorGuardEvaluatorReceiver,Set<E>)
Retrieve the events' types that are supported by the given receiver.
static boolean doIsSupportedEvent(IBehaviorGuardEvaluatorReceiver,Class<T>)
Replies if the given event is supported by the given receiver.
static void doSkillInstallation(Skill)
Do the installation of the given skill.
static void doSkillUninstallation(Skill)
Do the uninstallation of the given skill.
static void doSkillUninstallationPreparation(Skill)
Do the uninstallation preparation of the given skill.
static S getInternalSkill(AbstractSkillContainer,Class<T>)
Replies the internal skill of a skill container.
static AtomicSkillReference getInternalSkillReference(AbstractSkillContainer,Class<T>)
Replies the internal skill reference of a skill container.
static java.util.concurrent.ConcurrentMap<K,V> getSkillRepository(AbstractSkillContainer)
Replies the skill repository of the given container.
static S getSreSpecificData(SRESpecificDataContainer,Class<T>)
Replies the data associated to the container by the SRE.
static void setDynamicSkillProvider(AbstractSkillContainer,DynamicSkillProvider)
Change the dynamic skill provider of a skill container.
static AtomicSkillReference setInternalSkill(AbstractSkillContainer,Skill,Class<T>)
Set the internal skill of a skill container.
static AtomicSkillReference setInternalSkillIfAbsent(AbstractSkillContainer,Skill,Class<T>)
Set the internal skill of a skill container if the skill is not yet mapped.
static void setSkillInstallationCallback(Agent,Procedure2<P1,P2>)
Provide an agent with a callback function for the skill installation.
static void setSreSpecificData(SRESpecificDataContainer,Object)
Change the data associated to the given container by the SRE.
static S setSreSpecificData(SRESpecificDataContainer,S,Class<T>)
Change the data associated to the given container by the SRE.
Action Details
castInternalSkillReference(AbstractSkillContainer,AtomicSkillReference,Class<T>)
def castInternalSkillReference(AbstractSkillContainer,AtomicSkillReference,Class<T>) : S

with S extends Capacity

Casts the internal skill reference of a skill container.
Parameters:
<S> - the type of the capacity.
container - the container.
reference - the reference to cast.
type - the type of the capacity.
Returns:
the skill reference
Since:
0.6
doBehaviorInstallation(Behavior)
def doBehaviorInstallation(Behavior)
Do the installation of the given behavior.

This function invokes install() and nothing more.
Parameters:
behavior - the behavior to be installed.
Since:
0.12
See:
doBehaviorUninstallation(Behavior)
doBehaviorUninstallation(Behavior)
def doBehaviorUninstallation(Behavior)
Do the uninstallation of the given behavior.

This function invokes uninstall() and nothing more.
Parameters:
behavior - the behavior to be uninstalled.
Since:
0.12
See:
doBehaviorInstallation(Behavior)
doEvaluateBehaviorGuards(IBehaviorGuardEvaluatorReceiver,Object,Collection<E>)
def doEvaluateBehaviorGuards(IBehaviorGuardEvaluatorReceiver,Object,Collection<E>)
Do the guard evaluations of the behavior units.
Parameters:
receiver - is the object that receives the events.
event - is the event that causes the evaluation.
behaviorsMethodsToExecute - receives the behavior unit methods.
Since:
0.12
doGetSupportedEvents(IBehaviorGuardEvaluatorReceiver,Set<E>)
def doGetSupportedEvents(IBehaviorGuardEvaluatorReceiver,Set<E>)
Retrieve the events' types that are supported by the given receiver.
Parameters:
receiver - is the object that receives the events.
events - is the set to fill out with the supported events' types.
Since:
0.12
doIsSupportedEvent(IBehaviorGuardEvaluatorReceiver,Class<T>)
def doIsSupportedEvent(IBehaviorGuardEvaluatorReceiver,Class<T>) : boolean
Replies if the given event is supported by the given receiver.
Parameters:
receiver - is the object that receives the events.
event - is the event to test.
Returns:
true if the event is supported; false otherwise.
Since:
0.12
doSkillInstallation(Skill)
def doSkillInstallation(Skill)
Do the installation of the given skill.

This function invokes install() and nothing more.
Parameters:
skill - the skill to be installed.
Since:
0.6
See:
doSkillUninstallationPreparation(Skill) , doSkillUninstallation(Skill)
doSkillUninstallation(Skill)
def doSkillUninstallation(Skill)
Do the uninstallation of the given skill.

This function invokes uninstall() and nothing more.
Parameters:
skill - the skill to be uninstalled.
Since:
0.11
See:
doSkillInstallation(Skill) , doSkillUninstallationPreparation(Skill)
doSkillUninstallationPreparation(Skill)
def doSkillUninstallationPreparation(Skill)
Do the uninstallation preparation of the given skill.

This function invokes prepareUninstallation() and nothing more.
Parameters:
skill - the skill to be uninstalled.
Since:
0.11
See:
doSkillInstallation(Skill) , doSkillUninstallation(Skill)
getInternalSkill(AbstractSkillContainer,Class<T>)
def getInternalSkill(AbstractSkillContainer,Class<T>) : S

with S extends Capacity

Replies the internal skill of a skill container.
Parameters:
<S> - the type of the capacity.
container - the container.
type - the type of the capacity.
Returns:
the skill.
Since:
0.6
getInternalSkillReference(AbstractSkillContainer,Class<T>)
def getInternalSkillReference(AbstractSkillContainer,Class<T>) : AtomicSkillReference
Replies the internal skill reference of a skill container.
Parameters:
container - the container.
type - the type of the capacity.
Returns:
the skill reference
Since:
0.6
getSkillRepository(AbstractSkillContainer)
def getSkillRepository(AbstractSkillContainer) : java.util.concurrent.ConcurrentMap<K,V>
Replies the skill repository of the given container.

The replied repository is not protected against asynchronous accesses.
Parameters:
container - the container.
Returns:
the repository.
Since:
0.6
getSreSpecificData(SRESpecificDataContainer,Class<T>)
def getSreSpecificData(SRESpecificDataContainer,Class<T>) : S

with S

Replies the data associated to the container by the SRE.
Parameters:
<S> - the type of the data.
type - the type of the data.
container - the container.
Returns:
the SRE-specific data.
setDynamicSkillProvider(AbstractSkillContainer,DynamicSkillProvider)
def setDynamicSkillProvider(AbstractSkillContainer,DynamicSkillProvider)
Change the dynamic skill provider of a skill container.
Parameters:
container - the container.
provider - the provider.
Since:
0.6
setInternalSkill(AbstractSkillContainer,Skill,Class<T>)
def setInternalSkill(AbstractSkillContainer,Skill,Class<T>) : AtomicSkillReference
Set the internal skill of a skill container.
Parameters:
container - the container.
skill - the skill instance to attach to the container.
capacities - the list of implemented capacities. This array cannot be null.
Returns:
the reference to the skill.
Since:
0.10
setInternalSkillIfAbsent(AbstractSkillContainer,Skill,Class<T>)
def setInternalSkillIfAbsent(AbstractSkillContainer,Skill,Class<T>) : AtomicSkillReference
Set the internal skill of a skill container if the skill is not yet mapped.
Parameters:
container - the container.
skill - the skill instance to attach to the container.
capacities - the list of implemented capacities. This array cannot be null.
Returns:
the reference to the skill.
Since:
0.11
setSkillInstallationCallback(Agent,Procedure2<P1,P2>)
def setSkillInstallationCallback(Agent,Procedure2<P1,P2>)
Provide an agent with a callback function for the skill installation.
Parameters:
agent - is the agent to equip.
callback - is the callback to install.
Since:
0.12
setSreSpecificData(SRESpecificDataContainer,Object)
def setSreSpecificData(SRESpecificDataContainer,Object)
Change the data associated to the given container by the SRE.
Parameters:
container - the container.
data - the SRE-specific data.
setSreSpecificData(SRESpecificDataContainer,S,Class<T>)
def setSreSpecificData(SRESpecificDataContainer,S,Class<T>) : S

with S

Change the data associated to the given container by the SRE.
Parameters:
<S> - the type of the data.
type - the type of the data.
container - the container.
data - the SRE-specific data.
Returns:
the SRE-specific data that was associated to the container before associating data to it.
Since:
0.6