com.hp.hpl.jena.util.iterator
Class WrappedIterator

java.lang.Object
  extended by com.hp.hpl.jena.util.iterator.NiceIterator
      extended by com.hp.hpl.jena.util.iterator.WrappedIterator
All Implemented Interfaces:
ClosableIterator, ExtendedIterator, java.util.Iterator
Direct Known Subclasses:
EarlyBindingIterator, FilterIterator, Map1Iterator, RandomOrderIterator, UniqueExtendedIterator

public class WrappedIterator
extends NiceIterator

a WrappedIterator is an ExtendedIterator wrapping around a plain (or presented as plain) Iterator. The wrapping allows the usual extended operations (filtering, concatenating) to be done on an Iterator derived from some other source.

Author:
kers

Method Summary
 void close()
          close: defer to the base, iff it is closable
static void close(java.util.Iterator it)
          if it is a Closableiterator, close it.
static ExtendedIterator create(java.util.Iterator it)
          Answer an ExtendedIterator returning the elements of it.
static WrappedIterator createNoRemove(java.util.Iterator it)
          Answer an ExtendedIterator wrapped round it which does not permit .remove() even if it does.
 java.util.Iterator forTestingOnly_getBase()
           
 boolean hasNext()
          hasNext: defer to the base iterator
 java.lang.Object next()
          next: defer to the base iterator
 void remove()
          if .remove() is allowed, delegate to the base iterator's .remove; otherwise, throw an UnsupportedOperationException.
 
Methods inherited from class com.hp.hpl.jena.util.iterator.NiceIterator
andThen, andThen, emptyIterator, filterDrop, filterKeep, mapWith, removeNext
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static ExtendedIterator create(java.util.Iterator it)
Answer an ExtendedIterator returning the elements of it. If it is itself an ExtendedIterator, return that; otherwise wrap it.


createNoRemove

public static WrappedIterator createNoRemove(java.util.Iterator it)
Answer an ExtendedIterator wrapped round it which does not permit .remove() even if it does.


forTestingOnly_getBase

public java.util.Iterator forTestingOnly_getBase()

hasNext

public boolean hasNext()
hasNext: defer to the base iterator

Specified by:
hasNext in interface java.util.Iterator
Overrides:
hasNext in class NiceIterator

next

public java.lang.Object next()
next: defer to the base iterator

Specified by:
next in interface java.util.Iterator
Overrides:
next in class NiceIterator

remove

public void remove()
if .remove() is allowed, delegate to the base iterator's .remove; otherwise, throw an UnsupportedOperationException.

Specified by:
remove in interface java.util.Iterator
Overrides:
remove in class NiceIterator

close

public void close()
close: defer to the base, iff it is closable

Specified by:
close in interface ClosableIterator
Overrides:
close in class NiceIterator

close

public static void close(java.util.Iterator it)
if it is a Closableiterator, close it. Abstracts away from tests [that were] scattered through the code.



Copyright © 2000, 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP