Class Group

java.lang.Object
madkit.kernel.Group

public final class Group extends Object
This class represents a group, containing roles played by agents. It is a collection of roles. A group is always linked to a community.
  • Method Details

    • getOrganization

      public Organization getOrganization()
      Gets the organization of the community this group belongs to.
      Returns:
      the parentOrganization
    • getCommunity

      public Community getCommunity()
      Gets the community this group belongs to.
      Returns:
      the communityObject
    • getRoles

      public List<Role> getRoles()
      Gets the list of the roles in this group.
      Returns:
      the roles in this group
    • getRole

      public Role getRole(String role) throws madkit.kernel.CGRNotAvailable
      Gets a role as an object from its name
      Parameters:
      role - the name of the role
      Returns:
      the role as an object
      Throws:
      madkit.kernel.CGRNotAvailable - the CGR not available
    • contains

      public boolean contains(Agent agent)
      Checks if the agent is in this group.
      Parameters:
      agent - the agent to check
      Returns:
      true, if the agent is in this group
    • getRoleNames

      public List<String> getRoleNames()
      Gets the names of the roles in this group.
      Returns:
      a list of the names of the roles in this group
    • isDistributed

      public boolean isDistributed()
      Checks if is distributed.
      Returns:
      true, if is distributed
    • rolesOf

      public List<Role> rolesOf(Agent a)
      Roles of the agent in this group.
      Parameters:
      a - the agent to get the roles of
      Returns:
      the list of roles of the agent in this group
    • toString

      public String toString()
      Returns a string representation of the group. The string representation consists of the community name, the group name, and the roles in the group.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the group
    • size

      public int size()
      Returns the number of roles in this group.
      Returns:
      the number of roles in this group
    • exists

      public boolean exists()
      Checks if the group actually exists.
      Returns:
      true, if the group exists