|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectorg.exist.xquery.value.AbstractSequence
org.exist.dom.AbstractNodeSet
public abstract class AbstractNodeSet
Abstract base class for all node set implementations. A node set is a special type of sequence,
which contains only nodes. Class NodeSet thus implements the Sequence
as well as the DOM NodeList interfaces.
Please note that a node set may or may not contain duplicate nodes. Some implementations
(e.g. ExtArrayNodeSet) remove duplicates when sorting the set.
| Field Summary |
|---|
| 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 |
| Method Summary | |
|---|---|
void |
add(Item item)
Add a sequence item to the node set. |
abstract 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. |
abstract void |
addAll(NodeSet other)
Add all nodes from the given node set. |
void |
addAll(Sequence other)
Add all items from the given sequence to the node set. |
void |
clearContext(int contextId)
For every item in the sequence, clear any context-dependant information that is stored during query processing. |
abstract boolean |
contains(NodeProxy proxy)
Check if this node set contains a node matching the document and node-id of the given NodeProxy object. |
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. |
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)
Create a new node set from this set containing only nodes in documents that are also contained in the argument set. |
abstract NodeProxy |
get(int pos)
Get the node at position pos within this node set. |
abstract 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)
The method getAncestors |
Iterator |
getCollectionIterator()
Return an iterator on all collections referenced by documents contained in this sequence.. |
NodeSet |
getContextNodes(int contextId)
Returns all context nodes associated with the nodes in this node set. |
DocumentSet |
getDocumentSet()
Returns the set of documents from which the node items in this sequence have been selected. |
int |
getIndexType()
If all nodes in this set have an index, returns the common supertype used to build the index, e.g. |
int |
getItemType()
Return the primary type to which all items in this sequence belong. |
abstract int |
getLength()
Return the number of nodes contained in this node set. |
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 doc)
Get a hint about how many nodes in this node set belong to the specified document. |
int |
getState()
|
boolean |
hasChanged(int previousState)
|
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 |
isPersistentSet()
|
abstract Node |
item(int pos)
|
abstract SequenceIterator |
iterate()
Returns an iterator over all items in the sequence. |
abstract NodeSetIterator |
iterator()
Return an iterator on the nodes in this list. |
void |
nodeMoved(NodeId oldNodeId,
StoredNode newNode)
Node sets may implement this method to be informed of storage address and node id changes after updates. |
NodeProxy |
parentWithChild(DocumentImpl doc,
NodeId nodeId,
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 descendants,
boolean includeSelf,
int contextId)
For a given set of potential ancestor nodes, return all ancestors having descendants in this node set. |
NodeSet |
selectFollowing(NodeSet fl)
|
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 ancestor nodes. |
NodeSet |
selectPreceding(NodeSet pl)
|
NodeSet |
selectPrecedingSiblings(NodeSet siblings,
int contextId)
Select all nodes from the passed node set, which are preceding or following siblings of the nodes in this set. |
void |
setIsCached(boolean cached)
Indicates that the sequence is the result of a previous operation and has not been recomputed. |
void |
setProcessInReverseOrder(boolean inReverseOrder)
|
NodeSet |
toNodeSet()
Always returns this. |
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. |
abstract SequenceIterator |
unorderedIterator()
Returns an iterator over all items in the sequence. |
| Methods inherited from class org.exist.xquery.value.AbstractSequence |
|---|
conversionPreference, convertTo, effectiveBooleanValue, getCardinality, getItemCount, getStringValue, hasMany, hasOne, isEmpty, itemAt, setSelfAsContext, toJavaObject |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.exist.dom.NodeSet |
|---|
get |
| Methods inherited from interface org.exist.xquery.value.Sequence |
|---|
conversionPreference, convertTo, effectiveBooleanValue, getCardinality, getItemCount, getStringValue, hasMany, hasOne, isEmpty, itemAt, setSelfAsContext, toJavaObject |
| Method Detail |
|---|
public abstract NodeSetIterator iterator()
iterator in interface NodeSet
public abstract SequenceIterator iterate()
throws XPathException
Sequence
iterate in interface Sequenceiterate in class AbstractSequenceXPathException - TODOpublic abstract SequenceIterator unorderedIterator()
Sequence
unorderedIterator in interface SequenceunorderedIterator in class AbstractSequencepublic int getItemType()
SequenceType.NODE for node sets, Type.ITEM
for other sequences with mixed items.
getItemType in interface SequencegetItemType in class AbstractSequencepublic abstract boolean contains(NodeProxy proxy)
contains in interface NodeSetproxy - public abstract void add(NodeProxy proxy)
add in interface NodeSetproxy -
public void add(NodeProxy proxy,
int sizeHint)
add in interface NodeSetproxy - sizeHint -
public void add(Item item)
throws XPathException
add in interface Sequenceadd in class AbstractSequenceXPathException
public void addAll(Sequence other)
throws XPathException
addAll in interface SequenceaddAll in class AbstractSequenceother -
XPathExceptionpublic abstract void addAll(NodeSet other)
addAll in interface NodeSetother - public abstract int getLength()
getLength in interface NodeListpublic void setIsCached(boolean cached)
Sequence
setIsCached in interface SequencesetIsCached in class AbstractSequencepublic boolean isCached()
Sequence
isCached in interface SequenceisCached in class AbstractSequencepublic void removeDuplicates()
Sequence
removeDuplicates in interface Sequencepublic abstract Node item(int pos)
item in interface NodeListpublic abstract NodeProxy get(int pos)
get in interface NodeSetpos - public abstract NodeProxy get(NodeProxy p)
get in interface NodeSetp - public DocumentSet getDocumentSet()
Sequence
getDocumentSet in interface NodeSetgetDocumentSet in interface SequencegetDocumentSet in class AbstractSequencepublic Iterator getCollectionIterator()
Sequence
getCollectionIterator in interface NodeSetgetCollectionIterator in interface SequencegetCollectionIterator in class AbstractSequence
public NodeSet selectParentChild(NodeSet al,
int mode)
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 NodeSetal - a node set containing potential parent nodesmode - selection mode
public NodeSet selectParentChild(NodeSet al,
int mode,
int contextId)
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 NodeSetal - 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 selectAncestorDescendant(NodeSet al,
int mode,
boolean includeSelf,
int contextId)
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 NodeSetal - 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 selectAncestors(NodeSet descendants,
boolean includeSelf,
int contextId)
selectAncestors in interface NodeSetdescendants - node set containing potential ancestorsincludeSelf - if true, check if the ancestor node itself is contained
in this node set (ancestor-or-self axis)contextId -
public NodeSet selectFollowing(NodeSet fl)
throws XPathException
selectFollowing in interface NodeSetXPathException
public NodeSet selectPreceding(NodeSet pl)
throws XPathException
selectPreceding in interface NodeSetXPathException
public NodeSet selectPrecedingSiblings(NodeSet siblings,
int contextId)
NodeSet.FOLLOWING, only nodes following
the context node are selected. NodeSet.PRECEDING selects
preceding nodes.
selectPrecedingSiblings in interface NodeSetsiblings - 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 NodeSetsiblings - 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 directSelectAttribute(QName qname,
int contextId)
NodeSet
directSelectAttribute in interface NodeSetqname - 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 NodeProxy parentWithChild(DocumentImpl doc,
NodeId nodeId,
boolean directParent,
boolean includeSelf)
NodeSet
parentWithChild in interface NodeSet
public NodeProxy parentWithChild(NodeProxy proxy,
boolean directParent,
boolean includeSelf,
int level)
parentWithChild in interface NodeSetpublic NodeSet getParents(int contextId)
getParents in interface NodeSetcontextId - an int value
NodeSet value
public NodeSet getAncestors(int contextId,
boolean includeSelf)
getAncestors
getAncestors in interface NodeSetcontextId - an int valueincludeSelf - a boolean value
NodeSet valuepublic int getSizeHint(DocumentImpl doc)
getSizeHint in interface NodeSetdoc - public NodeSet intersection(NodeSet other)
intersection in interface NodeSetother - public NodeSet deepIntersection(NodeSet other)
NodeSet
deepIntersection in interface NodeSetpublic NodeSet except(NodeSet other)
NodeSet
except in interface NodeSetpublic NodeSet filterDocuments(NodeSet otherSet)
NodeSet
filterDocuments in interface NodeSetpublic void setProcessInReverseOrder(boolean inReverseOrder)
setProcessInReverseOrder in interface NodeSetpublic boolean getProcessInReverseOrder()
getProcessInReverseOrder in interface NodeSetpublic NodeSet union(NodeSet other)
union in interface NodeSetother - public NodeSet getContextNodes(int contextId)
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 NodeSet toNodeSet()
throws XPathException
toNodeSet in interface SequenceXPathException - if the sequence contains items which are not nodes.Sequence.toNodeSet()public int getState()
getState in interface NodeSetpublic boolean hasChanged(int previousState)
hasChanged in interface NodeSetpublic int getIndexType()
Type.ITEM.
getIndexType in interface NodeSetGeneralComparison,
ValueComparisonpublic boolean hasTextIndex()
hasTextIndex in interface NodeSetpublic boolean hasMixedContent()
hasMixedContent in interface NodeSetpublic void clearContext(int contextId)
Sequence
clearContext in interface SequenceclearContext in class AbstractSequence
public void nodeMoved(NodeId oldNodeId,
StoredNode newNode)
Sequence
nodeMoved in interface SequencenodeMoved in class AbstractSequenceUpdateListenerpublic boolean isPersistentSet()
isPersistentSet in interface SequenceisPersistentSet in class AbstractSequencepublic String toString()
toString in class AbstractSequence
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||