org.exist.dom
Interface NodeSet

All Superinterfaces:
org.w3c.dom.NodeList, Sequence
All Known Implementing Classes:
AbstractNodeSet, AVLTreeNodeSet, EmptyNodeSet, ExtArrayNodeSet, NodeProxy, SortedNodeSet, VirtualNodeSet

public interface NodeSet
extends Sequence, org.w3c.dom.NodeList

Author:
wolf

Field Summary
static int ANCESTOR
           
static int DESCENDANT
           
static NodeSet EMPTY_SET
          Constant representing an empty node set.
static int FOLLOWING
           
static int PRECEDING
           
 
Fields inherited from interface org.exist.xquery.value.Sequence
EMPTY_SEQUENCE
 
Method Summary
 void add(NodeProxy proxy)
          Add a new proxy object to the node set.
 void add(NodeProxy proxy, int sizeHint)
          Add a proxy object to the node set.
 void addAll(NodeSet other)
          Add all nodes from the given node set.
 boolean contains(NodeProxy proxy)
          Check if this node set contains a node matching the document and node-id of the given NodeProxy object.
 boolean containsDoc(DocumentImpl doc)
          Check if this node set contains nodes belonging to the given document.
 NodeSet deepIntersection(NodeSet other)
          Return a new node set, containing all nodes in this node set that are contained or have descendants in the other node set.
 NodeSet directSelectAttribute(QName qname, int contextId)
          Optimized method to select attributes.
 NodeSet except(NodeSet other)
          Return a new node set containing all nodes from this node set except those nodes which are also contained in the argument node set.
 NodeProxy get(DocumentImpl doc, NodeId nodeId)
           
 NodeProxy get(int pos)
          Get the node at position pos within this node set.
 NodeProxy get(NodeProxy p)
          Get a node from this node set matching the document and node id of the given NodeProxy.
 NodeSet getAncestors(int contextId, boolean includeSelf)
           
 NodeSet getContextNodes(int contextId)
          Returns all context nodes associated with the nodes in this node set.
 DocumentSet getDocumentSet()
          Returns the set of documents from which the node items in this sequence have been selected.
 int getIndexType()
          If all nodes in this set have an index, returns the common supertype used to build the index, e.g.
 NodeSet getParents(int contextId)
          Return a new node set containing the parent nodes of all nodes in the current set.
 boolean getProcessInReverseOrder()
           
 int getSizeHint(DocumentImpl doc)
          Get a hint about how many nodes in this node set belong to the specified document.
 int getState()
           
 boolean hasChanged(int previousState)
           
 boolean hasMixedContent()
           
 boolean hasTextIndex()
           
 NodeSet intersection(NodeSet other)
          Return a new node set, which represents the intersection of the current node set with the given node set.
 NodeSetIterator iterator()
          Return an iterator on the nodes in this list.
 NodeProxy parentWithChild(DocumentImpl doc, NodeId nodeId, boolean directParent, boolean includeSelf)
          Check if the node identified by its node id has an ancestor contained in this node set and return the ancestor found.
 NodeProxy parentWithChild(NodeProxy proxy, boolean directParent, boolean includeSelf, int level)
          Check if the given node has an ancestor contained in this node set and return the ancestor found.
 NodeSet selectAncestorDescendant(NodeSet al, int mode, boolean includeSelf, int contextId)
          Check if any descendant nodes are found within this node set for a given set of potential ancestor nodes.
 NodeSet selectAncestors(NodeSet descendants, boolean includeSelf, int contextId)
          For a given set of potential ancestor nodes, return all ancestors having descendants in this node set.
 NodeSet selectFollowing(NodeSet following)
           
 NodeSet selectFollowingSiblings(NodeSet siblings, int contextId)
          Select all nodes from the passed node set, which are following siblings of the nodes in this set.
 NodeSet selectParentChild(NodeSet al, int mode)
          Check if any child nodes are found within this node set for a given set of potential parent nodes.
 NodeSet selectParentChild(NodeSet al, int mode, int contextId)
          Check if any child nodes are found within this node set for a given set of potential parent nodes.
 NodeSet selectPreceding(NodeSet preceding)
           
 NodeSet selectPrecedingSiblings(NodeSet siblings, int contextId)
          Select all nodes from the passed node set, which are preceding siblings of the nodes in this set.
 void setProcessInReverseOrder(boolean inReverseOrder)
           
 NodeSet union(NodeSet other)
          Return a new node set which represents the union of the current node set and the given node set.
 
