|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.exist.dom.NodeProxy
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.
| Field Summary | |
static int |
DOCUMENT_ELEMENT_GID
|
static int |
DOCUMENT_NODE_GID
|
static int |
UNKNOWN_NODE_ADDRESS
|
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,
long gid)
|
|
NodeProxy(DocumentImpl doc,
long gid,
long address)
|
|
NodeProxy(DocumentImpl doc,
long gid,
short nodeType)
|
|
NodeProxy(DocumentImpl doc,
long gid,
short nodeType,
long address)
|
|
NodeProxy(NodeProxy p)
|
|
| 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)
Returns true if this node comes after another node in document order. |
protected boolean |
after(NodeValue other,
boolean includeDescendants)
|
AtomicValue |
atomize()
|
boolean |
before(NodeValue other)
Returns true if this node comes before another node in document order. |
protected boolean |
before(NodeValue other,
boolean includeAncestors)
|
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(DocumentImpl doc,
long nodeId)
|
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,
long nodeId)
Get a node from this node set matching the document and node id. |
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. |
long |
getGID()
|
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()
Return the number of nodes contained in this node set. |
Match |
getMatches()
|
org.w3c.dom.Node |
getNode()
|
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. |
void |
getRange(NodeSet result,
DocumentImpl document,
long lower,
long upper)
Create a sub-range of this node set containing the range of nodes greater than or including the lower node and smaller than or including the upper node. |
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 |
hasMatch(Match m)
|
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. |
boolean |
isCached()
Returns true if the sequence is the result of a previous operation and has been cached. |
boolean |
isDocument()
|
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 doc,
long gid,
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(DocumentImpl otherDoc,
long otherId,
boolean directParent,
boolean includeSelf,
int level)
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 |
setGID(long gid)
Adjust the proxy's GID in response to a change in the GID of the referenced node. |
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 |
setNodeType(short nodeType)
Sets the nodeType. |
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 |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int DOCUMENT_NODE_GID
public static final int UNKNOWN_NODE_GID
public static final int DOCUMENT_ELEMENT_GID
public static final int UNKNOWN_NODE_LEVEL
public static final short UNKNOWN_NODE_TYPE
public static final int UNKNOWN_NODE_ADDRESS
| Constructor Detail |
public NodeProxy(DocumentImpl doc,
long gid)
public NodeProxy(DocumentImpl doc,
long gid,
short nodeType)
public NodeProxy(DocumentImpl doc,
long gid,
long address)
public NodeProxy(DocumentImpl doc,
long gid,
short nodeType,
long address)
public NodeProxy(NodeProxy p)
public NodeProxy(DocumentImpl doc)
| Method Detail |
public int getImplementationType()
NodeValueNodeValue.IN_MEMORY_NODE or NodeValue.PERSISTENT_NODE.
getImplementationType in interface NodeValuepublic int compareTo(NodeProxy other)
public int compareTo(java.lang.Object other)
compareTo in interface java.lang.Comparablepublic boolean equals(java.lang.Object other)
public boolean equals(NodeValue other)
throws XPathException
NodeValue
equals in interface NodeValueother -
XPathException
public boolean before(NodeValue other)
throws XPathException
NodeValue
before in interface NodeValueother -
XPathException
protected boolean before(NodeValue other,
boolean includeAncestors)
throws XPathException
XPathException
public boolean after(NodeValue other)
throws XPathException
NodeValue
after in interface NodeValueother -
XPathException
protected boolean after(NodeValue other,
boolean includeDescendants)
throws XPathException
XPathExceptionpublic org.w3c.dom.Document getOwnerDocument()
getOwnerDocument in interface NodeValuepublic final DocumentImpl getDocument()
public boolean isDocument()
public long getGID()
public void setGID(long gid)
gid - the new GID of the node referenced by this proxypublic org.w3c.dom.Node getNode()
getNode in interface NodeValuepublic short getNodeType()
public void setNodeType(short nodeType)
nodeType - The nodeType to setpublic long getInternalAddress()
public void setInternalAddress(long internalAddress)
internalAddress - The internalAddress to setpublic void setIndexType(int type)
public int getIndexType()
NodeSetType.ITEM.
getIndexType in interface NodeSetGeneralComparison,
ValueComparisonpublic boolean hasTextIndex()
hasTextIndex in interface NodeSetpublic boolean hasMixedContent()
hasMixedContent in interface NodeSetpublic Match getMatches()
public void setMatches(Match match)
public boolean hasMatch(Match m)
public void addMatch(Match m)
public void addMatches(NodeProxy p)
public void addContextNode(int contextId,
NodeValue node)
Predicate will take the
context nodes returned by the filter expression and compare them to its context
node set.
addContextNode in interface NodeValuepublic void addContext(NodeProxy other)
other - public void copyContext(NodeProxy node)
public void deepCopyContext(NodeProxy node)
public void deepCopyContext(NodeProxy node,
int addContextId)
public void clearContext(int contextId)
Sequence
clearContext in interface Sequencepublic ContextItem getContext()
public java.lang.String debugContext()
public int getType()
ItemType.
getType in interface Itempublic boolean isPersistentSet()
isPersistentSet in interface Sequencepublic Sequence toSequence()
Item
toSequence in interface Itempublic java.lang.String getNodeValue()
public java.lang.String getNodeValueSeparated()
public java.lang.String getStringValue()
Sequence
getStringValue in interface Sequence
public AtomicValue convertTo(int requiredType)
throws XPathException
SequenceType. An XPathException
is thrown if the conversion is impossible.
convertTo in interface SequencerequiredType - one of the type constants defined in class Type
XPathException
public AtomicValue atomize()
throws XPathException
atomize in interface ItemXPathException
public void toSAX(DBBroker broker,
org.xml.sax.ContentHandler handler)
throws org.xml.sax.SAXException
toSAX in interface Itemorg.xml.sax.SAXException
public void copyTo(DBBroker broker,
DocumentBuilderReceiver receiver)
throws org.xml.sax.SAXException
copyTo in interface Itemorg.xml.sax.SAXExceptionpublic int conversionPreference(java.lang.Class javaClass)
Sequence
conversionPreference in interface SequencejavaClass -
public java.lang.Object toJavaObject(java.lang.Class target)
throws XPathException
Sequence
toJavaObject in interface Sequencetarget -
XPathExceptionpublic int getItemType()
SequenceType.NODE for node sets, Type.ITEM
for other sequences with mixed items.
getItemType in interface Sequencepublic int getCardinality()
SequenceCardinality.
getCardinality in interface SequenceCardinalitypublic boolean isCached()
Sequence
isCached in interface Sequencepublic void setIsCached(boolean cached)
Sequence
setIsCached in interface Sequencecached -
public NodeSet toNodeSet()
throws XPathException
Sequence
toNodeSet in interface SequenceXPathException - if the sequence contains items which are not nodes.
public boolean effectiveBooleanValue()
throws XPathException
Sequence
effectiveBooleanValue in interface SequenceXPathExceptionpublic void removeDuplicates()
Sequence
removeDuplicates in interface Sequencepublic void setSelfAsContext(int contextId)
setSelfAsContext in interface Sequencepublic NodeSetIterator iterator()
NodeSet
iterator in interface NodeSetpublic SequenceIterator iterate()
Sequence
iterate in interface Sequencepublic SequenceIterator unorderedIterator()
Sequence
unorderedIterator in interface Sequence
public boolean contains(DocumentImpl doc,
long nodeId)
public boolean contains(NodeProxy proxy)
NodeSet
contains in interface NodeSetproxy -
public void addAll(NodeSet other)
NodeSet
addAll in interface NodeSetother - public void add(NodeProxy proxy)
NodeSet
add in interface NodeSetproxy -
public void add(Item item)
throws XPathException
SequenceXPathException 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.
add in interface Sequenceitem -
XPathException
public void add(NodeProxy proxy,
int sizeHint)
NodeSet
add in interface NodeSetproxy - sizeHint -
public void addAll(Sequence other)
throws XPathException
SequenceXPathException may
be thrown if the type of the items in the other sequence is incompatible with
the primary type of this sequence.
addAll in interface Sequenceother -
XPathExceptionpublic int getLength()
NodeSet
getLength in interface NodeSetpublic org.w3c.dom.Node item(int pos)
item in interface org.w3c.dom.NodeListpublic Item itemAt(int pos)
Sequence
itemAt in interface Sequencepos -
public NodeProxy get(int pos)
NodeSet
get in interface NodeSetpos -
public NodeProxy get(NodeProxy p)
NodeSet
get in interface NodeSetp -
public NodeProxy get(DocumentImpl document,
long nodeId)
NodeSet
get in interface NodeSetdocument - nodeId -
public NodeProxy parentWithChild(NodeProxy proxy,
boolean directParent,
boolean includeSelf,
int level)
NodeSet
parentWithChild in interface NodeSet
public NodeProxy parentWithChild(DocumentImpl doc,
long gid,
boolean directParent,
boolean includeSelf)
NodeSet
parentWithChild in interface NodeSet
public NodeProxy parentWithChild(DocumentImpl otherDoc,
long otherId,
boolean directParent,
boolean includeSelf,
int level)
NodeSet
parentWithChild in interface NodeSetpublic NodeSet getContextNodes(int contextId)
NodeSet
getContextNodes in interface NodeSetcontextId - 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.
public void getRange(NodeSet result,
DocumentImpl document,
long lower,
long upper)
NodeSet
getRange in interface NodeSetdocument - lower - upper -
public int getState()
getState in interface NodeSetpublic boolean hasChanged(int previousState)
hasChanged in interface NodeSetpublic int getSizeHint(DocumentImpl document)
NodeSet
getSizeHint in interface NodeSetdocument -
public DocumentSet getDocumentSet()
Sequence
getDocumentSet in interface NodeSetpublic boolean containsDoc(DocumentImpl document)
NodeSet
containsDoc in interface NodeSetdocument -
public NodeSet intersection(NodeSet other)
NodeSet
intersection in interface NodeSetother -
public NodeSet deepIntersection(NodeSet other)
NodeSet
deepIntersection in interface NodeSetother -
public NodeSet union(NodeSet other)
NodeSet
union in interface NodeSetother -
public NodeSet except(NodeSet other)
NodeSet
except in interface NodeSetother -
public NodeSet getParents(int contextId)
NodeSet
getParents in interface NodeSet
public NodeSet getAncestors(int contextId,
boolean includeSelf)
getAncestors in interface NodeSet
public NodeSet selectParentChild(NodeSet al,
int mode)
NodeSetNodeSet.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.
selectParentChild in interface NodeSetal - a node set containing potential parent nodesmode - selection mode