io.sarl.lang.core
Class AgentProtectedAPIObject
All Known Subclasses:
AbstractSkillContainer, AgentTrait
abstract class AgentProtectedAPIObject
extends SRESpecificDataContainer
This class defines the protected API that is provided to the agents and the agent traits.
Maven Group Identifier:
io.sarl.lang
Maven Artifact Identifier:
core
Since:
0.4
Constructor Summary
Constructor and description
new
Action Summary
Modifier and type Action and description
protected abstract S clearSkill(Class<T>)
Clears the Skill associated with the capacity.
protected abstract S getSkill(Class<T>)
Replies the skill corresponding to the given capacity.
protected abstract boolean hasSkill(Class<T>)
Checks if this agent has a Skill that implements the Capacity capacity.
protected abstract boolean isFromMe(Event)
Replies if the given event was emitted by this agent.
protected abstract boolean isMe(Address)
Replies if the given address is one of the addresses of this agent.
protected abstract boolean isMe(UUID)
Replies if the given identifier corresponds to the identifier of this agent.
protected abstract void operator_mappedTo(Class<T>,S)
Defines the implementation of the "capacity maps-to skill" operator.
protected abstract S setSkill(S,Class<T>*)
Set the skill for the Capacity capacity.
protected abstract void setSkillIfAbsent(Skill,Class<T>*)
Set the skill for the Capacity capacity if the mapping is not yet set.
final java.lang.String toString
protected abstract void toString(ToStringBuilder)
fill the given builder with the string representation of this object.
Constructor Details
new
new
Action Details
clearSkill(Class<T>)
protected def clearSkill(Class<T>) : S

with S extends Capacity

Clears the Skill associated with the capacity.
Parameters:
<S> - - the type of the capacity.
capacity - the capacity for which the skill must be cleared.
Returns:
the skill that was removed
getSkill(Class<T>)
protected def getSkill(Class<T>) : S

with S extends Capacity

Replies the skill corresponding to the given capacity.

The return may never be null. If not capacity was set, the exception UnimplementedCapacityException is thrown.
Parameters:
<S> - - type of the capacity.
capacity - the capacity to search for the implementation.
Returns:
the skill, never null
hasSkill(Class<T>)
protected def hasSkill(Class<T>) : boolean
Checks if this agent has a Skill that implements the Capacity capacity.
Parameters:
capacity - capacity to check
Returns:
true if it has a skill associate to this capacity, false otherwise
isFromMe(Event)
protected def isFromMe(Event) : boolean
Replies if the given event was emitted by this agent.
Parameters:
event - the event to test.
Returns:
true if the given event was emitted by this agent; otherwise false .
isMe(Address)
protected def isMe(Address) : boolean
Replies if the given address is one of the addresses of this agent. The test is done on the identifier replied by getID().
Parameters:
address - the address to test.
Returns:
true if the given address is one of this agent, otherwise false .
isMe(UUID)
protected def isMe(UUID) : boolean
Replies if the given identifier corresponds to the identifier of this agent.

This function is equivalent to:
br id.equals( agent.getID() )br 
Parameters:
uID - the identifier to test.
Returns:
true if the given identifier is the one of this agent, otherwise false .
operator_mappedTo(Class<T>,S)
protected def operator_mappedTo(Class<T>,S)

with S extends Skill

Defines the implementation of the "capacity maps-to skill" operator.
Parameters:
<S> - - type of skill to be mapped to.
capacity - the implemented capacity.
skill - the skill to associate to the capacity.
setSkill(S,Class<T>*)
protected def setSkill(S,Class<T>*) : S

with S extends Skill

Set the skill for the Capacity capacity.
Parameters:
<S> - - type of the skill.
capacities - the capacity or the capacities to set.
skill - implementation of capacity.
Returns:
the skill that was set.
See:
setSkillIfAbsent(Skill,Class<T>*)
setSkillIfAbsent(Skill,Class<T>*)
protected def setSkillIfAbsent(Skill,Class<T>*)
Set the skill for the Capacity capacity if the mapping is not yet set.
Parameters:
capacities - the capacity or the capacities to set.
skill - implementation of capacity.
Since:
0.11
See:
setSkill(S,Class<T>*)
toString
def toString : java.lang.String
toString(ToStringBuilder)
protected def toString(ToStringBuilder)
fill the given builder with the string representation of this object.
Parameters:
builder - the string builder.
Since:
0.7