org.exist.dom
Class NodeProxy

java.lang.Object
  extended byorg.exist.dom.NodeProxy
All Implemented Interfaces:
java.lang.Comparable, Item, org.w3c.dom.NodeList, NodeSet, NodeValue, Sequence

public class NodeProxy
extends java.lang.Object
implements NodeSet, NodeValue, java.lang.Comparable

Placeholder class for DOM nodes. NodeProxy is an internal proxy class, acting as a placeholder for all types of persistent XML nodes during query processing. NodeProxy just stores the node's unique id and the document it belongs to. Query processing deals with these proxys most of the time. Using a NodeProxy is much cheaper than loading the actual node from the database. The real DOM node is only loaded, if further information is required for the evaluation of an XPath expression. To obtain the real node for a proxy, simply call getNode(). All sets of type NodeSet operate on NodeProxys. A node set is a special type of sequence, so NodeProxy does also implement Item and can thus be an item in a sequence. Since, according to XPath 2, a single node is also a sequence, NodeProxy does itself extend NodeSet. It thus represents a node set containing just one, single node.

Author:
Wolfgang Meier

Field Summary
static int DOCUMENT_ELEMENT_GID
           
static int DOCUMENT_NODE_GID
           
static int UNKNOWN_NODE_GID
           
static int UNKNOWN_NODE_LEVEL
           
static short UNKNOWN_NODE_TYPE
           
 
Fields inherited from interface org.exist.dom.NodeSet
ANCESTOR, DESCENDANT, EMPTY_SET, FOLLOWING, PRECEDING
 
Fields inherited from interface org.exist.xquery.value.Sequence
EMPTY_SEQUENCE
 
Fields inherited from interface org.exist.xquery.value.NodeValue
IN_MEMORY_NODE, PERSISTENT_NODE
 
Constructor Summary
NodeProxy(DocumentImpl doc)
          create a proxy to a document node
NodeProxy(DocumentImpl doc, NodeId nodeId)
           
NodeProxy(DocumentImpl doc, NodeId nodeId, long address)
           
NodeProxy(DocumentImpl doc, NodeId nodeId, short nodeType)
           
NodeProxy(DocumentImpl doc, NodeId nodeId, short nodeType, long address)
           
NodeProxy(NodeProxy p)
           
