Package com.tnsai.agents.groups
Class AgentGroupManager
java.lang.Object
com.tnsai.agents.groups.AgentGroupManager
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceContext interface for accessing agent state needed for group operations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns all groups this agent is a member of.voidjoinGroup(AgentGroup group) Joins an existing group.voidJoins a group by ID.voidLeaves all groups this agent belongs to.voidleaveGroup(AgentGroup group) Leaves a group.voidleaveGroup(String groupId) Leaves a group by ID.
-
Constructor Details
-
AgentGroupManager
-
-
Method Details
-
joinGroup
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
Joins an existing group.- Parameters:
group- the group to join- Throws:
IllegalArgumentException- if group is null
-
leaveGroup
Leaves a group by ID.- Parameters:
groupId- the group ID to leave
-
leaveGroup
Leaves a group.- Parameters:
group- the group to leave
-
leaveAllGroups
public void leaveAllGroups()Leaves all groups this agent belongs to. -
getGroups
Returns all groups this agent is a member of.- Returns:
- unmodifiable set of groups
-