Class ReplaceableContextIterator

java.lang.Object
com.ibm.icu.text.ReplaceableContextIterator
All Implemented Interfaces:
UCaseProps.ContextIterator

class ReplaceableContextIterator extends Object implements UCaseProps.ContextIterator
Implementation of UCaseProps.ContextIterator, iterates over a Replaceable. See casetrn.cpp/utrans_rep_caseContextIterator(). See also UCharacter.StringContextIterator.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
     
    protected int
     
    protected int
     
    protected int
     
    protected int
     
    protected int
     
    protected int
     
    protected boolean
     
    protected Replaceable
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Did forward context iteration with next() reach the iteration limit?
    int
    Get the index of where the code point currently being case-mapped starts.
    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.
    int
    Replace the current code point by its case mapping, and update the indexes.
    void
    reset(int direction)
    Reset the iterator for forward or backward iteration.
    void
    setContextLimits(int contextStart, int contextLimit)
    Set the start and limit indexes for context iteration with next().
    void
    setIndex(int index)
    Set the index where nextCaseMapCP() is to start iterating.
    void
    setLimit(int lim)
    Set the iteration limit for nextCaseMapCP() to an index within the string.
    void
    Set the text for iteration.

    Methods inherited from class java.lang.Object

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

    • rep

      protected Replaceable rep
    • index

      protected int index
    • limit

      protected int limit
    • cpStart

      protected int cpStart
    • cpLimit

      protected int cpLimit
    • contextStart

      protected int contextStart
    • contextLimit

      protected int contextLimit
    • dir

      protected int dir
    • reachedLimit

      protected boolean reachedLimit
  • Constructor Details

    • ReplaceableContextIterator

      ReplaceableContextIterator()
      Constructor.
      Parameters:
      rep - Replaceable to iterate over.
  • Method Details

    • setText

      public void setText(Replaceable rep)
      Set the text for iteration.
      Parameters:
      rep - Iteration text.
    • setIndex

      public void setIndex(int index)
      Set the index where nextCaseMapCP() is to start iterating.
      Parameters:
      index - Iteration start index for nextCaseMapCP().
    • getCaseMapCPStart

      public int getCaseMapCPStart()
      Get the index of where the code point currently being case-mapped starts.
      Returns:
      The start index of the current code point.
    • 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.
      Parameters:
      lim - The iteration limit.
    • setContextLimits

      public void setContextLimits(int contextStart, int contextLimit)
      Set the start and limit indexes for context iteration with next().
      Parameters:
      contextStart - Start of context for next().
      contextLimit - Limit of context for next().
    • 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.
      Returns:
      The next code point to be case-mapped, or <0 when the iteration is done.
    • replace

      public int replace(String text)
      Replace the current code point by its case mapping, and update the indexes.
      Parameters:
      text - Replacement text.
      Returns:
      The delta for the change of the text length.
    • didReachLimit

      public boolean didReachLimit()
      Did forward context iteration with next() reach the iteration limit?
      Returns:
      Boolean value.
    • 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. <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 <0 when the iteration is done.