org.basex.query.value.node
Class DBNode

java.lang.Object
  extended by org.basex.data.ExprInfo
      extended by org.basex.query.expr.Expr
          extended by org.basex.query.value.Value
              extended by org.basex.query.value.item.Item
                  extended by org.basex.query.value.node.ANode
                      extended by org.basex.query.value.node.DBNode
All Implemented Interfaces:
java.lang.Iterable<Item>
Direct Known Subclasses:
FTNode, FTPosNode

public class DBNode
extends ANode

Database nodes.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Nested Class Summary
 
Nested classes/interfaces inherited from class org.basex.query.expr.Expr
Expr.Flag
 
Field Summary
 Data data
          Data reference.
 int pre
          Pre value.
 
Fields inherited from class org.basex.query.value.node.ANode
id
 
Fields inherited from class org.basex.query.value.item.Item
score, UNDEF
 
Fields inherited from class org.basex.query.value.Value
type
 
Constructor Summary
DBNode(Data d)
          Constructor, creating a document node from the specified data reference.
DBNode(Data d, int p)
          Constructor, creating a node from the specified data reference.
DBNode(Data d, int p, int k)
          Constructor, specifying full node information.
DBNode(IO input, Prop prop)
          Constructor, specifying an XML input reference.
DBNode(Parser parser)
          Constructor, specifying a parser reference.
 
Method Summary
 AxisIter ancestor()
          Returns an ancestor axis iterator.
 AxisIter ancestorOrSelf()
          Returns an ancestor-or-self axis iterator.
 AxisMoreIter attributes()
          Returns an attribute axis iterator.
 byte[] baseURI()
          Returns the base URI of the node.
 AxisMoreIter children()
          Returns a child axis iterator.
 DBNode copy()
          Creates a copy of this node.
 Value copy(QueryContext ctx, VarScope scp, IntObjMap<Var> vs)
          Copies an expression.
 Data data()
          Returns the data reference (if) attached to this value.
 DBNode dbCopy(Prop prop)
          Returns a database node representation of the node.
 double dbl(InputInfo ii)
          Returns a double representation of the value.
 DBNode deepCopy()
          Returns a deep copy of the node.
 AxisIter descendant()
          Returns a descendant axis iterator.
 AxisIter descendantOrSelf()
          Returns a descendant-or-self axis iterator.
 int diff(ANode node)
          Checks the document order of two nodes.
 DBNode finish()
          Returns a final node representation.
 AxisIter following()
          Returns a following axis iterator.
 AxisIter followingSibling()
          Returns a following-sibling axis iterator.
 boolean hasChildren()
          Returns true if the node has children.
 boolean is(ANode node)
          Checks if two nodes are identical.
 long itr(InputInfo ii)
          Returns an integer (long) representation of the value.
 byte[] name()
          Returns the name of the node, composed of an optional prefix and the local name.
 Atts namespaces()
          Returns all namespaces defined for the nodes.
 ANode parent()
          Returns the parent node.
 DBNode parent(ANode p)
          Sets the parent node.
 AxisIter parentIter()
          Returns a parent axis iterator.
 void plan(FElem plan)
          Creates an expression tree.
 QNm qname()
          Returns the QName of the node.
 QNm qname(QNm name)
          Updates the specified with the information of the current node.
 boolean sameAs(Expr cmp)
          Compares the current and specified expression for equality.
 void set(int p, int k)
          Sets the node type.
 byte[] string()
          Returns the string value.
 java.lang.String toString()
           
 Type.ID typeId()
          Returns a type id.
 byte[] xdmInfo()
          Returns data model info.
 
Methods inherited from class org.basex.query.value.node.ANode
attribute, attribute, attribute, bool, diff, diff, eq, kind, kind, nodeType, nsScope, optimize, preceding, precedingSibling, self, string, toJava, type, uri
 
Methods inherited from class org.basex.query.value.item.Item
castErr, comparable, dec, description, ebv, equiv, flt, hash, homogeneous, input, isItem, item, itemAt, iter, iterable, materialize, score, score, size, test, type, writeTo
 
