Class HierarchyBuilder
java.lang.Object
com.tnsai.coordination.groups.hierarchy.HierarchyBuilder
Builder for creating Hierarchy instances.
Usage Example
Hierarchy hierarchy = Hierarchy.builder()
.name("Engineering Org")
.root(cto)
.member(cto, teamLead1)
.member(cto, teamLead2)
.member(teamLead1, dev1)
.build();
-
Method Summary
Modifier and TypeMethodDescriptionautoStart(boolean autoStart) Sets whether to auto-start after build.build()Builds the Hierarchy.description(String description) Sets the hierarchy description.Sets the hierarchy ID.member(com.tnsai.agents.Agent parent, com.tnsai.agents.Agent child) Adds a parent-child relationship.Sets the hierarchy name.policy(com.tnsai.agents.groups.GroupPolicy policy) Sets the group policy.root(com.tnsai.agents.Agent agent) Sets the root agent of the hierarchy.
-
Method Details
-
id
Sets the hierarchy ID.- Parameters:
id- hierarchy ID- Returns:
- this builder
-
name
Sets the hierarchy name.- Parameters:
name- hierarchy name- Returns:
- this builder
-
description
Sets the hierarchy description.- Parameters:
description- hierarchy description- Returns:
- this builder
-
policy
Sets the group policy.- Parameters:
policy- policy- Returns:
- this builder
-
root
Sets the root agent of the hierarchy.- Parameters:
agent- root agent- Returns:
- this builder
-
member
Adds a parent-child relationship. Both agents will be added as members.- Parameters:
parent- parent agentchild- child agent- Returns:
- this builder
-
autoStart
Sets whether to auto-start after build.- Parameters:
autoStart- auto-start flag- Returns:
- this builder
-
build
Builds the Hierarchy.- Returns:
- new Hierarchy instance
- Throws:
IllegalStateException- if root is not set
-