jadex.application.space.agr
Class Group

java.lang.Object
  extended by jadex.application.space.agr.Group

public class Group
extends Object

An AGR group hold information about agent instances and their positions (i.e. role instances).


Field Summary
protected  String name
          The group name.
protected  Map positions
          The positions (role name -> Set{aids}).
protected  Map roles
          The roles (agent type name -> Set{role names}).
 
Constructor Summary
Group(String name)
          Create a new group.
 
Method Summary
 void addRoleForType(String typename, String rolename)
          Add a role name for an agent type name.
 void assignRole(IComponentIdentifier aid, String rolename)
          Assign an agent to a role.
 IComponentIdentifier[] getAgentsForRole(String rolename)
          Get the agents with a given role.
 String getName()
          Get the name of the group.
 String[] getRolesForType(String typename)
          Get the role names for an agent type name.
 void removeRoleForType(String typename, String rolename)
          Remove a role name for an agent type name.
 void unassignRole(IComponentIdentifier aid, String rolename)
          Remove an agent from a role.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected String name
The group name.


positions

protected Map positions
The positions (role name -> Set{aids}).


roles

protected Map roles
The roles (agent type name -> Set{role names}).

Constructor Detail

Group

public Group(String name)
Create a new group.

Parameters:
type - The group type.
Method Detail

getName

public String getName()
Get the name of the group.

Returns:
The group name.

addRoleForType

public void addRoleForType(String typename,
                           String rolename)
Add a role name for an agent type name.

Parameters:
typename - The agent type name.
rolename - The role name.

removeRoleForType

public void removeRoleForType(String typename,
                              String rolename)
Remove a role name for an agent type name.

Parameters:
typename - The agent type name.
rolename - The role name.

getRolesForType

public String[] getRolesForType(String typename)
Get the role names for an agent type name.

Parameters:
typename - The agent type name.
Returns:
The role names (if any).

assignRole

public void assignRole(IComponentIdentifier aid,
                       String rolename)
Assign an agent to a role.

Parameters:
aid - The agent id.
rolename - The role name.

unassignRole

public void unassignRole(IComponentIdentifier aid,
                         String rolename)
Remove an agent from a role.

Parameters:
aid - The agent id.
rolename - The role name.

getAgentsForRole

public IComponentIdentifier[] getAgentsForRole(String rolename)
Get the agents with a given role.

Parameters:
rolename - The role name.


Copyright © 2010. All Rights Reserved.