Class PartNode
java.lang.Object
uno.anahata.asi.swing.agi.context.AbstractContextNode<AbstractPart>
uno.anahata.asi.swing.agi.context.PartNode
A context tree node representing a single part of a message.
- Author:
- anahata
-
Field Summary
Fields inherited from class AbstractContextNode
agiPanel, children, declarationsTokens, historyTokens, instructionsTokens, ragTokens, status, userObject -
Constructor Summary
ConstructorsConstructorDescriptionPartNode(AgiPanel agiPanel, AbstractPart userObject) Constructs a new PartNode. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCalculates the token counts for this node's own content (excluding children).protected AbstractContextNode<?> createChildNode(Object obj) Creates a new child node for the given domain object.protected List<?> Fetches the current list of domain objects that should be represented as children of this node.Gets a detailed description of the node's purpose or content.getName()Gets the human-readable display name for this node.booleanisActive()Checks if the underlying domain object is currently active in the context.protected voidUpdates the status string for this node.Methods inherited from class AbstractContextNode
equals, getAgi, getChildren, getIcon, hashCode, refresh, refreshData, refreshTokens, toString
-
Constructor Details
-
PartNode
Constructs a new PartNode.- Parameters:
agiPanel- The parent agi panel.userObject- The part to wrap.
-
-
Method Details
-
getName
Gets the human-readable display name for this node.Implementation details: Returns the simple class name of the part (e.g., TextPart, BlobPart) along with its sequential ID.
- Specified by:
getNamein classAbstractContextNode<AbstractPart>- Returns:
- The name to be displayed in the tree.
-
getDescription
Gets a detailed description of the node's purpose or content.Implementation details: Returns a basic description including the concrete type of the message part.
- Specified by:
getDescriptionin classAbstractContextNode<AbstractPart>- Returns:
- The description string.
-
fetchChildObjects
Fetches the current list of domain objects that should be represented as children of this node.Implementation details: Parts are leaf nodes and do not have child objects.
- Specified by:
fetchChildObjectsin classAbstractContextNode<AbstractPart>- Returns:
- A list of domain objects.
-
createChildNode
Creates a new child node for the given domain object.- Specified by:
createChildNodein classAbstractContextNode<AbstractPart>- Parameters:
obj- The domain object to wrap.- Returns:
- A new AbstractContextNode, or null if the object type is not supported.
-
calculateLocalTokens
protected void calculateLocalTokens()Calculates the token counts for this node's own content (excluding children).Implementation details: Retrieves the token count directly from the underlying domain part for history metrics.
- Specified by:
calculateLocalTokensin classAbstractContextNode<AbstractPart>
-
isActive
public boolean isActive()Checks if the underlying domain object is currently active in the context.Subclasses override this method to define their specific active-state policy, allowing for clean, polymorphic evaluation without dirty instanceof chains.
- Specified by:
isActivein classAbstractContextNode<AbstractPart>- Returns:
trueif active,falseotherwise.
-
updateStatus
protected void updateStatus()Updates the status string for this node.Implementation details: Includes the remaining depth metric in the status string to visualize the Context Window Garbage Collection (CwGC) state.
- Specified by:
updateStatusin classAbstractContextNode<AbstractPart>
-

