Class CodePointMap.StringIterator

java.lang.Object
com.ibm.icu.util.CodePointMap.StringIterator
Enclosing class:
CodePointMap

public class CodePointMap.StringIterator extends Object
Iterates over code points of a string and fetches map values. This does not implement java.util.Iterator.
 void onString(CodePointMap map, CharSequence s, int start) {
     CodePointMap.StringIterator iter = map.stringIterator(s, start);
     while (iter.next()) {
         int end = iter.getIndex();  // code point from between start and end
         useValue(s, start, end, iter.getCodePoint(), iter.getValue());
         start = end;
     }
 }
 

This class is not intended for public subclassing.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
    Deprecated.
    This API is ICU internal only.
    protected CharSequence
    Deprecated.
    This API is ICU internal only.
    protected int
    Deprecated.
    This API is ICU internal only.
    protected int
    Deprecated.
    This API is ICU internal only.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    StringIterator(CharSequence s, int sIndex)
    Deprecated.
    This API is ICU internal only.
  • Method Summary

    Modifier and Type
    Method
    Description
    final int
     
    final int
     
    final int
     
    boolean
    Reads the next code point, post-increments the string index, and gets a value from the map.
    boolean
    Reads the previous code point, pre-decrements the string index, and gets a value from the map.
    void
    reset(CharSequence s, int sIndex)
    Resets the iterator to a new string and/or a new string index.

    Methods inherited from class java.lang.Object

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

    • s

      Deprecated.
      This API is ICU internal only.
    • sIndex

      @Deprecated protected int sIndex
      Deprecated.
      This API is ICU internal only.
    • c

      @Deprecated protected int c
      Deprecated.
      This API is ICU internal only.
    • value

      @Deprecated protected int value
      Deprecated.
      This API is ICU internal only.
  • Constructor Details

    • StringIterator

      @Deprecated protected StringIterator(CharSequence s, int sIndex)
      Deprecated.
      This API is ICU internal only.
  • Method Details

    • reset

      public void reset(CharSequence s, int sIndex)
      Resets the iterator to a new string and/or a new string index.
      Parameters:
      s - string to iterate over
      sIndex - string index where the iteration will start
    • next

      public boolean next()
      Reads the next code point, post-increments the string index, and gets a value from the map. Sets an implementation-defined error value if the code point is an unpaired surrogate.
      Returns:
      true if the string index was not yet at the end of the string; otherwise the iterator did not advance
    • previous

      public boolean previous()
      Reads the previous code point, pre-decrements the string index, and gets a value from the map. Sets an implementation-defined error value if the code point is an unpaired surrogate.
      Returns:
      true if the string index was not yet at the start of the string; otherwise the iterator did not advance
    • getIndex

      public final int getIndex()
      Returns:
      the string index
    • getCodePoint

      public final int getCodePoint()
      Returns:
      the code point
    • getValue

      public final int getValue()
      Returns:
      the map value, or an implementation-defined error value if the code point is an unpaired surrogate