org.exist.dom
Interface NodeSet

All Superinterfaces:
NodeList, Sequence
All Known Subinterfaces:
ExtNodeSet
All Known Implementing Classes:
AbstractNodeSet, AVLTreeNodeSet, EmptyNodeSet, ExtArrayNodeSet, NewArrayNodeSet, NodeProxy, SortedNodeSet, VirtualNodeSet

public interface NodeSet
extends Sequence, 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.
 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(DBBroker broker, NodeTest test, 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.
 NodeSet filterDocuments(NodeSet otherSet)
          Create a new node set from this set containing only nodes in documents that are also contained in the argument 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)
           
 Iterator getCollectionIterator()
          Return an iterator on all collections referenced by documents contained in this node set.
 NodeSet getContextNodes(int contextId)
          Returns all context nodes associated with the nodes in this node set.
 DocumentSet getDocumentSet()
          Returns a DocumentSet containing all documents referenced in this node set.
 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, boolean copyMatches)
          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, int contextId)
           
 NodeSet selectFollowing(NodeSet following, int position, int contextId)
           
 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, int contextId)
           
 NodeSet selectPreceding(NodeSet preceding, int position, int contextId)
           
 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, getItemCount, getItemType, getStringValue, hasMany, hasOne, isCacheable, isCached, isEmpty, isPersistentSet, itemAt, iterate, nodeMoved, removeDuplicates, setIsCached, setSelfAsContext, toJavaObject, toMemNodeSet, 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 -

getDocumentSet

DocumentSet getDocumentSet()
Returns a DocumentSet containing all documents referenced in this node set.

Specified by:
getDocumentSet in interface Sequence

getCollectionIterator

Iterator getCollectionIterator()
Return an iterator on all collections referenced by documents contained in this node set.

Specified by:
getCollectionIterator 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,
                                 boolean copyMatches)
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:
descendants - 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,
                        int contextId)
                        throws XPathException
Throws:
XPathException

selectPreceding

NodeSet selectPreceding(NodeSet preceding,
                        int position,
                        int contextId)
                        throws XPathException,
                               UnsupportedOperationException
Throws:
XPathException
UnsupportedOperationException

selectFollowing

NodeSet selectFollowing(NodeSet following,
                        int contextId)
                        throws XPathException
Throws:
XPathException

selectFollowing

NodeSet selectFollowing(NodeSet following,
                        int position,
                        int contextId)
                        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(DBBroker broker,
                              NodeTest test,
                              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:
test - a node test
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 -

filterDocuments

NodeSet filterDocuments(NodeSet otherSet)
Create a new node set from this set containing only nodes in documents that are also contained in the argument set.

Parameters:
otherSet -

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)
Specified by:
hasChanged in interface Sequence

getState

int getState()
Specified by:
getState in interface Sequence


Copyright (C) Wolfgang Meier. All rights reserved.