KnuthPossPosIter (Apache FOP Core 2.11 API)
Date: 2025-04-24

org.apache.fop.layoutmgr

## Class KnuthPossPosIter

- java.lang.Object
- - org.apache.fop.layoutmgr.PositionIterator
  - - org.apache.fop.layoutmgr.KnuthPossPosIter

- All Implemented Interfaces:
    Iterator<Position>

      public class KnuthPossPosIter
      extends PositionIterator

  A dedicated `PositionIterator` that is backed by an iterator over a list of `KnuthElement`s.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `KnuthPossPosIter(List elementList)` Auxiliary constructor
    `KnuthPossPosIter(List elementList, int startPos, int endPos)` Main constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `checkNext()`
    `ListElement` | `getKE()` Peek at next, returning as ListElement.
    `protected LayoutManager` | `getLM(Object nextObj)`
    `protected Position` | `getPos(Object nextObj)` Default implementation assumes that the passed `nextObj` is itself a `Position`, and just returns it.
    `Position` | `next()`

    - ### Methods inherited from class org.apache.fop.layoutmgr.PositionIterator

      `endIter, getNextChildLM, hasNext, peekNext, remove`

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

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

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

      `forEachRemaining`

- - ### Constructor Detail

    - #### KnuthPossPosIter

          public KnuthPossPosIter(List elementList,
                                  int startPos,
                                  int endPos)

      Main constructor
      Parameters:
        `elementList` - List of Knuth elements
        `startPos` - starting position, inclusive
        `endPos` - ending position, exclusive

    - #### KnuthPossPosIter

          public KnuthPossPosIter(List elementList)

      Auxiliary constructor
      Parameters:
        `elementList` - List of Knuth elements

  - ### Method Detail

    - #### checkNext

          protected boolean checkNext()

      Overrides:
        `checkNext` in class `PositionIterator`
      Returns:
        true if not at end of sub-sequence with same child layout manager

    - #### next

          public Position next()

      Specified by:
        `next` in interface `Iterator<Position>`
      Overrides:
        `next` in class `PositionIterator`

    - #### getKE

          public ListElement getKE()

      Peek at next, returning as ListElement.
      Returns:
        peek at next as ListElement

    - #### getLM

          protected LayoutManager getLM(Object nextObj)

      Overrides:
        `getLM` in class `PositionIterator`
      Parameters:
        `nextObj` - next object from which to obtain position
      Returns:
        layout manager

    - #### getPos

          protected Position getPos(Object nextObj)

      Default implementation assumes that the passed `nextObj` is itself a `Position`, and just returns it. Subclasses for which this is not the case, must provide a suitable override this method.
      Overrides:
        `getPos` in class `PositionIterator`
      Parameters:
        `nextObj` - next object from which to obtain position
      Returns:
        position of next object.

Copyright © 2025 Apache Software Foundation. All rights reserved.