org.exist.dom
Class NodeProxy

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

public class NodeProxy
extends Object
implements NodeSet, NodeValue, 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.NodeValue
IN_MEMORY_NODE, PERSISTENT_NODE
 
Fields inherited from interface org.exist.xquery.value.Sequence
EMPTY_SEQUENCE
 
Constructor Summary
NodeProxy(DocumentImpl doc)
          create a proxy to a document node
NodeProxy(DocumentImpl doc, NodeId nodeId)
          Creates a new NodeProxy instance.
NodeProxy(DocumentImpl doc, NodeId nodeId, long address)
          Creates a new NodeProxy instance.
NodeProxy(DocumentImpl doc, NodeId nodeId, short nodeType)
          Creates a new NodeProxy instance.
NodeProxy(DocumentImpl doc, NodeId nodeId, short nodeType, long address)
          Creates a new NodeProxy instance.
NodeProxy(NodeProxy p)
          Creates a new NodeProxy instance.
NodeProxy(StoredNode n)
          Creates a new NodeProxy instance.
 
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)
          The method after
 AtomicValue atomize()
           
 boolean before(NodeValue other, boolean isPreceding)
          The method before
 void clearContext(int contextId)
          The method clearContext
 int compareTo(NodeProxy other)
          Ordering first according to document ID; then if equal according to node gid.
 int compareTo(Object other)
          The method compareTo
 boolean contains(NodeProxy proxy)
          Check if this node set contains a node matching the document and node-id of the given NodeProxy object.
 int conversionPreference(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)
          The method copyContext
 void copyTo(DBBroker broker, DocumentBuilderReceiver receiver)
           
 String debugContext()
          The method debugContext
 void deepCopyContext(NodeProxy node)
          The method deepCopyContext
 void deepCopyContext(NodeProxy node, int addContextId)
          The method deepCopyContext
 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)
          The method directSelectAttribute
 NodeSet directSelectChild(QName qname, int contextId)
           
 boolean effectiveBooleanValue()
          Get the effective boolean value of this sequence.
 boolean equals(NodeValue other)
          The method equals
 boolean equals(Object other)
          The method equals
 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)
          The method filterDocuments
 NodeProxy get(DocumentImpl document, NodeId nodeId)
          The method get
 NodeProxy get(int pos)
          Get the node at position pos within this node set.
 NodeProxy get(NodeProxy p)
          The method get (non-Javadoc)
 NodeSet getAncestors(int contextId, boolean includeSelf)
          The method getAncestors
 int getCardinality()
          Returns the cardinality of this sequence.
 Iterator getCollectionIterator()
          The method getCollectionIterator
 ContextItem getContext()
          The method getContext
 NodeSet getContextNodes(int contextId)
          Returns all context nodes associated with the nodes in this node set.
 DocumentImpl getDocument()
          The method getDocument
 DocumentSet getDocumentSet()
          Returns a DocumentSet containing all documents referenced in this node set.
 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 getItemCount()
          Returns the number of items contained in the sequence.
 int getItemType()
          Return the primary type to which all items in this sequence belong.
 int getLength()
           
 Match getMatches()
           
 Node getNode()
          Retrieve the actual node.
 NodeId getNodeId()
          The method getNodeId
 short getNodeType()
           
 String getNodeValue()
          The method getNodeValue
 String getNodeValueSeparated()
          The method getNodeValueSeparated
 Document getOwnerDocument()
          The method getOwnerDocument
 NodeSet getParents(int contextId)
          Return a new node set containing the parent nodes of all nodes in the current set.
 boolean getProcessInReverseOrder()
          The method getProcessInReverseOrder
 int getSizeHint(DocumentImpl document)
          Get a hint about how many nodes in this node set belong to the specified document.
 int getState()
           
 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()
          The method hasMany
 boolean hasMatch(Match m)
           
 boolean hasMixedContent()
           
 boolean hasOne()
          The method hasOne
 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 isCacheable()
           
 boolean isCached()
          Returns true if the sequence is the result of a previous operation and has been cached.
 boolean isDocument()
          The method isDocument
 boolean isEmpty()
          The method isEmpty
 boolean isPersistentSet()
           
 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.
 void nodeMoved(NodeId oldNodeId, StoredNode newNode)
          The method nodeMoved
 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)
          The method selectFollowing
 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)
          The method setNodeId
 void setNodeType(short nodeType)
          Sets the nodeType.
 void setProcessInReverseOrder(boolean inReverseOrder)
          The method setProcessInReverseOrder
 void setSelfAsContext(int contextId)
           
 Object toJavaObject(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, ContentHandler handler, Properties properties)
           
 Sequence toSequence()
          Convert this item into a sequence, containing only the item.
 String toString()
          The method 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)
