Package fr.dyade.aaa.agent
Class RoleMultiple
- java.lang.Object
-
- fr.dyade.aaa.agent.RoleMultiple
-
- All Implemented Interfaces:
Serializable
public class RoleMultiple extends Object implements Serializable
This structure provides code for managing target agents registering in a role. A notification may be sent to a role using thesendTofunction of the sending agent. The class does not handle duplicates in the list.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RoleMultiple()RoleMultiple(String name)Creates a new RoleMultiple with a specified name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(AgentId target)Adds an agent in the listeners list.booleancontains(AgentId id)Tests if the specified agent id belongs to role multiple.Enumeration<AgentId>getListeners()Gets the listeners list as anEnumerationofAgentIdobjects.StringgetName()Returns the role name.voidremoveListener(AgentId target)Removes an agent from the listeners list.voidsetName(String name)Sets the role name.StringtoString()Provides a string image for this object.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Define serialVersionUID for interoperability.- See Also:
- Constant Field Values
-
name
private String name
-
-
Constructor Detail
-
RoleMultiple
public RoleMultiple()
-
RoleMultiple
public RoleMultiple(String name)
Creates a new RoleMultiple with a specified name.- Parameters:
name- the role name.
-
-
Method Detail
-
addListener
public void addListener(AgentId target)
Adds an agent in the listeners list.- Parameters:
target- the identifier of agent to add.
-
removeListener
public void removeListener(AgentId target)
Removes an agent from the listeners list.- Parameters:
target- the identifier of agent to remove.
-
getListeners
public Enumeration<AgentId> getListeners()
Gets the listeners list as anEnumerationofAgentIdobjects. There is no synchronization as we assume this object is manipulated from the enclosing agent reaction.- Returns:
- the listeners list of AgentId.
-
getName
public String getName()
Returns the role name.- Returns:
- the role name.
-
setName
public void setName(String name)
Sets the role name.- Parameters:
name- the role name.
-
contains
public boolean contains(AgentId id)
Tests if the specified agent id belongs to role multiple.- Parameters:
id- the specified agent id.- Returns:
- true if the specified id belongs to the role; false otherwise.
-
-