Methods inherited from class org.basex.query.value.Value
accept, cache, checkUp, compile, count, exprSize, has, inline, isValue, iter, iterator, removable, serialize, value
 
Methods inherited from class org.basex.query.expr.Expr
addText, compEbv, copy, hasFreeVars, indexAccessible, indexEquivalent, inlineAll, isEmpty, isFunction, isVacuous, markTailCalls, optimize, uses, visitAll
 
Methods inherited from class org.basex.data.ExprInfo
addPlan, addPlan, info, planAttr, planElem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

public final Data data
Data reference.


pre

public int pre
Pre value.

Constructor Detail

DBNode

public DBNode(Data d)
Constructor, creating a document node from the specified data reference.

Parameters:
d - data reference

DBNode

public DBNode(Data d,
              int p)
Constructor, creating a node from the specified data reference.

Parameters:
d - data reference
p - pre value

DBNode

public DBNode(Data d,
              int p,
              int k)
Constructor, specifying full node information.

Parameters:
d - data reference
p - pre value
k - node kind

DBNode

public DBNode(IO input,
              Prop prop)
       throws java.io.IOException
Constructor, specifying an XML input reference.

Parameters:
input - input reference
prop - database properties
Throws:
java.io.IOException - I/O exception

DBNode

public DBNode(Parser parser)
       throws java.io.IOException
Constructor, specifying a parser reference.

Parameters:
parser - parser
Throws:
java.io.IOException - I/O exception
Method Detail

set

public final void set(int p,
                      int k)
Sets the node type.

Parameters:
p - pre value
k - node kind

data

public final Data data()
Description copied from class: Value
Returns the data reference (if) attached to this value. This method is overwritten by DBNode and DBNodeSeq.

Overrides:
data in class Value
Returns:
data reference

string

public final byte[] string()
Description copied from class: ANode
Returns the string value.

Specified by:
string in class ANode
Returns:
string value

itr

public final long itr(InputInfo ii)
               throws QueryException
Description copied from class: Item
Returns an integer (long) representation of the value.

Overrides:
itr in class Item
Parameters:
ii - input info
Returns:
long value
Throws:
QueryException - query exception

dbl

public final double dbl(InputInfo ii)
                 throws QueryException
Description copied from class: Item
Returns a double representation of the value.

Overrides:
dbl in class Item
Parameters:
ii - input info
Returns:
double value
Throws:
QueryException - query exception

name

public final byte[] name()
Description copied from class: ANode
Returns the name of the node, composed of an optional prefix and the local name. This function must only be called for element and attribute nodes. It is more efficient than calling ANode.qname(), as no QNm instance is created.

Overrides:
name in class ANode
Returns:
name

qname

public final QNm qname()
Description copied from class: ANode
Returns the QName of the node. This function must only be called for elements, attributes and pi's.

Overrides:
qname in class ANode
Returns:
name

qname

public final QNm qname(QNm name)
Description copied from class: ANode
Updates the specified with the information of the current node. This is more efficient than calling ANode.qname(), as an existing QNm instance is reused. This function must only be called for elements, attributes and pi's.

Specified by:
qname in class ANode
Parameters:
name - temporary qname
Returns:
name

namespaces

public final Atts namespaces()
Description copied from class: ANode
Returns all namespaces defined for the nodes. Overwritten by FElem and DBNode.

Overrides:
namespaces in class ANode
Returns:
namespace array

baseURI

public final byte[] baseURI()
Description copied from class: ANode
Returns the base URI of the node.

Overrides:
baseURI in class ANode
Returns:
base URI

is

public final boolean is(ANode node)
Description copied from class: ANode
Checks if two nodes are identical.

Specified by:
is in class ANode
Parameters:
node - node to be compared
Returns:
result of check

diff

public final int diff(ANode node)
Description copied from class: ANode
Checks the document order of two nodes.

Specified by:
diff in class ANode
Parameters:
node - node to be compared
Returns:
0 if the nodes are identical, or 1/-1 if the node appears after/before the argument

