Package org.basex.index.path
Class PathIndex
java.lang.Object
org.basex.index.path.PathIndex
- All Implemented Interfaces:
Index
This class stores the path summary of a database.
It contains all unique location paths.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the index.costs(IndexSearch search) Computes costs for performing the specified search.voidSets the data reference.desc(byte[] name) Returns all descendants with the specified element name.desc(byte[] name, boolean desc, boolean occ) Returns descendant element and attribute names for the specified start key.Returns all children or descendants of the specified nodes.Returns descendant element and attribute names for the specified descendant path.booleandrop()Drops the index.entries(IndexEntries entries) Returns all entries that match the specified token.voidindex(int name, byte kind, int level) Adds an element or document node.voidAdds an entry, including its value.byte[]info(MainOptions options) Returns information on the index structure.voidinit()Initializes the index.iter(IndexSearch search) Returns an iterator for the index results.Returns all parents of the specified nodes.root()Returns the root node.toString()voidwrite(DataOutput out) Writes the path summary to the specified output.
-
Constructor Details
-
PathIndex
public PathIndex()Constructor. TheDatareference must be set in a second step viadata(Data). -
PathIndex
Constructor, specifying a data reference.- Parameters:
data- data reference
-
PathIndex
Constructor, specifying an input file.- Parameters:
data- data referencein- input stream- Throws:
IOException- I/O exception
-
-
Method Details
-
write
Writes the path summary to the specified output.- Parameters:
out- output stream- Throws:
IOException- I/O exception
-
data
Sets the data reference.- Parameters:
dt- reference
-
init
public void init()Initializes the index. -
close
public void close()Description copied from interface:IndexCloses the index. -
index
public void index(int name, byte kind, int level) Adds an element or document node.- Parameters:
name- name id (0for nodes other than elements and attributes)kind- node kindlevel- current level
-
index
Adds an entry, including its value.- Parameters:
name- name id (0for nodes other than elements and attributes)kind- node kindlevel- current levelvalue- value (nullfor element or document nodes)meta- meta data (ignored if value isnull)
-
root
Returns the root node.- Returns:
- root node
-
parent
Returns all parents of the specified nodes. Called by the query optimizer.- Parameters:
nodes- input nodes- Returns:
- parent nodes
-
desc
Returns all children or descendants of the specified nodes. Called by the query parser and optimizer.- Parameters:
nodes- input nodesdesc- if false, return only children- Returns:
- descendant nodes
-
desc
Returns all descendants with the specified element name. Called by the query optimizer.- Parameters:
name- local name- Returns:
- descendant nodes
-
desc
Returns descendant element and attribute names for the specified start key. Called by the GUI.- Parameters:
name- input keydesc- if false, return only childrenocc- true/false: sort by occurrence/lexicographically- Returns:
- names
-
desc
Returns descendant element and attribute names for the specified descendant path. Called by the GUI.- Parameters:
names- input stepsdesc- if false, return only childrenocc- true/false: sort by occurrence/lexicographically- Returns:
- children
-
info
Description copied from interface:IndexReturns information on the index structure. -
drop
public boolean drop()Description copied from interface:IndexDrops the index. Also returns true if the index does not exist. -
iter
Description copied from interface:IndexReturns an iterator for the index results. -
costs
Description copied from interface:IndexComputes costs for performing the specified search. An integer is returned:- A negative value indicates that index access is not possible.
- A value of zero indicates that no results will be returned.
- A small value indicates that index access is fast.
-
entries
Description copied from interface:IndexReturns all entries that match the specified token. -
toString
-