java.lang.Object
eu.svjatoslav.sixth.e3d.gui.textEditorComponent.Page

public class Page extends Object
A page in a text editor.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The text lines.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new empty page.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Ensures that the page has at least the specified number of lines.
    char
    getChar(int row, int column)
    Returns the character at the specified location.
    getLine(int row)
    Returns the specified line.
    int
    getLineLength(int row)
    Returns the length of the specified line.
    int
    Returns the number of lines in the page.
    Returns the text of the page.
    void
    insertCharacter(int row, int col, char value)
    Inserts a character at the specified position.
    void
    insertLine(int row, TextLine textLine)
    Inserts a line at the specified row.
    void
    removeCharacter(int row, int col)
    Removes the specified character from the page.
    void
    removeLine(int row)
    Removes the specified line from the page.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • Page

      public Page()
      Creates a new empty page.
  • Method Details

    • ensureMaxTextLine

      public void ensureMaxTextLine(int row)
      Ensures that the page has at least the specified number of lines.
      Parameters:
      row - the minimum number of lines required
    • getChar

      public char getChar(int row, int column)
      Returns the character at the specified location. If the location is out of bounds, returns a space.
      Parameters:
      row - the row index
      column - the column index
      Returns:
      the character at the specified location
    • getLine

      public TextLine getLine(int row)
      Returns the specified line.
      Parameters:
      row - The line number.
      Returns:
      The line.
    • getLineLength

      public int getLineLength(int row)
      Returns the length of the specified line.
      Parameters:
      row - The line number.
      Returns:
      The length of the line.
    • getLinesCount

      public int getLinesCount()
      Returns the number of lines in the page.
      Returns:
      The number of lines in the page.
    • getText

      public String getText()
      Returns the text of the page.
      Returns:
      The text of the page.
    • insertCharacter

      public void insertCharacter(int row, int col, char value)
      Inserts a character at the specified position.
      Parameters:
      row - the row index
      col - the column index
      value - the character to insert
    • insertLine

      public void insertLine(int row, TextLine textLine)
      Inserts a line at the specified row.
      Parameters:
      row - the row index where to insert
      textLine - the text line to insert
    • removeCharacter

      public void removeCharacter(int row, int col)
      Removes the specified character from the page.
      Parameters:
      row - The line number.
      col - The character number.
    • removeLine

      public void removeLine(int row)
      Removes the specified line from the page.
      Parameters:
      row - The line number.