de.rwth.utils
Class IteratorSequence

java.lang.Object
  |
  +--de.rwth.utils.IteratorSequence
All Implemented Interfaces:
java.util.Iterator

public class IteratorSequence
extends java.lang.Object
implements java.util.Iterator

An iterator which goes over an array of base iterators in sequence.

Version:
$Id: IteratorSequence.java,v 1.2 2002/09/17 06:53:53 mohnen Exp $
Author:
Markus Mohnen

Field Summary
protected  int count
          The current index in iterators
protected  java.util.Iterator[] iterators
          The array of base iterators.
 
Constructor Summary
IteratorSequence(java.util.Iterator[] iterators)
          Creates a new IteratorSequence instance from an array of base iterators..
IteratorSequence(java.util.Iterator i1, java.util.Iterator i2)
          Creates a new IteratorSequence instance from two base iterators.
 
Method Summary
 boolean hasNext()
           
static void main(java.lang.String[] args)
          Mini test environment.
 java.lang.Object next()
           
protected  void proceedToNext()
          Advances count to the next base iterator which still has elements pending.
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iterators

protected java.util.Iterator[] iterators
The array of base iterators.

count

protected int count
The current index in iterators
Constructor Detail

IteratorSequence

public IteratorSequence(java.util.Iterator[] iterators)
Creates a new IteratorSequence instance from an array of base iterators..
Parameters:
iterators - an Iterator[] value: The base iterators.

IteratorSequence

public IteratorSequence(java.util.Iterator i1,
                        java.util.Iterator i2)
Creates a new IteratorSequence instance from two base iterators.
Parameters:
i1 - an Iterator value: First base iterator.
i2 - an Iterator value: Second base iterator.
Method Detail

proceedToNext

protected void proceedToNext()
Advances count to the next base iterator which still has elements pending.

next

public java.lang.Object next()
                      throws java.util.NoSuchElementException
Specified by:
next in interface java.util.Iterator

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator

remove

public void remove()
Specified by:
remove in interface java.util.Iterator

main

public static void main(java.lang.String[] args)
Mini test environment.
Parameters:
args - a String[] value