Creates a new NodeProxy instance.

Parameters:
doc - a DocumentImpl value
nodeId - a NodeId value

NodeProxy

public NodeProxy(DocumentImpl doc,
                 NodeId nodeId,
                 long address)
Creates a new NodeProxy instance.

Parameters:
doc - a DocumentImpl value
nodeId - a NodeId value
address - a long value

NodeProxy

public NodeProxy(DocumentImpl doc,
                 NodeId nodeId,
                 short nodeType)
Creates a new NodeProxy instance.

Parameters:
doc - a DocumentImpl value
nodeId - a NodeId value
nodeType - a short value

NodeProxy

public NodeProxy(DocumentImpl doc,
                 NodeId nodeId,
                 short nodeType,
                 long address)
Creates a new NodeProxy instance.

Parameters:
doc - a DocumentImpl value
nodeId - a NodeId value
nodeType - a short value
address - a long value

NodeProxy

public NodeProxy(NodeProxy p)
Creates a new NodeProxy instance.

Parameters:
p - a NodeProxy value

NodeProxy

public NodeProxy(StoredNode n)
Creates a new NodeProxy instance.

Parameters:
n - a StoredNode value

NodeProxy

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

Parameters:
doc - a DocumentImpl value
Method Detail

setNodeId

public void setNodeId(NodeId id)
The method setNodeId

Parameters:
id - a NodeId value

getNodeId

public NodeId getNodeId()
The method getNodeId

Returns:
a NodeId value

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.

Parameters:
other - a NodeProxy value
Returns:
an int value

compareTo

public int compareTo(Object other)
The method compareTo

Specified by:
compareTo in interface Comparable
Parameters:
other - an Object value
Returns:
an int value

equals

public boolean equals(Object other)
The method equals

Overrides:
equals in class Object
Parameters:
other - an Object value
Returns:
a boolean value

equals

public boolean equals(NodeValue other)
               throws XPathException
The method equals

Specified by:
equals in interface NodeValue
Parameters:
other - a NodeValue value
Returns:
a boolean value
Throws:
XPathException - if an error occurs

before

public boolean before(NodeValue other,
                      boolean isPreceding)
               throws XPathException
The method before

Specified by:
before in interface NodeValue
Parameters:
other - a NodeValue value
isPreceding - a boolean value
Returns:
a boolean value
Throws:
XPathException - if an error occurs

after

public boolean after(NodeValue other,
                     boolean isFollowing)
              throws XPathException
The method after

Specified by:
after in interface NodeValue
Parameters:
other - a NodeValue value
isFollowing - a boolean value
Returns:
a boolean value
Throws:
XPathException - if an error occurs

getOwnerDocument

public Document getOwnerDocument()
The method getOwnerDocument

Specified by:
getOwnerDocument in interface NodeValue
Returns:
a Document value

getDocument

public final DocumentImpl getDocument()
The method getDocument

Returns:
a DocumentImpl value

isDocument

public boolean isDocument()
The method isDocument

Returns:
a boolean value

getNode

public Node getNode()
Description copied from interface: NodeValue
Retrieve the actual node. This operation is expensive.

Specified by:
getNode in interface NodeValue
Returns:
The actual node.

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)
The method copyContext

Parameters:
node - a NodeProxy value

deepCopyContext

public void deepCopyContext(NodeProxy node)
The method deepCopyContext

Parameters:
node - a NodeProxy value

deepCopyContext

public void deepCopyContext(NodeProxy node,
                            int addContextId)
The method deepCopyContext

Parameters:
node - a NodeProxy value
addContextId - an int value

clearContext

public void clearContext(int contextId)
The method clearContext

Specified by:
clearContext in interface Sequence
Parameters:
contextId - an int value

getContext

public ContextItem getContext()
The method getContext

Returns:
a ContextItem value

debugContext

public String debugContext()
The method debugContext

Returns:
a String value

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

nodeMoved

