Interface CharIndexTranslator

All Known Implementing Classes:
OldTextPieceTable, TextPieceTable

@Internal public interface CharIndexTranslator
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    getByteIndex(int charPos)
    Calculates the byte index of the given char index.
    int[][]
    getCharIndexRanges(int startBytePosInclusive, int endBytePosExclusive)
    Finds character ranges that includes specified byte range.
    boolean
    isIndexInTable(int bytePos)
    Check if index is in table
    int
    lookIndexBackward(int bytePos)
    Return last index invalid input: '<'= bytePos that is in table
    int
    lookIndexForward(int bytePos)
    Return first index >= bytePos that is in table
  • Method Details

    • getByteIndex

      int getByteIndex(int charPos)
      Calculates the byte index of the given char index.
      Parameters:
      charPos - The char position
      Returns:
      The byte index
    • getCharIndexRanges

      int[][] getCharIndexRanges(int startBytePosInclusive, int endBytePosExclusive)
      Finds character ranges that includes specified byte range.
      Parameters:
      startBytePosInclusive - start byte range
      endBytePosExclusive - end byte range
    • isIndexInTable

      boolean isIndexInTable(int bytePos)
      Check if index is in table
      Parameters:
      bytePos -
      Returns:
      true if index in table, false if not
    • lookIndexForward

      int lookIndexForward(int bytePos)
      Return first index >= bytePos that is in table
      Parameters:
      bytePos -
      Returns:
      first index greater or equal to bytePos that is in table
    • lookIndexBackward

      int lookIndexBackward(int bytePos)
      Return last index invalid input: '<'= bytePos that is in table
      Parameters:
      bytePos -
      Returns:
      last index less of equal to bytePos that is in table