|
||||||||
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_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 |
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)
public NodeProxy(DocumentImpl doc, NodeId nodeId, long address)
public NodeProxy(DocumentImpl doc, NodeId nodeId, short nodeType)
public NodeProxy(DocumentImpl doc, NodeId nodeId, short nodeType, long address)
public NodeProxy(NodeProxy p)
public NodeProxy(StoredNode n)
public NodeProxy(DocumentImpl doc)
Method Detail |
public void setNodeId(NodeId id)
public NodeId getNodeId()
public int getImplementationType()
NodeValue
NodeValue.IN_MEMORY_NODE
or NodeValue.PERSISTENT_NODE
.
getImplementationType
in interface NodeValue
public int compareTo(NodeProxy other)
public int compareTo(java.lang.Object other)
compareTo
in interface java.lang.Comparable
public boolean equals(java.lang.Object other)
public boolean equals(NodeValue other) throws XPathException
NodeValue
equals
in interface NodeValue
other
-
XPathException
public boolean before(NodeValue other, boolean isPreceding) throws XPathException
NodeValue
before
in interface NodeValue
other
-
XPathException
public boolean after(NodeValue other, boolean isFollowing) throws XPathException
NodeValue
after
in interface NodeValue
other
-
XPathException
public org.w3c.dom.Document getOwnerDocument()
getOwnerDocument
in interface NodeValue
public final DocumentImpl getDocument()
public boolean isDocument()
public org.w3c.dom.Node getNode()
getNode
in interface NodeValue
public 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()
NodeSet
Type.ITEM
.
getIndexType
in interface NodeSet
GeneralComparison
,
ValueComparison
public boolean hasTextIndex()
hasTextIndex
in interface NodeSet
public boolean hasMixedContent()
hasMixedContent
in interface NodeSet
public 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 NodeValue
public 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 Sequence
public ContextItem getContext()
public java.lang.String debugContext()
public int getType()
Item
Type
.
getType
in interface Item
public boolean isPersistentSet()
isPersistentSet
in interface Sequence
public Sequence toSequence()
Item
toSequence
in interface Item
public 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
Sequence
Type
. An XPathException
is thrown if the conversion is impossible.
convertTo
in interface Sequence
requiredType
- one of the type constants defined in class Type
XPathException
public AtomicValue atomize() throws XPathException
atomize
in interface Item
XPathException
public void toSAX(DBBroker broker, org.xml.sax.ContentHandler handler) throws org.xml.sax.SAXException
toSAX
in interface Item
org.xml.sax.SAXException
public void copyTo(DBBroker broker, DocumentBuilderReceiver receiver) throws org.xml.sax.SAXException
copyTo
in interface Item
org.xml.sax.SAXException
public int conversionPreference(java.lang.Class javaClass)
Sequence
conversionPreference
in interface Sequence
javaClass
- public java.lang.Object toJavaObject(java.lang.Class target) throws XPathException
Sequence
toJavaObject
in interface Sequence
target
-
XPathException
public int getItemType()
Sequence
Type.NODE
for node sets, Type.ITEM
for other sequences with mixed items.
getItemType
in interface Sequence
public int getCardinality()
Sequence
Cardinality
.
getCardinality
in interface Sequence
Cardinality
public boolean isCached()
Sequence
isCached
in interface Sequence
public void setIsCached(boolean cached)
Sequence
setIsCached
in interface Sequence
cached
- public NodeSet toNodeSet() throws XPathException
Sequence
toNodeSet
in interface Sequence
XPathException
- if the sequence contains items which are not nodes.public boolean effectiveBooleanValue() throws XPathException
Sequence
effectiveBooleanValue
in interface Sequence
XPathException
public void removeDuplicates()
Sequence
removeDuplicates
in interface Sequence
public void setSelfAsContext(int contextId)
setSelfAsContext
in interface Sequence
public NodeSetIterator iterator()
NodeSet
iterator
in interface NodeSet
public SequenceIterator iterate() throws XPathException
Sequence
iterate
in interface Sequence
XPathException
- TODOpublic SequenceIterator unorderedIterator()
Sequence
unorderedIterator
in interface Sequence
public boolean contains(NodeProxy proxy)
NodeSet
contains
in interface NodeSet
proxy
- public void addAll(NodeSet other)
NodeSet
addAll
in interface NodeSet
other
- public boolean isEmpty()
Sequence
isEmpty
in interface Sequence
true
is the sequence is emptypublic boolean hasOne()
Sequence
hasOne
in interface Sequence
true
is the sequence has just one itempublic boolean hasMany()
Sequence
hasMany
in interface Sequence
true
is the sequence more than one itempublic void add(NodeProxy proxy)
NodeSet
add
in interface NodeSet
proxy
- public void add(Item item) throws XPathException
Sequence
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.
add
in interface Sequence
item
-
XPathException
public void add(NodeProxy proxy, int sizeHint)
NodeSet
add
in interface NodeSet
proxy
- sizeHint
- public void addAll(Sequence other) throws XPathException
Sequence
XPathException
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 Sequence
other
-
XPathException
public int getLength()
Sequence
getLength
in interface Sequence
public org.w3c.dom.Node item(int pos)
item
in interface org.w3c.dom.NodeList
public Item itemAt(int pos)
Sequence
itemAt
in interface Sequence
pos
- public NodeProxy get(int pos)
NodeSet
get
in interface NodeSet
pos
- public NodeProxy get(NodeProxy p)
NodeSet
get
in interface NodeSet
p
- public NodeProxy get(DocumentImpl document, NodeId nodeId)
get
in interface NodeSet
public NodeProxy parentWithChild(NodeProxy proxy, boolean directParent, boolean includeSelf, int level)
NodeSet
parentWithChild
in interface NodeSet
public NodeProxy parentWithChild(DocumentImpl otherDoc, NodeId otherId, boolean directParent, boolean includeSelf)
NodeSet
parentWithChild
in interface NodeSet
public NodeSet getContextNodes(int contextId)
NodeSet
getContextNodes
in interface NodeSet
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.public int getState()
getState
in interface NodeSet
public boolean hasChanged(int previousState)
hasChanged
in interface NodeSet
public int getSizeHint(DocumentImpl document)
NodeSet
getSizeHint
in interface NodeSet
document
- public DocumentSet getDocumentSet()
Sequence
getDocumentSet
in interface NodeSet
public boolean containsDoc(DocumentImpl document)
NodeSet
containsDoc
in interface NodeSet
document
- public NodeSet intersection(NodeSet other)
NodeSet
intersection
in interface NodeSet
other
- public NodeSet deepIntersection(NodeSet other)
NodeSet
deepIntersection
in interface NodeSet
other
- public NodeSet union(NodeSet other)
NodeSet
union
in interface NodeSet
other
- public NodeSet except(NodeSet other)
NodeSet
except
in interface NodeSet
other
- public void setProcessInReverseOrder(boolean inReverseOrder)
setProcessInReverseOrder
in interface NodeSet
public boolean getProcessInReverseOrder()
getProcessInReverseOrder
in interface NodeSet
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)
NodeSet
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.
selectParentChild
in interface NodeSet
al
- a node set containing potential parent nodesmode
- selection modepublic NodeSet selectParentChild(NodeSet al, int mode, int contextId)
NodeSet
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.
selectParentChild
in interface NodeSet
al
- a node set containing potential parent nodesmode
- selection modecontextId
- 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 NodeSet selectAncestors(NodeSet al, boolean includeSelf, int contextId)
NodeSet
selectAncestors
in interface NodeSet
al
- node set containing potential ancestorsincludeSelf
- 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.public NodeSet selectPrecedingSiblings(NodeSet siblings, int contextId)
NodeSet
selectPrecedingSiblings
in interface NodeSet
siblings
- a node set containing potential siblingscontextId
- 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 NodeSet selectFollowingSiblings(NodeSet siblings, int contextId)
NodeSet
selectFollowingSiblings
in interface NodeSet
siblings
- a node set containing potential siblingscontextId
- 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 NodeSet selectAncestorDescendant(NodeSet al, int mode, boolean includeSelf, int contextId)
NodeSet
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.
selectAncestorDescendant
in interface NodeSet
al
- a node set containing potential parent nodesmode
- selection modeincludeSelf
- 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.public NodeSet selectPreceding(NodeSet preceding) throws XPathException
selectPreceding
in interface NodeSet
XPathException
public NodeSet selectFollowing(NodeSet following) throws XPathException
selectFollowing
in interface NodeSet
XPathException
public NodeSet directSelectAttribute(QName qname, int contextId)
NodeSet
directSelectAttribute
in interface NodeSet
qname
- the QName of the attributecontextId
- 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 java.lang.String toString()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |