org.basex.data
Class Nodes

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

public final class Nodes
extends java.lang.Object
implements Result

This is a container for context nodes. Instances of this class are stored in the Context class to reference the currently used nodes.

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

Field Summary
 Data data
          Root Node.
 int[] pre
          Pre values container.
 int size
          Number of stored nodes.
 
Constructor Summary
Nodes(Data d)
          Node Set constructor.
Nodes(int[] n, Data d)
          Node Set constructor.
Nodes(int n, Data d)
          Node Set constructor.
 
Method Summary
 Nodes add(int p)
          The specified pre value is added to or removed from the context set.
 Nodes copy()
          Returns a copy of the node set.
 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 sameAs(Result v)
          Compares values for equality.
 void serialize(PrintOutput out, boolean valid)
          Serializes the stored data to the specified output stream.
 void serialize(ResultReader rr)
          Serializes the stored data to the specified reader.
 int size()
          Number of values, stored in the result instance.
 Nodes toggle(int p)
          The specified pre value is added to or removed from the context set.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

public Data data
Root Node.


pre

public int[] pre
Pre values container.


size

public int size
Number of stored nodes.

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 - node set
d - data reference

Nodes

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

Parameters:
n - node set
d - data reference
Method Detail

add

public Nodes add(int p)
The specified pre value is added to or removed from the context set.

Parameters:
p - pre value
Returns:
self reference

copy

public Nodes copy()
Returns a copy of the node set.

Returns:
copy

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

sameAs

public boolean sameAs(Result v)
Compares values for equality.

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

serialize

public void serialize(PrintOutput out,
                      boolean valid)
               throws java.io.IOException
Serializes the stored data to the specified output stream.

Specified by:
serialize in interface Result
Parameters:
out - output stream
valid - well-formed output
Throws:
java.io.IOException - in case of problems with the PrintOutput

serialize

public void serialize(ResultReader rr)
               throws org.xml.sax.SAXException
Serializes the stored data to the specified reader.

Specified by:
serialize in interface Result
Parameters:
rr - default handler
Throws:
org.xml.sax.SAXException - in case of problems with the PrintOutput

size

public int size()
Number of values, stored in the result instance.

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

toggle

public Nodes toggle(int p)
The specified pre value is added to or removed from the context set.

Parameters:
p - pre value
Returns:
self reference

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object