Class ArrayRangeIterator

java.lang.Object
org.jibx.runtime.impl.ArrayRangeIterator
All Implemented Interfaces:
Iterator

public class ArrayRangeIterator extends Object implements Iterator
Iterator class for values contained in an array range. This type of iterator can be used for any contiguous range of items in an object array.
Version:
1.1
Author:
Dennis M. Sosnoski
  • Field Details

    • EMPTY_ITERATOR

      public static final ArrayRangeIterator EMPTY_ITERATOR
      Empty iterator used whenever possible.
    • m_array

      protected Object[] m_array
      Array supplying values for iteration.
    • m_offset

      protected int m_offset
      Offset of next iteration value.
    • m_limit

      protected int m_limit
      Ending offset for values.
  • Constructor Details

    • ArrayRangeIterator

      private ArrayRangeIterator(Object[] array, int start, int limit)
      Internal constructor.
      Parameters:
      array - array containing values to be iterated
      start - starting offset in array
      limit - offset past end of values
  • Method Details

    • hasNext

      public boolean hasNext()
      Check for iteration element available.
      Specified by:
      hasNext in interface Iterator
      Returns:
      true if element available, false if not
    • next

      public Object next()
      Get next iteration element.
      Specified by:
      next in interface Iterator
      Returns:
      next iteration element
      Throws:
      NoSuchElementException - if past end of iteration
    • remove

      public void remove()
      Remove element from iteration. This optional operation is not supported and always throws an exception.
      Specified by:
      remove in interface Iterator
      Throws:
      UnsupportedOperationException - for unsupported operation
    • buildIterator

      public static Iterator buildIterator(Object[] array, int start, int limit)
      Build iterator.
      Parameters:
      array - array containing values to be iterated (may be null)
      start - starting offset in array
      limit - offset past end of values
      Returns:
      constructed iterator