Class Organization

java.lang.Object
madkit.kernel.Organization

public final class Organization extends Object
This class is responsible for managing the organization of the artificial society. It is responsible for creating and removing communities, groups and roles.
  • Method Details

    • isGroup

      public boolean isGroup(String community, String group)
      Returns true if the group exists in the organization. A group exists if it has at least one agent playing a role in it.
      Parameters:
      community - the community name
      group - the group name
      Returns:
      true if the group exists
    • isRole

      public boolean isRole(String community, String group, String role)
      Returns true if the role exists in the organization. A role exists if it has at least one agent playing it.
      Parameters:
      community - the community name
      group - the group name
      role - the role name
      Returns:
      true if the role exists
    • getRole

      public Role getRole(String community, String group, String role) throws madkit.kernel.CGRNotAvailable
      Returns the role object corresponding to the given community, group and role
      Parameters:
      community - the community name
      group - the group name
      role - the role name
      Returns:
      the role object
      Throws:
      madkit.kernel.CGRNotAvailable
    • getCommunity

      public Community getCommunity(String community)
      Gets the community object corresponding to the given community name.
      Parameters:
      community - the community name
      Returns:
      the community object corresponding to the given community name
    • getGroup

      public Group getGroup(String community, String group) throws madkit.kernel.CGRNotAvailable
      Returns the group object corresponding to the given community and group names
      Parameters:
      community - the community name
      group - the group name
      Returns:
      the group object corresponding to the given community and group names
      Throws:
      madkit.kernel.CGRNotAvailable
    • isCommunity

      public boolean isCommunity(String community)
      Returns true if the community exists in the organization. A community exists if it has at least one agent playing a role in a group.
      Parameters:
      community - the community name
      Returns:
      true if the community exists
    • removeCommunity

      public void removeCommunity(String community)
      Parameters:
      community -
    • getCommunities

      public List<Community> getCommunities()
      Returns a list of all the communities in the organization
      Returns:
      the list of communities in the organization
    • getAgentsWithRole

      public List<AgentAddress> getAgentsWithRole(String community, String group, String role)
      Returns a List containing all other agents having this position in the organization. The caller is excluded from the search.
      Parameters:
      community - the community name
      group - the group name
      role - the role name
      Returns:
      a list of agent addresses corresponding to agents having the given role
    • getOrganizationSnapShot

      public final OrganizationSnapshot getOrganizationSnapShot(boolean global)
      Returns a snapshot of the current organization structure.
      Parameters:
      global - include distant groups and roles if true
      Returns:
      a snapshot of the current organization structure
    • getAddressOfAgentAt

      public AgentAddress getAddressOfAgentAt(Agent agent, String community, String group, String role)
      Returns the address of the given agent playing the given role in the given group
      Parameters:
      agent - the agent to look for
      community - the community name
      group - the group name
      role - the role name
      Returns:
      the address of the agent playing the given role or null if the agent does not play this role