Methods inherited from interface org.exist.xquery.value.Sequence
add, addAll, clearContext, conversionPreference, convertTo, effectiveBooleanValue, getCardinality, getItemType, getLength, getStringValue, hasMany, hasOne, isCached, isEmpty, isPersistentSet, itemAt, iterate, removeDuplicates, setIsCached, setSelfAsContext, toJavaObject, toNodeSet, unorderedIterator
 
Methods inherited from interface org.w3c.dom.NodeList
getLength, item
 

Field Detail

ANCESTOR

static final int ANCESTOR
See Also:
Constant Field Values

DESCENDANT

static final int DESCENDANT
See Also:
Constant Field Values

PRECEDING

static final int PRECEDING
See Also:
Constant Field Values

FOLLOWING

static final int FOLLOWING
See Also:
Constant Field Values

EMPTY_SET

static final NodeSet EMPTY_SET
Constant representing an empty node set.

Method Detail

iterator

NodeSetIterator iterator()
Return an iterator on the nodes in this list. The iterator returns nodes according to the internal ordering of nodes (i.e. level first), not in document- order.


contains

boolean contains(NodeProxy proxy)
Check if this node set contains a node matching the document and node-id of the given NodeProxy object.

Parameters:
proxy -

containsDoc

boolean containsDoc(DocumentImpl doc)
Check if this node set contains nodes belonging to the given document.

Parameters:
doc -

getDocumentSet

DocumentSet getDocumentSet()
Description copied from interface: Sequence
Returns the set of documents from which the node items in this sequence have been selected. This is for internal use only.

Specified by:
getDocumentSet in interface Sequence

add

void add(NodeProxy proxy)
Add a new proxy object to the node set. Please note: node set implementations may allow duplicates.

Parameters:
proxy -

add

void add(NodeProxy proxy,
         int sizeHint)
Add a proxy object to the node set. The sizeHint parameter gives a hint about the number of items to be expected for the current document.

Parameters:
proxy -
sizeHint -

addAll

void addAll(NodeSet other)
Add all nodes from the given node set.

Parameters:
other -

get

NodeProxy get(int pos)
Get the node at position pos within this node set.

Parameters:
pos -

get

NodeProxy get(NodeProxy p)
Get a node from this node set matching the document and node id of the given NodeProxy.

Parameters:
p -

get

NodeProxy get(DocumentImpl doc,
              NodeId nodeId)

selectParentChild

NodeSet selectParentChild(NodeSet al,
                          int mode)
Check if any child nodes are found within this node set for a given set of potential parent nodes. If mode is DESCENDANT, the returned node set will contain all child nodes found in this node set for each parent node. If mode is ANCESTOR, the returned set will contain those parent nodes, for which children have been found.

Parameters:
al - a node set containing potential parent nodes
mode - selection mode

selectParentChild

NodeSet selectParentChild(NodeSet al,
                          int mode,
                          int contextId)
Check if any child nodes are found within this node set for a given set of potential parent nodes. If mode is DESCENDANT, the returned node set will contain all child nodes found in this node set for each parent node. If mode is ANCESTOR, the returned set will contain those parent nodes, for which children have been found.

Parameters:
al - a node set containing potential parent nodes
mode - selection mode
contextId - used to track context nodes when evaluating predicate expressions. If contextId != Expression.NO_CONTEXT_ID, the current context will be added to each result of the of the selection.

selectAncestorDescendant

NodeSet selectAncestorDescendant(NodeSet al,
                                 int mode,
                                 boolean includeSelf,
                                 int contextId)
Check if any descendant nodes are found within this node set for a given set of potential ancestor nodes. If mode is DESCENDANT, the returned node set will contain all descendant nodes found in this node set for each ancestor. If mode is ANCESTOR, the returned set will contain those ancestor nodes, for which descendants have been found.

Parameters:
al - a node set containing potential parent nodes
mode - selection mode
includeSelf - if true, check if the ancestor node itself is contained in the set of descendant nodes (descendant-or-self axis)
contextId - used to track context nodes when evaluating predicate expressions. If contextId != Expression.NO_CONTEXT_ID, the current context will be added to each result of the of the selection.

selectAncestors

NodeSet selectAncestors(NodeSet descendants,
                        boolean includeSelf,
                        int contextId)
For a given set of potential ancestor nodes, return all ancestors having descendants in this node set.

