Class LineDeletion
java.lang.Object
uno.anahata.asi.toolkit.resources.text.lines.AbstractLineEdit
uno.anahata.asi.toolkit.resources.text.lines.LineDeletion
A safety-first deletion operation that removes a contiguous range of lines.
This implementation requires an explicit expectedCount to act as a
checksum, preventing accidental mass deletions due to coordinate drift or
misinterpretation of the file structure.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intThe 1-based line number where the deletion sequence ends (Inclusive).private intThe number of lines expected to be removed.private intThe 1-based line number where the deletion sequence begins (Inclusive).Fields inherited from class AbstractLineEdit
reason -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidApplies this edit to a mutable list of lines.intReturns the 1-based line number where this operation starts.
-
Field Details
-
startLine
private int startLineThe 1-based line number where the deletion sequence begins (Inclusive). -
endLine
private int endLineThe 1-based line number where the deletion sequence ends (Inclusive). -
expectedCount
private int expectedCountThe number of lines expected to be removed.This serves as a critical validation checkpoint; if the actual range size does not match this value, the operation will fail to protect file integrity.
-
-
Constructor Details
-
LineDeletion
public LineDeletion()
-
-
Method Details
-
apply
Applies this edit to a mutable list of lines.Performs range validation and checksum verification before removing lines from the provided list.
- Specified by:
applyin classAbstractLineEdit- Parameters:
lines- The current lines of the file.- Throws:
AgiToolException- if indices are out of bounds or validation fails.
-
getSortLine
public int getSortLine()Returns the 1-based line number where this operation starts. Used for sorting updates before application.Returns the start line of the range to facilitate descending sort during the application phase.
- Specified by:
getSortLinein classAbstractLineEdit- Returns:
- the start line.
-

