Class CaseMapImpl.StringContextIterator

java.lang.Object
com.ibm.icu.impl.CaseMapImpl.StringContextIterator
All Implemented Interfaces:
UCaseProps.ContextIterator
Enclosing class:
CaseMapImpl

public static final class CaseMapImpl.StringContextIterator extends Object implements UCaseProps.ContextIterator
Implementation of UCaseProps.ContextIterator, iterates over a String. See ustrcase.c/utf16_caseContextIterator().
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
    protected int
     
    protected int
     
    protected int
     
    protected int
     
    protected CharSequence
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
    StringContextIterator(CharSequence src, int cpStart, int cpLimit)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    int
    Returns the limit of the code point that was last returned by nextCaseMapCP().
    int
    Returns the start of the code point that was last returned by nextCaseMapCP().
    void
    moveTo(int i)
     
    void
    Move to the iteration limit without fetching code points up to there.
    int
    Iterate and return the next code point, moving in the direction determined by the reset() call.
    int
    Iterate forward through the string to fetch the next code point to be case-mapped, and set the context indexes for it.
    void
    reset(int direction)
    Reset the iterator for forward or backward iteration.
    void
    setCPStartAndLimit(int s, int l)
     
    void
    setLimit(int lim)
    Set the iteration limit for nextCaseMapCP() to an index within the string.

    Methods inherited from class java.lang.Object

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

    • s

      protected CharSequence s
    • index

      protected int index
    • limit

      protected int limit
    • cpStart

      protected int cpStart
    • cpLimit

      protected int cpLimit
    • dir

      protected int dir
  • Constructor Details

    • StringContextIterator

      public StringContextIterator(CharSequence src)
      Constructor.
      Parameters:
      src - String to iterate over.
    • StringContextIterator

      public StringContextIterator(CharSequence src, int cpStart, int cpLimit)
      Constructor.
      Parameters:
      src - String to iterate over.
      cpStart - Start index of the current code point.
      cpLimit - Limit index of the current code point.
  • Method Details

    • setLimit

      public void setLimit(int lim)
      Set the iteration limit for nextCaseMapCP() to an index within the string. If the limit parameter is negative or past the string, then the string length is restored as the iteration limit.

      This limit does not affect the next() function which always iterates to the very end of the string.

      Parameters:
      lim - The iteration limit.
    • moveToLimit

      public void moveToLimit()
      Move to the iteration limit without fetching code points up to there.
    • moveTo

      public void moveTo(int i)
    • nextCaseMapCP

      public int nextCaseMapCP()
      Iterate forward through the string to fetch the next code point to be case-mapped, and set the context indexes for it.

      When the iteration limit is reached (and -1 is returned), getCPStart() will be at the iteration limit.

      Iteration with next() does not affect the position for nextCaseMapCP().

      Returns:
      The next code point to be case-mapped, or invalid input: '<'0 when the iteration is done.
    • setCPStartAndLimit

      public void setCPStartAndLimit(int s, int l)
    • getCPStart

      public int getCPStart()
      Returns the start of the code point that was last returned by nextCaseMapCP().
    • getCPLimit

      public int getCPLimit()
      Returns the limit of the code point that was last returned by nextCaseMapCP().
    • getCPLength

      public int getCPLength()
    • reset

      public void reset(int direction)
      Description copied from interface: UCaseProps.ContextIterator
      Reset the iterator for forward or backward iteration.
      Specified by:
      reset in interface UCaseProps.ContextIterator
      Parameters:
      direction - >0: Begin iterating forward from the first code point after the one that is being case-mapped. invalid input: '<'0: Begin iterating backward from the first code point before the one that is being case-mapped.
    • next

      public int next()
      Description copied from interface: UCaseProps.ContextIterator
      Iterate and return the next code point, moving in the direction determined by the reset() call.
      Specified by:
      next in interface UCaseProps.ContextIterator
      Returns:
      Next code point, or invalid input: '<'0 when the iteration is done.