org.basex.query.iter
Class NodIter

java.lang.Object
  extended by org.basex.query.iter.Iter
      extended by org.basex.query.iter.NodeIter
          extended by org.basex.query.iter.NodIter

public final class NodIter
extends NodeIter

Simple node Iterator, ignoring duplicates.

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

Field Summary
 Nod[] item
          Items.
 int size
          Size.
 
Fields inherited from class org.basex.query.iter.Iter
EMPTY
 
Constructor Summary
NodIter()
          Constructor.
NodIter(boolean d)
          Constructor.
NodIter(Nod[] it, int s)
          Constructor.
 
Method Summary
 void add(Nod n)
          Adds a node.
 boolean contains(DBNode node)
          Checks if the iterator contains a database node with the specified pre value.
 boolean dbnodes()
          Checks if binary search can be applied to this iterator, i.e.
 void delete(int p)
          Deletes a value at the specified position.
 Item finish()
          Returns a sequence from all iterator values.
 Nod get(int i)
          Returns the specified node.
 Nod get(long i)
          Returns the specified item.
 Nod next()
          Returns the next item or null if no other items are found.
 boolean reset()
          Resets the iterator and returns true.
 int size()
          Returns the number of entries.
 void sort(boolean force)
          Sorts the nodes.
 String toString()
           
 
Methods inherited from class org.basex.query.iter.Iter
reverse
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

item

public Nod[] item
Items.


size

public int size
Size.

Constructor Detail

NodIter

public NodIter()
Constructor.


NodIter

public NodIter(boolean d)
Constructor.

Parameters:
d - returns if the iterator might return duplicates

NodIter

public NodIter(Nod[] it,
               int s)
Constructor.

Parameters:
it - item array
s - size
Method Detail

get

public Nod get(int i)
Returns the specified node.

Parameters:
i - node offset
Returns:
node

delete

public void delete(int p)
Deletes a value at the specified position.

Parameters:
p - deletion position

add

public void add(Nod n)
Adds a node.

Parameters:
n - node to be added

reset

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

Overrides:
reset in class Iter
Returns:
true if operator could be reset

next

public Nod next()
Description copied from class: Iter
Returns the next item or null if no other items are found.

Specified by:
next in class NodeIter
Returns:
resulting item

get

public Nod get(long i)
Description copied from class: Iter
Returns the specified item. Note: null is returned if the item cannot be retrieved, so the returned value has to be checked.

Overrides:
get in class Iter
Parameters:
i - value offset
Returns:
specified item

size

public int size()
Description copied from class: Iter
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, Iter.get(long) has to be implemented as well.

Overrides:
size in class Iter
Returns:
number of entries

finish

public Item finish()
Description copied from class: Iter
Returns a sequence from all iterator values. Should be called before Iter.next().

Overrides:
finish in class Iter
Returns:
sequence

dbnodes

public boolean dbnodes()
Checks if binary search can be applied to this iterator, i.e. if all nodes are DBNode references and refer to the same database.

Returns:
result of check

contains

public boolean contains(DBNode node)
Checks if the iterator contains a database node with the specified pre value. All nodes are assumed to be DBNode references and sorted.

Parameters:
node - node to be found
Returns:
result of check

sort

public void sort(boolean force)
Sorts the nodes.

Parameters:
force - force sort

toString

public String toString()
Overrides:
toString in class Object