public void nodeMoved(NodeId oldNodeId,
                      StoredNode newNode)
The method nodeMoved

Specified by:
nodeMoved in interface Item
Specified by:
nodeMoved in interface Sequence
Parameters:
oldNodeId - a NodeId value
newNode - a StoredNode value
See Also:
UpdateListener

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 String getNodeValue()
The method getNodeValue

Returns:
a String value

getNodeValueSeparated

public String getNodeValueSeparated()
The method getNodeValueSeparated

Returns:
a String value

getStringValue

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

Specified by:
getStringValue in interface Item
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 Item
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,
                  ContentHandler handler,
                  Properties properties)
           throws SAXException
Specified by:
toSAX in interface Item
Throws:
SAXException

copyTo

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

conversionPreference

public int conversionPreference(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 Item
Specified by:
conversionPreference in interface Sequence

toJavaObject

public Object toJavaObject(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 Item
Specified by:
toJavaObject in interface Sequence
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

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

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

isEmpty

public boolean isEmpty()
The method isEmpty

Specified by:
isEmpty in interface Sequence
Returns:
a boolean value

hasOne

public boolean hasOne()
The method hasOne

Specified by:
hasOne in interface Sequence
Returns:
a boolean value

hasMany

public boolean hasMany()
The method hasMany

Specified by:
hasMany in interface Sequence
Returns:
a boolean value

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

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

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
Throws:
XPathException

getLength

public int getLength()
Specified by:
getLength in interface NodeList

getItemCount

public int getItemCount()
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:
getItemCount in interface Sequence
Returns:
The number of items in the sequence

item

public Node item(int pos)
Specified by:
item in interface 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

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

get

public NodeProxy get(NodeProxy p)
The method get (non-Javadoc)

Specified by:
get in interface NodeSet
Parameters:
p - a NodeProxy value
Returns:
a NodeProxy value
See Also:
NodeSet.get(org.exist.dom.NodeProxy)

get

public NodeProxy get(DocumentImpl document,
                     NodeId nodeId)
The method get

Specified by:
get in interface NodeSet
Parameters:
document - a DocumentImpl value
nodeId - a NodeId value
Returns:
a NodeProxy value

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

hasChanged

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

isCacheable

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

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

getDocumentSet

public DocumentSet getDocumentSet()
Description copied from interface: NodeSet
Returns a DocumentSet containing all documents referenced in this node set.

Specified by:
getDocumentSet in interface NodeSet
Specified by:
getDocumentSet in interface Sequence

getCollectionIterator

public Iterator getCollectionIterator()
The method getCollectionIterator

Specified by:
getCollectionIterator in interface NodeSet
Specified by:
getCollectionIterator in interface Sequence
Returns:
an Iterator value

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

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

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

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

filterDocuments

public NodeSet filterDocuments(NodeSet otherSet)
The method filterDocuments

Specified by:
filterDocuments in interface NodeSet
Parameters:
otherSet - a NodeSet value
Returns:
a NodeSet value

setProcessInReverseOrder

public void setProcessInReverseOrder(boolean inReverseOrder)
The method setProcessInReverseOrder

Specified by:
setProcessInReverseOrder in interface NodeSet
Parameters:
inReverseOrder - a boolean value

getProcessInReverseOrder

public boolean getProcessInReverseOrder()
The method getProcessInReverseOrder

Specified by:
getProcessInReverseOrder in interface NodeSet
Returns:
a boolean value

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)
The method getAncestors

Specified by:
getAncestors in interface NodeSet
Parameters:
contextId - an int value
includeSelf - a boolean value
Returns:
a NodeSet value

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
The method selectFollowing

Specified by:
selectFollowing in interface NodeSet
Parameters:
following - a NodeSet value
Returns:
a NodeSet value
Throws:
XPathException - if an error occurs

directSelectAttribute

public NodeSet directSelectAttribute(DBBroker broker,
                                     NodeTest test,
                                     int contextId)
The method directSelectAttribute

Specified by:
directSelectAttribute in interface NodeSet
Parameters:
test - a node test
contextId - an int value
Returns:
a NodeSet value

directSelectChild

public NodeSet directSelectChild(QName qname,
                                 int contextId)

toString

public String toString()
The method toString

Overrides:
toString in class Object
Returns:
a String value


Copyright (C) Wolfgang Meier. All rights reserved.