NodeProxy(StoredNode n)
           
 
Method Summary
 void add(Item item)
          Add an item to the current sequence.
 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.
 void addAll(Sequence other)
          Add all items of the other sequence to this item.
 void addContext(NodeProxy other)
          Add all context nodes from the other NodeProxy to the context of this NodeProxy.
 void addContextNode(int contextId, NodeValue node)
          Add a node to the list of context nodes for this node.
 void addMatch(Match m)
           
 void addMatches(NodeProxy p)
           
 boolean after(NodeValue other, boolean isFollowing)
          Returns true if this node comes after another node in document order.
 AtomicValue atomize()
           
 boolean before(NodeValue other, boolean isPreceding)
          Returns true if this node comes before another node in document order.
 void clearContext(int contextId)
          For every item in the sequence, clear any context-dependant information that is stored during query processing.
 int compareTo(NodeProxy other)
          Ordering first according to document ID; then if equal according to node gid.
 int compareTo(java.lang.Object other)
           
 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 document)
          Check if this node set contains nodes belonging to the given document.
 int conversionPreference(java.lang.Class javaClass)
          Returns a preference indicator, indicating the preference of a value to be converted into the given Java class.
 AtomicValue convertTo(int requiredType)
          Try to convert the sequence into an atomic value.
 void copyContext(NodeProxy node)
           
 void copyTo(DBBroker broker, DocumentBuilderReceiver receiver)
           
 java.lang.String debugContext()
           
 void deepCopyContext(NodeProxy node)
           
 void deepCopyContext(NodeProxy node, int addContextId)
           
 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.
 boolean effectiveBooleanValue()
          Get the effective boolean value of this sequence.
 boolean equals(NodeValue other)
          Returns true if this node has the same identity as another node.
 boolean equals(java.lang.Object other)
           
 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 document, 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)
           
 int getCardinality()
          Returns the cardinality of this sequence.
 ContextItem getContext()
           
 NodeSet getContextNodes(int contextId)
          Returns all context nodes associated with the nodes in this node set.
 DocumentImpl getDocument()
           
 DocumentSet getDocumentSet()
          Returns the set of documents from which the node items in this sequence have been selected.
 int getImplementationType()
          Returns the implementation-type of this node, i.e.
 int getIndexType()
          If all nodes in this set have an index, returns the common supertype used to build the index, e.g.
 long getInternalAddress()
          Returns the storage address of this node in dom.dbx.
 int getItemType()
          Return the primary type to which all items in this sequence belong.
 int getLength()
          Returns the number of items contained in the sequence.
 Match getMatches()
           
 org.w3c.dom.Node getNode()
           
 NodeId getNodeId()
           
 short getNodeType()
           
 java.lang.String getNodeValue()
           
 java.lang.String getNodeValueSeparated()
           
 org.w3c.dom.Document getOwnerDocument()
           
 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 document)
          Get a hint about how many nodes in this node set belong to the specified document.
 int getState()
           
 java.lang.String getStringValue()
          Convert the sequence to a string.
 int getType()
          Return the type of this item according to the type constants defined in class Type.
 boolean hasChanged(int previousState)
           
 boolean hasMany()
          Returns whether the sequence more than one item or not.
 boolean hasMatch(Match m)
           
 boolean hasMixedContent()
           
 boolean hasOne()
          Returns whether the sequence has just one item or not.
 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.
 boolean isCached()
          Returns true if the sequence is the result of a previous operation and has been cached.
 boolean isDocument()
           
 boolean isEmpty()
          Returns whether the sequence is empty or not.
 boolean isPersistentSet()
           
 org.w3c.dom.Node item(int pos)
           
 Item itemAt(int pos)
          Returns the item located at the specified position within this sequence.
 SequenceIterator iterate()
          Returns an iterator over all items in the sequence.
 NodeSetIterator iterator()
          Return an iterator on the nodes in this list.
 NodeProxy parentWithChild(DocumentImpl otherDoc, NodeId otherId, 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.
 void removeDuplicates()
          Explicitely remove all duplicate nodes from this sequence.
 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 al, 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 setIndexType(int type)
           
 void setInternalAddress(long internalAddress)
          Sets the storage address of this node in dom.dbx.
 void setIsCached(boolean cached)
          Indicates that the sequence is the result of a previous operation and has not been recomputed.
 void setMatches(Match match)
           
 void setNodeId(NodeId id)
           
 void setNodeType(short nodeType)
          Sets the nodeType.
 void setProcessInReverseOrder(boolean inReverseOrder)
           
 void setSelfAsContext(int contextId)
           
 java.lang.Object toJavaObject(java.lang.Class target)
          Convert the value into an instance of the specified Java class.
 NodeSet toNodeSet()
          Convert the sequence into a NodeSet.
 void toSAX(DBBroker broker, org.xml.sax.ContentHandler handler)
           
 Sequence toSequence()
          Convert this item into a sequence, containing only the item.
 java.lang.String toString()
           
 NodeSet union(NodeSet other)
          Return a new node set which represents the union of the current node set and the given node set.
 SequenceIterator unorderedIterator()
          Returns an iterator over all items in the sequence.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DOCUMENT_NODE_GID

public static final int DOCUMENT_NODE_GID
See Also:
Constant Field Values

UNKNOWN_NODE_GID

public static final int UNKNOWN_NODE_GID
See Also:
Constant Field Values

DOCUMENT_ELEMENT_GID

public static final int DOCUMENT_ELEMENT_GID
See Also:
Constant Field Values

UNKNOWN_NODE_TYPE

public static final short UNKNOWN_NODE_TYPE
See Also:
Constant Field Values

UNKNOWN_NODE_LEVEL

public static final int UNKNOWN_NODE_LEVEL
See Also:
Constant Field Values
Constructor Detail

NodeProxy

public NodeProxy(DocumentImpl doc,
                 NodeId nodeId)

NodeProxy

public NodeProxy(DocumentImpl doc,
                 NodeId nodeId,
                 long address)

NodeProxy

public NodeProxy(DocumentImpl doc,
                 NodeId nodeId,
                 short nodeType)

NodeProxy

public NodeProxy(DocumentImpl doc,
                 NodeId nodeId,
                 short nodeType,
                 long address)

NodeProxy

public NodeProxy(NodeProxy p)

NodeProxy

public NodeProxy(StoredNode n)

NodeProxy

public NodeProxy(DocumentImpl doc)
create a proxy to a document node

Method Detail

setNodeId

public void setNodeId(NodeId id)

getNodeId

public NodeId getNodeId()

getImplementationType

public int getImplementationType()
Description copied from interface: NodeValue
Returns the implementation-type of this node, i.e. either NodeValue.IN_MEMORY_NODE or NodeValue.PERSISTENT_NODE.

Specified by:
getImplementationType in interface NodeValue

compareTo

public int compareTo(NodeProxy other)
Ordering first according to document ID; then if equal according to node gid.


compareTo

public int compareTo(java.lang.Object other)
Specified by:
compareTo in interface java.lang.Comparable

equals

public boolean equals(java.lang.Object other)

equals

public boolean equals(NodeValue other)
               throws XPathException
Description copied from interface: NodeValue
Returns true if this node has the same identity as another node. Used to implement "is" and "isnot" comparisons.

Specified by:
equals in interface NodeValue
Parameters:
other -
Throws:
XPathException

before

public boolean before(NodeValue other,
                      boolean isPreceding)
               throws XPathException
Description copied from interface: NodeValue
Returns true if this node comes before another node in document order.

Specified by:
before in interface NodeValue
Parameters:
other -
Throws:
XPathException

after

public boolean after(NodeValue other,
                     boolean isFollowing)
              throws XPathException
Description copied from interface: NodeValue
Returns true if this node comes after another node in document order.

Specified by:
after in interface NodeValue
Parameters:
other -
Throws:
XPathException

getOwnerDocument

public org.w3c.dom.Document getOwnerDocument()
Specified by:
getOwnerDocument in interface NodeValue

getDocument

public final DocumentImpl getDocument()

isDocument

public boolean isDocument()

getNode

public org.w3c.dom.Node getNode()
Specified by:
getNode in interface NodeValue

getNodeType

public short getNodeType()

setNodeType

public void setNodeType(short nodeType)
Sets the nodeType.

Parameters:
nodeType - The nodeType to set

getInternalAddress

public long getInternalAddress()
Returns the storage address of this node in dom.dbx.

Returns:
long

setInternalAddress

public void setInternalAddress(long internalAddress)
Sets the storage address of this node in dom.dbx.

Parameters:
internalAddress - The internalAddress to set

setIndexType

public void setIndexType(int type)

getIndexType

public int getIndexType()
Description copied from interface: NodeSet
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.

Specified by:
getIndexType in interface NodeSet
See Also:
GeneralComparison, ValueComparison

hasTextIndex

public boolean hasTextIndex()
Specified by:
hasTextIndex in interface NodeSet

hasMixedContent

public boolean hasMixedContent()
Specified by:
hasMixedContent in interface NodeSet

getMatches

public Match getMatches()

setMatches

public void setMatches(Match match)

hasMatch

public boolean hasMatch(Match m)

addMatch

public void addMatch(Match m)

addMatches

public void addMatches(NodeProxy p)

addContextNode

public void addContextNode(int contextId,
                           NodeValue node)
Add a node to the list of context nodes for this node. NodeProxy internally stores the context nodes of the XPath context, for which this node has been selected during a previous processing step. Since eXist tries to process many expressions in one, single processing step, the context information is required to resolve predicate expressions. For example, for an expression like //SCENE[SPEECH/SPEAKER='HAMLET'], we have to remember the SCENE nodes for which the equality expression in the predicate was true. Thus, when evaluating the step SCENE[SPEECH], the SCENE nodes become context items of the SPEECH nodes and this context information is preserved through all following steps. To process the predicate expression, Predicate will take the context nodes returned by the filter expression and compare them to its context node set.

Specified by:
addContextNode in interface NodeValue

addContext

public void addContext(NodeProxy other)
Add all context nodes from the other NodeProxy to the context of this NodeProxy.

Parameters:
other -

copyContext

public void copyContext(NodeProxy node)

deepCopyContext

public void deepCopyContext(NodeProxy node)

deepCopyContext

public void deepCopyContext(NodeProxy node,
                            int addContextId)

clearContext

public void clearContext(int contextId)
Description copied from interface: Sequence
For every item in the sequence, clear any context-dependant information that is stored during query processing. This feature is used for node sets, which may store information about their context node.

Specified by:
clearContext in interface Sequence

getContext

public ContextItem getContext()

debugContext

public java.lang.String debugContext()

getType

public int getType()
Description copied from interface: Item
Return the type of this item according to the type constants defined in class Type.

Specified by:
getType in interface Item

isPersistentSet

public boolean isPersistentSet()
Specified by:
isPersistentSet in interface Sequence

toSequence

public Sequence toSequence()
Description copied from interface: Item
Convert this item into a sequence, containing only the item.

Specified by:
toSequence in interface Item

getNodeValue

public java.lang.String getNodeValue()

getNodeValueSeparated

public java.lang.String getNodeValueSeparated()

getStringValue

public java.lang.String getStringValue()
Description copied from interface: Sequence
Convert the sequence to a string.

Specified by:
getStringValue in interface Sequence

convertTo

public AtomicValue convertTo(int requiredType)
                      throws XPathException
Description copied from interface: Sequence
Try to convert the sequence into an atomic value. The target type should be specified by using one of the constants defined in class Type. An XPathException is thrown if the conversion is impossible.

Specified by:
convertTo in interface Sequence
Parameters:
requiredType - one of the type constants defined in class Type
Throws:
XPathException

atomize

public AtomicValue atomize()
                    throws XPathException
Specified by:
atomize in interface Item
Throws:
XPathException

toSAX

public void toSAX(DBBroker broker,
                  org.xml.sax.ContentHandler handler)
           throws org.xml.sax.SAXException
Specified by:
toSAX in interface Item
Throws:
org.xml.sax.SAXException

copyTo

public void copyTo(DBBroker broker,
                   DocumentBuilderReceiver receiver)
            throws org.xml.sax.SAXException
Specified by:
copyTo in interface Item
Throws:
org.xml.sax.SAXException

conversionPreference

public int conversionPreference(java.lang.Class javaClass)
Description copied from interface: Sequence
Returns a preference indicator, indicating the preference of a value to be converted into the given Java class. Low numbers mean that the value can be easily converted into the given class.

Specified by:
conversionPreference in interface Sequence
Parameters:
javaClass -

toJavaObject

public java.lang.Object toJavaObject(java.lang.Class target)
                              throws XPathException
Description copied from interface: Sequence
Convert the value into an instance of the specified Java class.

Specified by:
toJavaObject in interface Sequence
Parameters:
target -
Throws:
XPathException

getItemType

public int getItemType()
Description copied from interface: Sequence
Return the primary type to which all items in this sequence belong. This is Type.NODE for node sets, Type.ITEM for other sequences with mixed items.

Specified by:
getItemType in interface Sequence
Returns:
the primary type of the items in this sequence.

getCardinality

public int getCardinality()
Description copied from interface: Sequence
Returns the cardinality of this sequence. The returned value is a combination of flags as defined in Cardinality.

Specified by:
getCardinality in interface Sequence
See Also:
Cardinality

isCached

public boolean isCached()
Description copied from interface: Sequence
Returns true if the sequence is the result of a previous operation and has been cached.

Specified by:
isCached in interface Sequence

setIsCached

public void setIsCached(boolean cached)
Description copied from interface: Sequence
Indicates that the sequence is the result of a previous operation and has not been recomputed.

Specified by:
setIsCached in interface Sequence
Parameters:
cached -

toNodeSet

public NodeSet toNodeSet()
                  throws XPathException
Description copied from interface: Sequence
Convert the sequence into a NodeSet. If the sequence contains items which are not nodes, an XPathException is thrown.

Specified by:
toNodeSet in interface Sequence
Throws:
XPathException - if the sequence contains items which are not nodes.

effectiveBooleanValue

public boolean effectiveBooleanValue()
                              throws XPathException
Description copied from interface: Sequence
Get the effective boolean value of this sequence. Will be false if the sequence is empty, true otherwise.

Specified by:
effectiveBooleanValue in interface Sequence
Throws:
XPathException

removeDuplicates

public void removeDuplicates()
Description copied from interface: Sequence
Explicitely remove all duplicate nodes from this sequence.

Specified by:
removeDuplicates in interface Sequence

setSelfAsContext

public void setSelfAsContext(int contextId)
Specified by:
setSelfAsContext in interface Sequence

iterator

public NodeSetIterator iterator()
Description copied from interface: NodeSet
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.

Specified by:
iterator in interface NodeSet

iterate

public SequenceIterator iterate()
                         throws XPathException
Description copied from interface: Sequence
Returns an iterator over all items in the sequence. The items are returned in document order where applicable.

Specified by:
iterate in interface Sequence
Throws:
XPathException - TODO

unorderedIterator

public SequenceIterator unorderedIterator()
Description copied from interface: Sequence
Returns an iterator over all items in the sequence. The returned items may - but need not - to be in document order.

Specified by:
unorderedIterator in interface Sequence

contains

public boolean contains(NodeProxy proxy)
Description copied from interface: NodeSet
Check if this node set contains a node matching the document and node-id of the given NodeProxy object.

Specified by:
contains in interface NodeSet
Parameters:
proxy -

addAll

public void addAll(NodeSet other)
Description copied from interface: NodeSet
Add all nodes from the given node set.

Specified by:
addAll in interface NodeSet
Parameters:
other -

isEmpty

public boolean isEmpty()
Description copied from interface: Sequence
Returns whether the sequence is empty or not.

Specified by:
isEmpty in interface Sequence
Returns:
true is the sequence is empty

hasOne

public boolean hasOne()
Description copied from interface: Sequence
Returns whether the sequence has just one item or not.

Specified by:
hasOne in interface Sequence
Returns:
true is the sequence has just one item

hasMany

public boolean hasMany()
Description copied from interface: Sequence
Returns whether the sequence more than one item or not.

Specified by:
hasMany in interface Sequence
Returns:
true is the sequence more than one item

add

public void add(NodeProxy proxy)
Description copied from interface: NodeSet
Add a new proxy object to the node set. Please note: node set implementations may allow duplicates.

Specified by:
add in interface NodeSet
Parameters:
proxy -

add

public void add(Item item)
         throws XPathException
Description copied from interface: Sequence
Add an item to the current sequence. An XPathException may be thrown if the item's type is incompatible with this type of sequence (e.g. if the sequence is a node set). The sequence may or may not allow duplicate values.

Specified by:
add in interface Sequence
Parameters:
item -
Throws:
XPathException

add

public void add(NodeProxy proxy,
                int sizeHint)
Description copied from interface: NodeSet
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.

Specified by:
add in interface NodeSet
Parameters:
proxy -
sizeHint -

addAll

public void addAll(Sequence other)
            throws XPathException
Description copied from interface: Sequence
Add all items of the other sequence to this item. An XPathException may be thrown if the type of the items in the other sequence is incompatible with the primary type of this sequence.

Specified by:
addAll in interface Sequence
Parameters:
other -
Throws:
XPathException

getLength

public int getLength()
Description copied from interface: Sequence
Returns the number of items contained in the sequence. Call this method only when necessary, since it can be resource consuming.

Specified by:
getLength in interface Sequence
Returns:
The sequence's length

item

public org.w3c.dom.Node item(int pos)
Specified by:
item in interface org.w3c.dom.NodeList

itemAt

public Item itemAt(int pos)
Description copied from interface: Sequence
Returns the item located at the specified position within this sequence. Items are counted beginning at 0.

Specified by:
itemAt in interface Sequence
Parameters:
pos -

get

public NodeProxy get(int pos)
Description copied from interface: NodeSet
Get the node at position pos within this node set.

Specified by:
get in interface NodeSet
Parameters:
pos -

get

public NodeProxy get(NodeProxy p)
Description copied from interface: NodeSet
Get a node from this node set matching the document and node id of the given NodeProxy.

Specified by:
get in interface NodeSet
Parameters:
p -

get

public NodeProxy get(DocumentImpl document,
                     NodeId nodeId)
Specified by:
get in interface NodeSet

parentWithChild

public NodeProxy parentWithChild(NodeProxy proxy,
                                 boolean directParent,
                                 boolean includeSelf,
                                 int level)
Description copied from interface: NodeSet
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.

Specified by:
parentWithChild in interface NodeSet

parentWithChild

public NodeProxy parentWithChild(DocumentImpl otherDoc,
                                 NodeId otherId,
                                 boolean directParent,
                                 boolean includeSelf)
Description copied from interface: NodeSet
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.

Specified by:
parentWithChild in interface NodeSet

getContextNodes

public NodeSet getContextNodes(int contextId)
Description copied from interface: NodeSet
Returns all context nodes associated with the nodes in this node set.

Specified by:
getContextNodes in interface NodeSet
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.

getState

public int getState()
Specified by:
getState in interface NodeSet

hasChanged

public boolean hasChanged(int previousState)
Specified by:
hasChanged in interface NodeSet

getSizeHint

public int getSizeHint(DocumentImpl document)
Description copied from interface: NodeSet
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).

