Class AgentGroupManager

java.lang.Object
com.tnsai.agents.groups.AgentGroupManager

public final class AgentGroupManager extends Object
Manages group membership for an agent.

Handles joining, leaving, and querying agent group memberships. Delegates to the singleton GroupRegistry for actual group operations.

See Also:
  • Constructor Details

  • Method Details

    • joinGroup

      public void joinGroup(String groupId)
      Joins a group by ID.

      If the group doesn't exist, it will be auto-created via GroupRegistry.getOrCreate(String).

      Parameters:
      groupId - the group ID to join
    • joinGroup

      public void joinGroup(AgentGroup group)
      Joins an existing group.
      Parameters:
      group - the group to join
      Throws:
      IllegalArgumentException - if group is null
    • leaveGroup

      public void leaveGroup(String groupId)
      Leaves a group by ID.
      Parameters:
      groupId - the group ID to leave
    • leaveGroup

      public void leaveGroup(AgentGroup group)
      Leaves a group.
      Parameters:
      group - the group to leave
    • leaveAllGroups

      public void leaveAllGroups()
      Leaves all groups this agent belongs to.
    • getGroups

      public Set<AgentGroup> getGroups()
      Returns all groups this agent is a member of.
      Returns:
      unmodifiable set of groups