Record Class TextSection
java.lang.Object
java.lang.Record
ai.doctruth.TextSection
- Record Components:
text- the recovered text run.location- the source-document span this text was recovered from.kind- the geometric / typographic classification of the block.
- All Implemented Interfaces:
ParsedSection
public record TextSection(String text, SourceLocation location, BlockKind kind)
extends Record
implements ParsedSection
A run of plain text recovered from the source document, anchored to a
SourceLocation
and tagged with a BlockKind that classifies the geometric / typographic shape of the
block (HEADING / BODY / LIST / OTHER).
Invariants: text, location, and kind are non-null. Empty
text is allowed (an empty paragraph or whitespace-only run is still a parsed
section).
The two-arg convenience constructor exists for backward compatibility with v0.1.0
callers that pre-date BlockKind; it defaults kind to BlockKind.OTHER.
New code that classifies layout SHOULD prefer the three-arg form.
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionTextSection(String text, SourceLocation location) Backward-compat 2-arg constructor — defaultskindtoBlockKind.OTHER.TextSection(String text, SourceLocation location, BlockKind kind) Creates an instance of aTextSectionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.kind()Returns the value of thekindrecord component.location()Returns the value of thelocationrecord component.text()Returns the value of thetextrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
TextSection
-
TextSection
Backward-compat 2-arg constructor — defaultskindtoBlockKind.OTHER. Preserved for callers that pre-date theBlockKindupgrade; new code that classifies layout should prefer the 3-arg form.
-
-
Method Details
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
text
-
location
-
kind
-