org.basex.data
Class PathSummary

java.lang.Object
  extended by org.basex.data.PathSummary

public final class PathSummary
extends java.lang.Object

This class stores the path summary of a document. It contains all unique location paths of the document.

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

Constructor Summary
PathSummary()
          Default Constructor.
PathSummary(Data d, DataInput in)
          Constructor, specifying an input file.
 
Method Summary
 void add(int n, int l, byte k)
          Opens an element.
 void add(int n, int l, byte k, int tl)
          Opens an element.
 java.util.ArrayList<PathNode> desc(java.util.ArrayList<PathNode> in, boolean desc)
          Returns all children or descendants of the specified nodes.
 TokenList desc(byte[] k, boolean d, boolean o)
          Returns descendant tags and attributes for the specified start key.
 void desc(PathNode in, java.util.ArrayList<PathNode> out, int t, int k, boolean desc)
          Adds nodes to the hash set if they comply to the specified arguments.
 TokenList desc(TokenList tl, boolean d, boolean o)
          Returns descendant tags and attributes for the specified descendant path.
 void init()
          Initializes the data structures.
 java.util.ArrayList<PathNode> parent(java.util.ArrayList<PathNode> in)
          Returns all parents of the specified nodes.
 java.util.ArrayList<PathNode> root()
          Returns the root node.
 void write(DataOutput out)
          Writes the path summary to the specified output.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PathSummary

public PathSummary()
Default Constructor.


PathSummary

public PathSummary(Data d,
                   DataInput in)
            throws java.io.IOException
Constructor, specifying an input file.

Parameters:
d - data reference
in - input stream
Throws:
java.io.IOException - I/O exception
Method Detail

init

public void init()
Initializes the data structures. This method is called if new statistics are created.


add

public void add(int n,
                int l,
                byte k)
Opens an element.

Parameters:
n - name reference
l - current level
k - node kind

add

public void add(int n,
                int l,
                byte k,
                int tl)
Opens an element.

Parameters:
n - name reference
l - current level
k - node kind
tl - length of text in bytes (0 for non-text nodes)

write

public void write(DataOutput out)
           throws java.io.IOException
Writes the path summary to the specified output.

Parameters:
out - output stream
Throws:
java.io.IOException - I/O exception

desc

public java.util.ArrayList<PathNode> desc(java.util.ArrayList<PathNode> in,
                                          boolean desc)
Returns all children or descendants of the specified nodes.

Parameters:
in - input nodes
desc - if false, return only children
Returns:
descendant nodes

parent

public java.util.ArrayList<PathNode> parent(java.util.ArrayList<PathNode> in)
Returns all parents of the specified nodes.

Parameters:
in - input nodes
Returns:
parent nodes

root

public java.util.ArrayList<PathNode> root()
Returns the root node.

Returns:
root node

desc

public void desc(PathNode in,
                 java.util.ArrayList<PathNode> out,
                 int t,
                 int k,
                 boolean desc)
Adds nodes to the hash set if they comply to the specified arguments.

Parameters:
in - input node
out - output nodes
t - name reference
k - node kind
desc - if false, return only children

desc

public TokenList desc(byte[] k,
                      boolean d,
                      boolean o)
Returns descendant tags and attributes for the specified start key.

Parameters:
k - input key
d - if false, return only children
o - true/false: sort by occurrence/lexicographically
Returns:
children

desc

public TokenList desc(TokenList tl,
                      boolean d,
                      boolean o)
Returns descendant tags and attributes for the specified descendant path.

Parameters:
tl - input steps
d - if false, return only children
o - true/false: sort by occurrence/lexicographically
Returns:
children