|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectorg.exist.dom.NodeProxy
public class 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_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(QName qname,
int contextId)
The method directSelectAttribute |
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 |
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)
|
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 |
|---|
public static final int DOCUMENT_NODE_GID
public static final int UNKNOWN_NODE_GID
public static final int DOCUMENT_ELEMENT_GID
public static final short UNKNOWN_NODE_TYPE
public static final int UNKNOWN_NODE_LEVEL
| Constructor Detail |
|---|
public NodeProxy(DocumentImpl doc,
NodeId nodeId)
NodeProxy instance.
doc - a DocumentImpl valuenodeId - a NodeId value
public NodeProxy(DocumentImpl doc,
NodeId nodeId,
long address)
NodeProxy instance.
doc - a DocumentImpl valuenodeId - a NodeId valueaddress - a long value
public NodeProxy(DocumentImpl doc,
NodeId nodeId,
short nodeType)
NodeProxy instance.
doc - a DocumentImpl valuenodeId - a NodeId valuenodeType - a short value
public NodeProxy(DocumentImpl doc,
NodeId nodeId,
short nodeType,
long address)
NodeProxy instance.
doc - a DocumentImpl valuenodeId - a NodeId valuenodeType - a short valueaddress - a long valuepublic NodeProxy(NodeProxy p)
NodeProxy instance.
p - a NodeProxy valuepublic NodeProxy(StoredNode n)
NodeProxy instance.
n - a StoredNode valuepublic NodeProxy(DocumentImpl doc)
doc - a DocumentImpl value| Method Detail |
|---|
public void setNodeId(NodeId id)
setNodeId
id - a NodeId valuepublic NodeId getNodeId()
getNodeId
NodeId valuepublic int getImplementationType()
NodeValueNodeValue.IN_MEMORY_NODE or NodeValue.PERSISTENT_NODE.
getImplementationType in interface NodeValuepublic int compareTo(NodeProxy other)
other - a NodeProxy value
int valuepublic int compareTo(Object other)
compareTo
compareTo in interface Comparableother - an Object value
int valuepublic boolean equals(Object other)
equals
equals in class Objectother - an Object value
boolean value
public boolean equals(NodeValue other)
throws XPathException
equals
equals in interface NodeValueother - a NodeValue value
boolean value
XPathException - if an error occurs
public boolean before(NodeValue other,
boolean isPreceding)
throws XPathException
before
before in interface NodeValueother - a NodeValue valueisPreceding - a boolean value
boolean value
XPathException - if an error occurs
public boolean after(NodeValue other,
boolean isFollowing)
throws XPathException
after
after in interface NodeValueother - a NodeValue valueisFollowing - a boolean value
boolean value
XPathException - if an error occurspublic Document getOwnerDocument()
getOwnerDocument
getOwnerDocument in interface NodeValueDocument valuepublic final DocumentImpl getDocument()
getDocument
DocumentImpl valuepublic boolean isDocument()
isDocument
boolean valuepublic Node getNode()
NodeValue
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)
copyContext
node - a NodeProxy valuepublic void deepCopyContext(NodeProxy node)
deepCopyContext
node - a NodeProxy value
public void deepCopyContext(NodeProxy node,
int addContextId)
deepCopyContext
node - a NodeProxy valueaddContextId - an int valuepublic void clearContext(int contextId)
clearContext
clearContext in interface SequencecontextId - an int valuepublic ContextItem getContext()
getContext
ContextItem valuepublic String debugContext()
debugContext
String valuepublic int getType()
ItemType.
getType in interface Itempublic boolean isPersistentSet()
isPersistentSet in interface Sequence
public void nodeMoved(NodeId oldNodeId,
StoredNode newNode)
nodeMoved
nodeMoved in interface ItemnodeMoved in interface SequenceoldNodeId - a NodeId valuenewNode - a StoredNode valueUpdateListenerpublic Sequence toSequence()
Item
toSequence in interface Itempublic String getNodeValue()
getNodeValue
String valuepublic String getNodeValueSeparated()
getNodeValueSeparated
String valuepublic String getStringValue()
Sequence
getStringValue in interface ItemgetStringValue in interface Sequence
public AtomicValue convertTo(int requiredType)
throws XPathException
SequenceType. An XPathException
is thrown if the conversion is impossible.
convertTo in interface ItemconvertTo 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,
ContentHandler handler)
throws SAXException
toSAX in interface ItemSAXException
public void copyTo(DBBroker broker,
DocumentBuilderReceiver receiver)
throws SAXException
copyTo in interface ItemSAXExceptionpublic int conversionPreference(Class javaClass)
Sequence
conversionPreference in interface ItemconversionPreference in interface Sequence
public Object toJavaObject(Class target)
throws XPathException
Sequence
toJavaObject in interface ItemtoJavaObject in interface SequenceXPathExceptionpublic 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 Sequence
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 NodeSet
public SequenceIterator iterate()
throws XPathException
Sequence
iterate in interface SequenceXPathException - TODOpublic SequenceIterator unorderedIterator()
Sequence
unorderedIterator in interface Sequencepublic boolean contains(NodeProxy proxy)
NodeSet
contains in interface NodeSetpublic void addAll(NodeSet other)
NodeSet
addAll in interface NodeSetpublic boolean isEmpty()
isEmpty
isEmpty in interface Sequenceboolean valuepublic boolean hasOne()
hasOne
hasOne in interface Sequenceboolean valuepublic boolean hasMany()
hasMany
hasMany in interface Sequenceboolean valuepublic void add(NodeProxy proxy)
NodeSet
add in interface NodeSet
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 SequenceXPathException
public void add(NodeProxy proxy,
int sizeHint)
NodeSet
add in interface NodeSet
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 SequenceXPathExceptionpublic int getLength()
getLength in interface NodeListpublic int getItemCount()
Sequence
getItemCount in interface Sequencepublic Node item(int pos)
item in interface NodeListpublic Item itemAt(int pos)
Sequence
itemAt in interface Sequencepublic NodeProxy get(int pos)
NodeSet
get in interface NodeSetpublic NodeProxy get(NodeProxy p)
get
(non-Javadoc)
get in interface NodeSetp - a NodeProxy value
NodeProxy valueNodeSet.get(org.exist.dom.NodeProxy)
public NodeProxy get(DocumentImpl document,
NodeId nodeId)
get
get in interface NodeSetdocument - a DocumentImpl valuenodeId - a NodeId value
NodeProxy value
public NodeProxy parentWithChild(NodeProxy proxy,
boolean directParent,
boolean includeSelf,
int level)
NodeSet
parentWithChild in interface NodeSet
public NodeProxy parentWithChild(DocumentImpl otherDoc,
NodeId otherId,