org.basex.data
Class PathSummary

java.lang.Object
  extended by org.basex.data.PathSummary
All Implemented Interfaces:
Index

public final class PathSummary
extends Object
implements Index

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-10, ISC License, Christian Gruen

Field Summary
 PathNode root
          Root node.
 
Constructor Summary
PathSummary()
          Default constructor.
PathSummary(DataInput in)
          Constructor, specifying an input file.
 
Method Summary
 void add(int n, int l, byte k)
          Opens an element.
 void close()
          Closes the index.
 ArrayList<PathNode> desc(ArrayList<PathNode> in, boolean desc)
          Returns all children or descendants of the specified nodes.
 TokenList desc(byte[] k, Data data, boolean d, boolean o)
          Returns descendant tags and attributes for the specified start key.
 void desc(PathNode in, 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, Data data, boolean d, boolean o)
          Returns descendant tags and attributes for the specified descendant path.
 IndexIterator ids(IndexToken tok)
          Returns an iterator for the index results.
 byte[] info()
          Returns information on the index structure.
 void init()
          Initializes the data structures.
 int nrIDs(IndexToken tok)
          Returns the (approximate/estimated) number of ids for the specified token.
 ArrayList<PathNode> parent(ArrayList<PathNode> in)
          Returns all parents of the specified nodes.
 void plan(Data data, Serializer ser)
          Serializes the path node.
 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
 

Field Detail

root

public PathNode root
Root node.

Constructor Detail

PathSummary

public PathSummary()
Default constructor.


PathSummary

public PathSummary(DataInput in)
            throws IOException
Constructor, specifying an input file.

Parameters:
in - input stream
Throws:
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

write

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

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

desc

public ArrayList<PathNode> desc(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 ArrayList<PathNode> parent(ArrayList<PathNode> in)
Returns all parents of the specified nodes.

Parameters:
in - input nodes
Returns:
parent nodes

root

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

Returns:
root node

desc

public void desc(PathNode in,
                 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,
                      Data data,
                      boolean d,
                      boolean o)
Returns descendant tags and attributes for the specified start key.

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

desc

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

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

plan

public void plan(Data data,
                 Serializer ser)
          throws IOException
Serializes the path node.

Parameters:
data - data reference
ser - serializer
Throws:
IOException - I/O exception

ids

public IndexIterator ids(IndexToken tok)
Description copied from interface: Index
Returns an iterator for the index results.

Specified by:
ids in interface Index
Parameters:
tok - token to be found
Returns:
ids

nrIDs

public int nrIDs(IndexToken tok)
Description copied from interface: Index
Returns the (approximate/estimated) number of ids for the specified token.

Specified by:
nrIDs in interface Index
Parameters:
tok - token to be found
Returns:
number of ids

close

public void close()
Description copied from interface: Index
Closes the index.

Specified by:
close in interface Index

info

public byte[] info()
Description copied from interface: Index
Returns information on the index structure.

Specified by:
info in interface Index
Returns:
info