Class CodePoints

java.lang.Object
opennlp.tools.util.normalizer.CodePoints

final class CodePoints extends Object
Shared code-point decoding for forward (and reverse) cursor scans over CharSequence text.

A char that is not a high surrogate is treated as its own code point, so BMP text decodes without Character.codePointAt(CharSequence, int) on every step.

  • Constructor Details

    • CodePoints

      private CodePoints()
  • Method Details

    • at

      static CodePoints.At at(CharSequence text, int index)
      Reads the code point starting at index.
      Parameters:
      text - The text.
      index - The UTF-16 index; must be in [0, text.length()).
      Returns:
      The decoded code point and its char width.
    • before

      static CodePoints.At before(CharSequence text, int index)
      Reads the code point ending at index (exclusive end offset).
      Parameters:
      text - The text.
      index - The UTF-16 index after the code point; must be in (0, text.length()].
      Returns:
      The decoded code point and its char width.