com.hp.hpl.jena.util
Class ConcatenatedNodeIterator

java.lang.Object
  |
  +--com.hp.hpl.jena.util.ConcatenatedNodeIterator
All Implemented Interfaces:
NodeIterator

public class ConcatenatedNodeIterator
extends java.lang.Object
implements NodeIterator

An iterator that represents the concatenation of two individual RDF Node iterators. The concatenated iterator will range over the elements of the first iterator, followed by the elements of the second.

Version:
CVS info: $Id: ConcatenatedNodeIterator.java,v 1.1 2001/09/24 17:02:35 ijd Exp $
Author:
Ian Dickinson, HP Labs (email)

Constructor Summary
ConcatenatedNodeIterator(NodeIterator iter0, NodeIterator iter1)
          Construct an iterator that is the concatenation of the two given iterators.
 
Method Summary
 void close()
          Close the concatenated iterator, which has the effect of closing both of the underlying iterators.
 boolean hasNext()
          Returns true if the iteration has more elements.
 RDFNode next()
          Returns the next element in the interation.
 void remove()
          Removes from the underlying collection the last element returned by the iterator (optional operation).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConcatenatedNodeIterator

public ConcatenatedNodeIterator(NodeIterator iter0,
                                NodeIterator iter1)
Construct an iterator that is the concatenation of the two given iterators.
Parameters:
iter0 - The first iterator. Elements of this iterator will appear first in the elements read from the concatenation.
iter1 - The second iterator. Elements of this iterator will appear second in the elements read from the concatenation.
Method Detail

hasNext

public boolean hasNext()
                throws RDFException
Returns true if the iteration has more elements. This will be true if either of the underlying iterators has more elements.
Specified by:
hasNext in interface NodeIterator
Returns:
true if the iterator has more elements.

next

public RDFNode next()
             throws RDFException
Returns the next element in the interation.
Specified by:
next in interface NodeIterator
Returns:
The next object in the iteration, which will correspond to the next object in the underlying iteration, projected to the range of the projection function.
Throws:
NoSuchElementException - - iteration has no more elements.

remove

public void remove()
Removes from the underlying collection the last element returned by the iterator (optional operation). Not supported on a concatenated iterator.
Specified by:
remove in interface NodeIterator
Throws:
java.lang.UnsupportedOperationException - - if the remove operation is not supported by this Iterator.
IllegalStateException - - if the next method has not yet been called, or the remove method has already been called after the last call to the next method.

close

public void close()
           throws RDFException
Close the concatenated iterator, which has the effect of closing both of the underlying iterators.
Specified by:
close in interface NodeIterator
Following copied from interface: com.hp.hpl.mesa.rdf.jena.model.NodeIterator
Throws:
RDFException - Generic RDF exception.


Copyright © 2001 Hewlett-Packard. All Rights Reserved.