Specified by:
getSizeHint in interface NodeSet
Parameters:
document -

getDocumentSet

public 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 NodeSet

containsDoc

public boolean containsDoc(DocumentImpl document)
Description copied from interface: NodeSet
Check if this node set contains nodes belonging to the given document.

Specified by:
containsDoc in interface NodeSet
Parameters:
document -

intersection

public NodeSet intersection(NodeSet other)
Description copied from interface: NodeSet
Return a new node set, which represents the intersection of the current node set with the given node set.

Specified by:
intersection in interface NodeSet
Parameters:
other -

deepIntersection

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

Specified by:
deepIntersection in interface NodeSet
Parameters:
other -

union

public NodeSet union(NodeSet other)
Description copied from interface: NodeSet
Return a new node set which represents the union of the current node set and the given node set.

Specified by:
union in interface NodeSet
Parameters:
other -

except

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

Specified by:
except in interface NodeSet
Parameters:
other -

setProcessInReverseOrder

public void setProcessInReverseOrder(boolean inReverseOrder)
Specified by:
setProcessInReverseOrder in interface NodeSet

getProcessInReverseOrder

public boolean getProcessInReverseOrder()
Specified by:
getProcessInReverseOrder in interface NodeSet

getParents

public NodeSet getParents(int contextId)
Description copied from interface: NodeSet
Return a new node set containing the parent nodes of all nodes in the current set.

