org.basex.data
Class Nodes

java.lang.Object
  extended by org.basex.data.Nodes
All Implemented Interfaces:
Result

public final class Nodes
extends Object
implements Result

This class stores node references of a database in an ascending order. Instances of this class are used in the Context class to reference the currently used nodes.

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

Field Summary
 Data data
          Root Node.
 boolean doc
          Doc flag (all nodes refer to documents).
 FTPosData ftpos
          Full-text position data (for visualization).
 int[] nodes
          Pre values container.
 int[] sorted
          Sorted pre values.
 
Constructor Summary
Nodes(Data d)
          Node Set constructor.
Nodes(int[] n)
          Node Set constructor (used by test classes).
Nodes(int[] n, Data d)
          Node Set constructor.
Nodes(int[] n, Data d, FTPosData ft)
          Node Set constructor.
Nodes(int n, Data d)
          Node Set constructor.
 
Method Summary
 boolean contains(int p)
          Checks if the specified node is contained in the array.
 int find(int p)
          Returns the position of the specified node or the negative value - 1 of the position where it should have been found.
 boolean same(Result v)
          Compares values for equality.
 void serialize(Serializer ser)
          Serializes the complete result.
 void serialize(Serializer ser, int n)
          Serializes the specified result.
 int size()
          Number of values, stored in the result instance.
 void toggle(int p)
          Adds or removes the specified pre node.
 String toString()
           
 void union(int[] p)
          Merges the specified array with the existing pre nodes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

doc

public boolean doc
Doc flag (all nodes refer to documents).


data

public Data data
Root Node.


ftpos

public FTPosData ftpos
Full-text position data (for visualization).


nodes

public int[] nodes
Pre values container.


sorted

public int[] sorted
Sorted pre values.

Constructor Detail

Nodes

public Nodes(Data d)
Node Set constructor.

Parameters:
d - data reference

Nodes

public Nodes(int n,
             Data d)
Node Set constructor.

Parameters:
n - single node
d - data reference

Nodes

public Nodes(int[] n,
             Data d)
Node Set constructor.

Parameters:
n - node set
d - data reference

Nodes

public Nodes(int[] n,
             Data d,
             FTPosData ft)
Node Set constructor.

Parameters:
n - node set
d - data reference
ft - ft position data

Nodes

public Nodes(int[] n)
Node Set constructor (used by test classes). No data reference is defined by this constructor.

Parameters:
n - node set
Method Detail

size

public int size()
Description copied from interface: Result
Number of values, stored in the result instance.

Specified by:
size in interface Result
Returns:
number of values

same

public boolean same(Result v)
Description copied from interface: Result
Compares values for equality.

Specified by:
same in interface Result
Parameters:
v - value to be compared
Returns:
true if values are equal

contains

public boolean contains(int p)
Checks if the specified node is contained in the array.

Parameters:
p - pre value
Returns:
true if the node was found

find

public int find(int p)
Returns the position of the specified node or the negative value - 1 of the position where it should have been found.

Parameters:
p - pre value
Returns:
true if the node was found

toggle

public void toggle(int p)
Adds or removes the specified pre node.

Parameters:
p - pre value

union

public void union(int[] p)
Merges the specified array with the existing pre nodes.

Parameters:
p - pre value

serialize

public void serialize(Serializer ser)
               throws IOException
Description copied from interface: Result
Serializes the complete result.

Specified by:
serialize in interface Result
Parameters:
ser - serializer
Throws:
IOException - I/O exception

serialize

public void serialize(Serializer ser,
                      int n)
               throws IOException
Description copied from interface: Result
Serializes the specified result.

Specified by:
serialize in interface Result
Parameters:
ser - serializer
n - results offset to serialize
Throws:
IOException - I/O exception

toString

public String toString()
Overrides:
toString in class Object