Class TextPosition

java.lang.Object
com.codename1.wordprocessing.TextPosition

public final class TextPosition extends Object
A place between two characters of a paragraph: the caret position a point on a page maps to.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int
    The offset in the paragraph's text, from zero to its length.
    final String
    The paragraph's id.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TextPosition(String paragraphId, int offset)
    Creates a position.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Two positions are equal when they name the same offset of the same paragraph.
    int
    A hash consistent with equals.
    The paragraph id and offset, for debugging.

    Methods inherited from class Object

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

    • paragraphId

      public final String paragraphId
      The paragraph's id.
    • offset

      public final int offset
      The offset in the paragraph's text, from zero to its length.
  • Constructor Details

    • TextPosition

      public TextPosition(String paragraphId, int offset)

      Creates a position.

      Parameters
      • paragraphId: the paragraph's id

      • offset: the offset in its text

  • Method Details

    • equals

      public boolean equals(Object o)

      Two positions are equal when they name the same offset of the same paragraph.

      Parameters
      • o: the other object
      Returns

      true when equal

      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()

      A hash consistent with equals.

      Returns

      the hash

      Overrides:
      hashCode in class Object
    • toString

      public String toString()

      The paragraph id and offset, for debugging.

      Returns

      a description

      Overrides:
      toString in class Object