Specified by:
getParents in interface NodeSet

getAncestors

public NodeSet getAncestors(int contextId,
                            boolean includeSelf)
Specified by:
getAncestors in interface NodeSet

selectParentChild

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

Specified by:
selectParentChild in interface NodeSet
Parameters:
al - a node set containing potential parent nodes
mode - selection mode

selectParentChild

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

Specified by:
selectParentChild in interface NodeSet
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.

selectAncestors

public NodeSet selectAncestors(NodeSet al,
                               boolean includeSelf,
                               int contextId)
Description copied from interface: NodeSet
For a given set of potential ancestor nodes, return all ancestors having descendants in this node set.

Specified by:
selectAncestors in interface NodeSet
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

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

Specified by:
selectPrecedingSiblings in interface NodeSet
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

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

Specified by:
selectFollowingSiblings in interface NodeSet
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.

selectAncestorDescendant

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

Specified by:
selectAncestorDescendant in interface NodeSet
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.

selectPreceding

public NodeSet selectPreceding(NodeSet preceding)
                        throws XPathException
Specified by:
selectPreceding in interface NodeSet
Throws:
XPathException

selectFollowing

public NodeSet selectFollowing(NodeSet following)
                        throws XPathException
Specified by:
selectFollowing in interface NodeSet
Throws:
XPathException

directSelectAttribute

public NodeSet directSelectAttribute(QName qname,
                                     int contextId)
Description copied from interface: NodeSet
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.

Specified by:
directSelectAttribute in interface NodeSet
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.

toString

public java.lang.String toString()


Copyright (C) Wolfgang Meier. All rights reserved.