org.apache.fop.fo

## Class RecursiveCharIterator

- java.lang.Object
- - org.apache.fop.fo.CharIterator
  - - org.apache.fop.fo.RecursiveCharIterator

- All Implemented Interfaces:
    Cloneable, Iterator

      public class RecursiveCharIterator
      extends CharIterator

  Kind of a super-iterator that iterates through child nodes of an FONode, in turn managing character iterators for each of them. Caveat: Because this class is itself a CharIterator, and manages a collection of CharIterators, it is easy to get confused.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RecursiveCharIterator(FObj fobj)` Constructor which creates an iterator for all child nodes
    `RecursiveCharIterator(FObj fobj, FONode child)` Constructor which creates an iterator for only some child nodes

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `clone()`
    `boolean` | `hasNext()`
    `CharIterator` | `mark()`
    `char` | `nextChar()`
    `void` | `remove()`
    `void` | `replaceChar(char c)` Replaces the current character in the CharIterator with a specified character

    - ### Methods inherited from class org.apache.fop.fo.CharIterator

      `next`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.Iterator

      `forEachRemaining`

- - ### Constructor Detail

    - #### RecursiveCharIterator

          public RecursiveCharIterator(FObj fobj)

      Constructor which creates an iterator for all child nodes
      Parameters:
        `fobj` - FONode for which an iterator should be created

    - #### RecursiveCharIterator

          public RecursiveCharIterator(FObj fobj,
                                       FONode child)

      Constructor which creates an iterator for only some child nodes
      Parameters:
        `fobj` - FObj for which an iterator should be created
        `child` - FONode of the first child to include in iterator

  - ### Method Detail

    - #### mark

          public CharIterator mark()

      Returns:
        clone of this, cast as a CharIterator

    - #### clone

          public Object clone()

      Description copied from class: `CharIterator`
      Overrides:
        `clone` in class `CharIterator`
      Returns:
        a clone of this

    - #### replaceChar

          public void replaceChar(char c)

      Replaces the current character in the CharIterator with a specified character
      Overrides:
        `replaceChar` in class `CharIterator`
      Parameters:
        `c` - the character which should be used to replace the current character

    - #### hasNext

          public boolean hasNext()

      Description copied from class: `CharIterator`
      Specified by:
        `hasNext` in interface `Iterator`
      Specified by:
        `hasNext` in class `CharIterator`
      Returns:
        true if there are more items in the CharIterator

    - #### nextChar

          public char nextChar()
                        throws NoSuchElementException

      Specified by:
        `nextChar` in class `CharIterator`
      Returns:
        the character that is the next character in the collection
      Throws:
        `NoSuchElementException` - if there are no more characters (test for this condition with java.util.Iterator.hasNext()).

    - #### remove

          public void remove()

      Specified by:
        `remove` in interface `Iterator`
      Overrides:
        `remove` in class `CharIterator`

Copyright © 2023 Apache Software Foundation. All rights reserved.