Class DefaultHierarchy
java.lang.Object
com.tnsai.coordination.groups.DefaultAgentGroup
com.tnsai.coordination.groups.hierarchy.DefaultHierarchy
- All Implemented Interfaces:
com.tnsai.agents.groups.AgentGroup,Hierarchy
Default implementation of Hierarchy.
Provides a tree-based organization structure with parent-child relationships, task delegation down the chain, and escalation up.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultHierarchy(String id, String name, String description, com.tnsai.agents.groups.GroupPolicy policy) Creates a new DefaultHierarchy. -
Method Summary
Modifier and TypeMethodDescriptionDelegates a task down to a specific level in the hierarchy.Escalates a task up from a given agent to their supervisor.Returns the delegation chain history.intReturns the depth level of an agent in the hierarchy.List<com.tnsai.agents.Agent> getReportingChain(String agentId) Returns the full reporting chain from root to the given agent.Returns all reporting lines in the hierarchy.Optional<com.tnsai.agents.Agent> getRoot()Returns the root agent of the hierarchy.List<com.tnsai.agents.Agent> getSubordinates(String agentId) Returns the direct subordinates of a given agent.Optional<com.tnsai.agents.Agent> getSupervisor(String agentId) Returns the supervisor of a given agent.voidsetReportingLine(String parentId, String childId) Sets a parent-child relationship.voidSets the root agent of the hierarchy.toString()Methods inherited from class com.tnsai.coordination.groups.DefaultAgentGroup
addLifecycleListener, addMember, addMembershipListener, assignTask, broadcast, dissolve, electLeader, electLeader, findMembers, getDescription, getEventBus, getId, getLeader, getLifecycle, getMember, getMembers, getMembershipManager, getMetrics, getName, getPolicy, hasMember, notifyTaskComplete, notifyTaskFailed, removeLifecycleListener, removeMember, removeMembershipListener, scatter, scatter, scatterAsync, setPolicy, start, stop, stopNowMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.tnsai.agents.groups.AgentGroup
addLifecycleListener, addMember, addMembershipListener, assignTask, broadcast, broadcast, dissolve, electLeader, electLeader, findMembers, getDescription, getEventBus, getId, getLeader, getLifecycle, getMember, getMemberCount, getMembers, getMembershipManager, getMetrics, getName, getPolicy, hasMember, isActive, isDissolved, removeLifecycleListener, removeMember, removeMembershipListener, scatter, scatter, scatterAsync, setPolicy, start, stop, stopNow
-
Constructor Details
-
Method Details
-
getRoot
Description copied from interface:HierarchyReturns the root agent of the hierarchy. -
setRoot
Sets the root agent of the hierarchy.- Parameters:
agentId- root agent ID- Throws:
IllegalArgumentException- if agent is not a member
-
getSupervisor
Description copied from interface:HierarchyReturns the supervisor of a given agent.- Specified by:
getSupervisorin interfaceHierarchy- Parameters:
agentId- agent ID- Returns:
- supervisor, or empty if agent is root or not found
-
getSubordinates
Description copied from interface:HierarchyReturns the direct subordinates of a given agent.- Specified by:
getSubordinatesin interfaceHierarchy- Parameters:
agentId- agent ID- Returns:
- list of subordinate agents
-
getReportingChain
Description copied from interface:HierarchyReturns the full reporting chain from root to the given agent.- Specified by:
getReportingChainin interfaceHierarchy- Parameters:
agentId- agent ID- Returns:
- list of agents from root to the target (inclusive)
-
getReportingLines
Description copied from interface:HierarchyReturns all reporting lines in the hierarchy.- Specified by:
getReportingLinesin interfaceHierarchy- Returns:
- list of reporting lines
-
getLevel
Description copied from interface:HierarchyReturns the depth level of an agent in the hierarchy. Root is level 0. -
setReportingLine
Description copied from interface:HierarchySets a parent-child relationship.- Specified by:
setReportingLinein interfaceHierarchy- Parameters:
parentId- parent agent IDchildId- child agent ID
-
delegate
Description copied from interface:HierarchyDelegates a task down to a specific level in the hierarchy. -
escalate
Description copied from interface:HierarchyEscalates a task up from a given agent to their supervisor. -
getDelegationChain
Description copied from interface:HierarchyReturns the delegation chain history.- Specified by:
getDelegationChainin interfaceHierarchy- Returns:
- delegation chain
-
toString
- Overrides:
toStringin classDefaultAgentGroup
-