copy

public final DBNode copy()
Description copied from class: ANode
Creates a copy of this node.

Specified by:
copy in class ANode
Returns:
copy

copy

public final Value copy(QueryContext ctx,
                        VarScope scp,
                        IntObjMap<Var> vs)
Description copied from class: Expr
Copies an expression. Will be useful for inlining functions, or for copying static queries.

Overrides:
copy in class Value
Parameters:
ctx - query context
scp - variable scope for creating new variables
vs - mapping from old variable IDs to new variable copies
Returns:
copied expression

dbCopy

public final DBNode dbCopy(Prop prop)
Description copied from class: ANode
Returns a database node representation of the node.

Overrides:
dbCopy in class ANode
Parameters:
prop - properties
Returns:
database node

deepCopy

public final DBNode deepCopy()
Description copied from class: ANode
Returns a deep copy of the node.

Specified by:
deepCopy in class ANode
Returns:
node copy

finish

public final DBNode finish()
Description copied from class: ANode
Returns a final node representation. This method is called by the step expressions, before it is passed on as result.

Overrides:
finish in class ANode
Returns:
node

parent

public final ANode parent()
Description copied from class: ANode
Returns the parent node.

Specified by:
parent in class ANode
Returns:
parent node

parent

public final DBNode parent(ANode p)
Description copied from class: ANode
Sets the parent node.

Specified by:
parent in class ANode
Parameters:
p - parent node
Returns:
self reference

hasChildren

public final boolean hasChildren()
Description copied from class: ANode
Returns true if the node has children.

Specified by:
hasChildren in class ANode
Returns:
result of test

ancestor

public final AxisIter ancestor()
Description copied from class: ANode
Returns an ancestor axis iterator.

Specified by:
ancestor in class ANode
Returns:
iterator

ancestorOrSelf

public final AxisIter ancestorOrSelf()
Description copied from class: ANode
Returns an ancestor-or-self axis iterator.

Specified by:
ancestorOrSelf in class ANode
Returns:
iterator

attributes

public final AxisMoreIter attributes()
Description copied from class: ANode
Returns an attribute axis iterator.

Specified by:
attributes in class ANode
Returns:
iterator

children

public final AxisMoreIter children()
Description copied from class: ANode
Returns a child axis iterator.

Specified by:
children in class ANode
Returns:
iterator

descendant

public final AxisIter descendant()
Description copied from class: ANode
Returns a descendant axis iterator.

Specified by:
descendant in class ANode
Returns:
iterator

descendantOrSelf

public final AxisIter descendantOrSelf()
Description copied from class: ANode
Returns a descendant-or-self axis iterator.

Specified by:
descendantOrSelf in class ANode
Returns:
iterator

following

public final AxisIter following()
Description copied from class: ANode
Returns a following axis iterator.

Specified by:
following in class ANode
Returns:
iterator

followingSibling

public final AxisIter followingSibling()
Description copied from class: ANode
Returns a following-sibling axis iterator.

Specified by:
followingSibling in class ANode
Returns:
iterator

parentIter

public final AxisIter parentIter()
Description copied from class: ANode
Returns a parent axis iterator.

Specified by:
parentIter in class ANode
Returns:
iterator

sameAs

public final boolean sameAs(Expr cmp)
Description copied from class: Expr
Compares the current and specified expression for equality.

Overrides:
sameAs in class Expr
Parameters:
cmp - expression to be compared
Returns:
result of check

plan

public final void plan(FElem plan)
Description copied from class: ExprInfo
Creates an expression tree.

Overrides:
plan in class Item
Parameters:
plan - root element

xdmInfo

public final byte[] xdmInfo()
Description copied from class: Item
Returns data model info.

Overrides:
xdmInfo in class Item
Returns:
type string

typeId

public final Type.ID typeId()
Description copied from class: Item
Returns a type id.

Overrides:
typeId in class Item
Returns:
type string

toString

public java.lang.String toString()
Specified by:
toString in class ExprInfo