org.basex.query.iter
Class Iter

java.lang.Object
  extended by org.basex.query.iter.Iter
Direct Known Subclasses:
FTIter, NodeIter, ValueIter

public abstract class Iter
extends java.lang.Object

Iterator interface.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Constructor Summary
Iter()
           
 
Method Summary
 Item get(long i)
          Returns the specified item, or an arbitrary item if the index is invalid.
abstract  Item next()
          Returns the next item or null if no other items are found.
 boolean reset()
          Resets the iterator and returns true if operation was successful.
 long size()
          Returns the iterator size.
 Value value()
          Returns a sequence with all iterator values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Iter

public Iter()
Method Detail

next

public abstract Item next()
                   throws QueryException
Returns the next item or null if no other items are found.

Returns:
resulting item or null
Throws:
QueryException - query exception

get

public Item get(long i)
         throws QueryException
Returns the specified item, or an arbitrary item if the index is invalid. This method needs to be implemented - and should only be called - if size() returns the correct number of results. A calling method should call reset() after the last items has been retrieved.

Parameters:
i - value offset
Returns:
specified item
Throws:
QueryException - query exception

size

public long size()
Returns the iterator size. Note: -1 is returned if the result size is unknown. If this method is implemented by an iterator, get(long) needs to be implemented as well.

Returns:
number of entries

reset

public boolean reset()
Resets the iterator and returns true if operation was successful. false is returned if the iterator cannot be reset.

Returns:
true if operator could be reset

value

public Value value()
            throws QueryException
Returns a sequence with all iterator values. Must only be called if next() has not been called before.

Returns:
sequence
Throws:
QueryException - query exception