Class Group


  • public class Group
    extends java.lang.Object
    An AGR group hold information about agent instances and their positions (i.e. role instances).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String name
      The group name.
      protected java.util.Map positions
      The positions (role name -> Set{aids}).
      protected java.util.Map roles
      The roles (agent type name -> Set{role names}).
    • Constructor Summary

      Constructors 
      Constructor Description
      Group​(java.lang.String name)
      Create a new group.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addRoleForType​(java.lang.String typename, java.lang.String rolename)
      Add a role name for an agent type name.
      void assignRole​(IComponentIdentifier aid, java.lang.String rolename)
      Assign an agent to a role.
      IComponentIdentifier[] getAgentsForRole​(java.lang.String rolename)
      Get the agents with a given role.
      java.lang.String getName()
      Get the name of the group.
      java.lang.String[] getRolesForType​(java.lang.String typename)
      Get the role names for an agent type name.
      void removeRoleForType​(java.lang.String typename, java.lang.String rolename)
      Remove a role name for an agent type name.
      void unassignRole​(IComponentIdentifier aid, java.lang.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 java.lang.String name
        The group name.
      • positions

        protected java.util.Map positions
        The positions (role name -> Set{aids}).
      • roles

        protected java.util.Map roles
        The roles (agent type name -> Set{role names}).
    • Constructor Detail

      • Group

        public Group​(java.lang.String name)
        Create a new group.
        Parameters:
        type - The group type.
    • Method Detail

      • getName

        public java.lang.String getName()
        Get the name of the group.
        Returns:
        The group name.
      • addRoleForType

        public void addRoleForType​(java.lang.String typename,
                                   java.lang.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​(java.lang.String typename,
                                      java.lang.String rolename)
        Remove a role name for an agent type name.
        Parameters:
        typename - The agent type name.
        rolename - The role name.
      • getRolesForType

        public java.lang.String[] getRolesForType​(java.lang.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,
                               java.lang.String rolename)
        Assign an agent to a role.
        Parameters:
        aid - The agent id.
        rolename - The role name.
      • unassignRole

        public void unassignRole​(IComponentIdentifier aid,
                                 java.lang.String rolename)
        Remove an agent from a role.
        Parameters:
        aid - The agent id.
        rolename - The role name.
      • getAgentsForRole

        public IComponentIdentifier[] getAgentsForRole​(java.lang.String rolename)
        Get the agents with a given role.
        Parameters:
        rolename - The role name.