org.basex.query.iter
Class Iter

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

public abstract class Iter
extends Object

Iterator interface.

Author:
Workgroup DBIS, University of Konstanz 2005-10, ISC License, Christian Gruen

Field Summary
static Iter EMPTY
          Empty iterator.
 
Constructor Summary
Iter()
           
 
Method Summary
 Item finish()
          Returns a sequence from all iterator values.
 Item get(long i)
          Returns the specified item.
abstract  Item next()
          Returns the next item or null if no other items are found.
 boolean reset()
          Resets the iterator and returns true.
 boolean reverse()
          Reverses the iterator and returns true.
 int size()
          Returns the number of entries.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY

public static final Iter EMPTY
Empty iterator.

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
Throws:
QueryException - query exception

get

public Item get(long i)
Returns the specified item. Note: null is returned if the item cannot be retrieved, so the returned value has to be checked.

Parameters:
i - value offset
Returns:
specified item

size

public int size()
Returns the number of entries. Note: -1 is returned if the number cannot be retrieved, so the returned value has to be checked. If this method is implemented, get(long) has to be implemented as well.

Returns:
number of entries

reset

public boolean reset()
Resets the iterator and returns true. Note: false is returned if the iterator cannot be reset, so the returned value has to be checked.

Returns:
true if operator could be reset

reverse

public boolean reverse()
Reverses the iterator and returns true. Note: false is returned if the iterator cannot be reset, so the returned value has to be checked.

Returns:
true if operator could be reversed

finish

public Item finish()
            throws QueryException
Returns a sequence from all iterator values. Should be called before next().

Returns:
sequence
Throws:
QueryException - query exception