Class TextResourceReplacements
java.lang.Object
uno.anahata.asi.toolkit.resources.text.AbstractTextResourceWrite
uno.anahata.asi.toolkit.resources.text.TextResourceReplacements
Represents a set of text replacement operations for a specific file. Extends
AbstractTextFileWrite to inherit path and optimistic locking.
- Author:
- anahata
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<TextReplacement> The list of replacements to perform in this file.Fields inherited from class AbstractTextResourceWrite
lastModified, manualOverride, originalContent, originalResourceName, resourceUuid, resultingContent -
Constructor Summary
ConstructorsConstructorDescriptionTextResourceReplacements(String resourceUuid, long lastModified, List<TextReplacement> replacements) Constructs a new TextResourceReplacements using the builder pattern. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringPerforms the actual, tool-specific calculation of the resulting content.private StringgetTruncatedHint(Agi agi) Helper to construct a viewport truncation diagnostic hint if the resource view in the RAG prompt is currently truncated.private StringNormalizes a string for comparison by standardizing line endings to LF.private StringNormalizes a string by standardizing line endings and removing trailing whitespace from each line for lenient diagnostic comparison.voidPerforms pre-flight validation of the update operation.Methods inherited from class AbstractTextResourceWrite
calculateResultingContent, captureOriginalContent, getUnifiedDiff, validateIdenticalContent, validateStructuralState
-
Field Details
-
replacements
The list of replacements to perform in this file.
-
-
Constructor Details
-
TextResourceReplacements
public TextResourceReplacements(String resourceUuid, long lastModified, List<TextReplacement> replacements) Constructs a new TextResourceReplacements using the builder pattern.- Parameters:
resourceUuid- The unique identifier of the target text resource.lastModified- Optimistic locking: the expected last modified timestamp of the file.replacements- The list of text replacements to perform.
-
-
Method Details
-
doCalculateResultingContent
Performs the actual, tool-specific calculation of the resulting content.- Specified by:
doCalculateResultingContentin classAbstractTextResourceWrite- Parameters:
agi- The parent agi session.- Returns:
- The calculated resulting content as a String.
- Throws:
Exception- if the calculation logic fails.
-
validate
Performs pre-flight validation of the update operation. Note: This method ensures state is captured.- Overrides:
validatein classAbstractTextResourceWrite- Parameters:
agi- The parent agi session.- Throws:
Exception- if validation fails.
-
getTruncatedHint
-
normalizeForComparison
-
normalizeWhitespaces
-

