Class ChainedEnumerator

java.lang.Object
com.tangosol.util.Base
com.tangosol.util.ChainedEnumerator
All Implemented Interfaces:
Enumeration, Iterator

public class ChainedEnumerator extends Base implements Enumeration, Iterator
Provide an enumerator which enumerates the contents of multiple enumerators.
Author:
cp 1998.08.07
  • Field Details

    • m_listIter

      protected List m_listIter
      The Iterators.
    • m_iNextIter

      protected int m_iNextIter
      The next Iterator (index into the m_listIter) to iterate.
    • m_iterCurrent

      protected Iterator m_iterCurrent
      The current Iterator.
  • Constructor Details

    • ChainedEnumerator

      public ChainedEnumerator()
      Construct an enumerator that will first enumerate multiple enumerators.
    • ChainedEnumerator

      public ChainedEnumerator(Enumeration enmrFirst)
      Construct an enumerator that will first enumerate the passed Enumeration.
      Parameters:
      enmrFirst - the first Enumeration
    • ChainedEnumerator

      public ChainedEnumerator(Iterator iterator)
      Construct an enumerator that will first enumerate the passed Iterator.
      Parameters:
      iterator - the first Iterator
    • ChainedEnumerator

      public ChainedEnumerator(Enumeration enmrFirst, Enumeration enmrSecond)
      Construct an enumerator that will first enumerate the first Enumeration and then will enumerate the second Enumeration as if they were together a single Enumeration.
      Parameters:
      enmrFirst - the first Enumeration
      enmrSecond - the second Enumeration
    • ChainedEnumerator

      public ChainedEnumerator(Iterator iterFirst, Iterator iterSecond)
      Construct an enumerator that will first enumerate the first Iterator and then will enumerate the second Iterator as if they were together a single Iterator.
      Parameters:
      iterFirst - the first Iterator
      iterSecond - the second Iterator
    • ChainedEnumerator

      public ChainedEnumerator(Enumeration[] aEnum)
      Construct an enumerator that will first enumerate the Enumerations passed in the array as if they were together a single enumerator.
      Parameters:
      aEnum - an array of Enumerations
    • ChainedEnumerator

      public ChainedEnumerator(Iterator[] aIterator)
      Construct an enumerator that will first enumerate the Iterators passed in the array as if they were together a single enumerator.
      Parameters:
      aIterator - an array of Iterators
  • Method Details

    • addEnumeration

      public void addEnumeration(Enumeration enmr)
      Add the Enumeration to the end of the chain.
      Parameters:
      enmr - an Enumeration
    • addIterator

      public void addIterator(Iterator iterator)
      Add the Iterator to the end of the chain.
      Parameters:
      iterator - an Iterator
    • hasMoreElements

      public boolean hasMoreElements()
      Tests if this enumeration contains more elements.
      Specified by:
      hasMoreElements in interface Enumeration
      Returns:
      true if the enumeration contains more elements, false otherwise
    • nextElement

      public Object nextElement()
      Returns the next element of this enumeration.
      Specified by:
      nextElement in interface Enumeration
      Returns:
      the next element in the enumeration
    • hasNext

      public boolean hasNext()
      Tests if this Iterator contains more elements.
      Specified by:
      hasNext in interface Iterator
      Returns:
      true if the Iterator contains more elements, false otherwise
    • next

      public Object next()
      Returns the next element of this Iterator.
      Specified by:
      next in interface Iterator
      Returns:
      the next element in the Iterator
    • remove

      public void remove()
      Remove the last-returned element that was returned by the Iterator. This method always throws UnsupportedOperationException because the Iterator is immutable.
      Specified by:
      remove in interface Iterator
    • getIterator

      protected Iterator getIterator()
      Get the current or next enumeration in the list
      Returns:
      the current enumeration.
    • getRecentIterator

      protected Iterator getRecentIterator()
      Get the recently used iterator, if any.
      Returns:
      the iterator that was most recently used