Record Class TextEditModel.LineDamage

java.lang.Object
java.lang.Record
limn.components.text.TextEditModel.LineDamage
Enclosing class:
TextEditModel

public static record TextEditModel.LineDamage(int firstLine, int oldLastLine, int newLastLine) extends Record
The lines edits have replaced: lines [firstLine, oldLastLine] of the text as it stood at the last TextEditModel.clearLineDamage() became lines [firstLine, newLastLine] of the text as it stands now. Lines before firstLine are untouched; lines after oldLastLine are untouched too, shifted down to follow newLastLine.

Exists for a view deriving per-line state from this buffer — a soft-wrap row map is the one that forced it. TextEditModel.textVersion() says that the text moved; for a per-line derivation that answer alone means re-deriving every line, and re-deriving a line means re-shaping it, so a keystroke in a long document would re-shape the document (the cliff ADR 031 §8.2 measured at 22 ms per character typed). This says which lines, which turns the keystroke back into work proportional to the edit.

  • Constructor Summary

    Constructors
    Constructor
    Description
    LineDamage(int firstLine, int oldLastLine, int newLastLine)
    Creates an instance of a LineDamage record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns the value of the firstLine record component.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the newLastLine record component.
    int
    Returns the value of the oldLastLine record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • LineDamage

      public LineDamage(int firstLine, int oldLastLine, int newLastLine)
      Creates an instance of a LineDamage record class.
      Parameters:
      firstLine - the value for the firstLine record component
      oldLastLine - the value for the oldLastLine record component
      newLastLine - the value for the newLastLine 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 '=='.
      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.
    • firstLine

      public int firstLine()
      Returns the value of the firstLine record component.
      Returns:
      the value of the firstLine record component
    • oldLastLine

      public int oldLastLine()
      Returns the value of the oldLastLine record component.
      Returns:
      the value of the oldLastLine record component
    • newLastLine

      public int newLastLine()
      Returns the value of the newLastLine record component.
      Returns:
      the value of the newLastLine record component