Parameters:
al - node set containing potential ancestors
includeSelf - if true, check if the ancestor node itself is contained in this node set (ancestor-or-self axis)
contextId - used to track context nodes when evaluating predicate expressions. If contextId != Expression.NO_CONTEXT_ID, the current context will be added to each result of the of the selection.

selectPrecedingSiblings

NodeSet selectPrecedingSiblings(NodeSet siblings,
                                int contextId)
Select all nodes from the passed node set, which are preceding siblings of the nodes in this set.

Parameters:
siblings - a node set containing potential siblings
contextId - used to track context nodes when evaluating predicate expressions. If contextId != Expression.NO_CONTEXT_ID, the current context will be added to each result of the of the selection.

selectFollowingSiblings

NodeSet selectFollowingSiblings(NodeSet siblings,
                                int contextId)
Select all nodes from the passed node set, which are following siblings of the nodes in this set.

Parameters:
siblings - a node set containing potential siblings
contextId - used to track context nodes when evaluating predicate expressions. If contextId != Expression.NO_CONTEXT_ID, the current context will be added to each result of the of the selection.

selectPreceding

NodeSet selectPreceding(NodeSet preceding)
                        throws XPathException
Throws:
XPathException

selectFollowing

NodeSet selectFollowing(NodeSet following)
                        throws XPathException
Throws:
XPathException

parentWithChild

NodeProxy parentWithChild(DocumentImpl doc,
                          NodeId nodeId,
                          boolean directParent,
                          boolean includeSelf)
Check if the node identified by its node id has an ancestor contained in this node set and return the ancestor found. If directParent is true, only immediate ancestors (parents) are considered. Otherwise the method will call itself recursively for all the node's parents. If includeSelf is true, the method returns also true if the node itself is contained in the node set.


parentWithChild

NodeProxy parentWithChild(NodeProxy proxy,
                          boolean directParent,
                          boolean includeSelf,
                          int level)
Check if the given node has an ancestor contained in this node set and return the ancestor found. If directParent is true, only immediate ancestors (parents) are considered. Otherwise the method will call itself recursively for all the node's parents. If includeSelf is true, the method returns also true if the node itself is contained in the node set.


getParents

NodeSet getParents(int contextId)
Return a new node set containing the parent nodes of all nodes in the current set.


getAncestors

NodeSet getAncestors(int contextId,
                     boolean includeSelf)

directSelectAttribute

NodeSet directSelectAttribute(QName qname,
                              int contextId)
Optimized method to select attributes. Use this if the context has just one or two nodes. Attributes will be directly looked up in the persistent DOM store.

Parameters:
qname - the QName of the attribute
contextId - used to track context nodes when evaluating predicate expressions. If contextId != Expression.NO_CONTEXT_ID, the current context will be added to each result of the of the selection.

getIndexType

int getIndexType()
If all nodes in this set have an index, returns the common supertype used to build the index, e.g. xs:integer or xs:string. If the nodes have different index types or no node has been indexed, returns Type.ITEM.

See Also:
GeneralComparison, ValueComparison

hasTextIndex

boolean hasTextIndex()

hasMixedContent

boolean hasMixedContent()

getSizeHint

int getSizeHint(DocumentImpl doc)
Get a hint about how many nodes in this node set belong to the specified document. This is just used for allocating new node sets. The information does not need to be exact. -1 is returned if the size cannot be determined (the default).

Parameters:
doc -

intersection

NodeSet intersection(NodeSet other)
Return a new node set, which represents the intersection of the current node set with the given node set.

Parameters:
other -

deepIntersection

NodeSet deepIntersection(NodeSet other)
Return a new node set, containing all nodes in this node set that are contained or have descendants in the other node set.

Parameters:
other -

union

NodeSet union(NodeSet other)
Return a new node set which represents the union of the current node set and the given node set.

Parameters:
other -

except

NodeSet except(NodeSet other)
Return a new node set containing all nodes from this node set except those nodes which are also contained in the argument node set.

Parameters:
other -

setProcessInReverseOrder

void setProcessInReverseOrder(boolean inReverseOrder)

getProcessInReverseOrder

boolean getProcessInReverseOrder()

getContextNodes

NodeSet getContextNodes(int contextId)
Returns all context nodes associated with the nodes in this node set.

Parameters:
contextId - used to track context nodes when evaluating predicate expressions. If contextId != Expression.NO_CONTEXT_ID, the current context will be added to each result of the of the selection.

hasChanged

boolean hasChanged(int previousState)

getState

int getState()


Copyright (C) Wolfgang Meier. All rights reserved.