Package snap.text

Class CharBlock

All Implemented Interfaces:
CharSequence, PropChange.DoChange, CharSequenceX

public class CharBlock extends PropObject implements CharSequenceX
This class manages a list of char lines.
  • Constructor Details

    • CharBlock

      public CharBlock()
      Constructor.
  • Method Details

    • getLineCount

      public int getLineCount()
      Return number of lines.
    • getLine

      public CharLine getLine(int anIndex)
      Return individual line at given index.
    • createLine

      protected CharLine createLine()
      Creates a new CharLine for use in this text.
    • addLine

      protected void addLine(CharLine charLine, int anIndex)
      Adds a block at given index.
    • removeLine

      protected void removeLine(int anIndex)
      Removes the block at given index.
    • updateLines

      protected void updateLines(int anIndex)
      Updates Lines from index line to text end to account for changed line.
    • updateLine

      protected void updateLine(CharLine textLine, int newIndex, int newStartCharIndex)
      Updates an individual line for new index and start char index.
    • getLastLine

      public CharLine getLastLine()
      Returns the last line.
    • getLineForCharIndex

      public CharLine getLineForCharIndex(int charIndex)
      Returns the block at the given char index.
    • length

      public int length()
      Override to return length.
      Specified by:
      length in interface CharSequence
    • charAt

      public char charAt(int charIndex)
      Override to get char from line at char index.
      Specified by:
      charAt in interface CharSequence
    • subSequence

      public CharSequence subSequence(int startCharIndex, int endCharIndex)
      Override to get subsequence from lines.
      Specified by:
      subSequence in interface CharSequence