Record Class TableSection

java.lang.Object
java.lang.Record
ai.doctruth.TableSection
Record Components:
rows - the table cells, row-major.
location - the source-document span this table was recovered from.
All Implemented Interfaces:
ParsedSection

public record TableSection(List<List<String>> rows, SourceLocation location) extends Record implements ParsedSection
A flat string-cell table recovered from the source document, anchored to a SourceLocation. Each row is a list of cell strings; rows need not be the same length (rendering is downstream).

Invariants: rows and location are non-null. Each inner row is non-null. Empty rows is allowed (a table with zero rows is still a parsed section).

The rows field is defensively copied on construction (both outer and inner lists) and exposed as an unmodifiable nested view, so neither the caller's input nor the accessor's return value can mutate the section's state.

Since:
0.1.0
  • Constructor Details

    • TableSection

      public TableSection(List<List<String>> rows, SourceLocation location)
      Creates an instance of a TableSection record class.
      Parameters:
      rows - the value for the rows record component
      location - the value for the location record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • rows

      public List<List<String>> rows()
      Returns the value of the rows record component.
      Returns:
      the value of the rows record component
    • location

      public SourceLocation location()
      Returns the value of the location record component.
      Returns:
      the value of the location record component