|
||||||||||
| 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
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 | |
protected boolean |
hasMixedContent
|
protected boolean |
hasTextIndex
|
protected int |
indexType
|
protected static Logger |
LOG
|
| 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 |
| Constructor Summary | |
protected |
AbstractNodeSet()
|
| 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. |
boolean |
containsDoc(DocumentImpl doc)
Check if this node set contains nodes belonging to the given document. |
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. |
abstract NodeProxy |
get(DocumentImpl doc,
long nodeId)
Get a node from this node set matching the document and node id. |
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)
|
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. |
void |
getRange(NodeSet result,
DocumentImpl doc,
long lower,
long upper)
Return 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 doc)
Get a hint about how many nodes in this node set belong to the specified document. |
int |
getState()
|
boolean |
hasChanged(int previousState)
|
protected NodeSet |
hasChildrenInSet(NodeSet al,
int mode,
int contextId)
Get all children of the given parent node contained in this node set. |
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 org.w3c.dom.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. |
NodeProxy |
parentWithChild(DocumentImpl doc,
long gid,
boolean directParent)
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 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 doc,
long gid,
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 |
remove(NodeProxy node)
Remove a node. |
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 dl,
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. |
NodeSet |
toNodeSet()
Always returns this. |
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. |
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, getStringValue, itemAt, setSelfAsContext, toJavaObject |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.exist.xquery.value.Sequence |
conversionPreference, convertTo, effectiveBooleanValue, getCardinality, getStringValue, itemAt, setSelfAsContext, toJavaObject |
| Field Detail |
protected static final Logger LOG
protected int indexType
protected boolean hasTextIndex
protected boolean hasMixedContent
| Constructor Detail |
protected AbstractNodeSet()
| Method Detail |
public abstract NodeSetIterator iterator()
iterator in interface NodeSetpublic abstract SequenceIterator iterate()
Sequence
iterate in interface Sequenceiterate in class AbstractSequencepublic 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 boolean containsDoc(DocumentImpl doc)
containsDoc in interface NodeSetdoc -
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 void remove(NodeProxy node)
node - public abstract int getLength()
getLength in interface NodeSetgetLength in class AbstractSequencepublic 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 org.w3c.dom.Node item(int pos)
item in interface org.w3c.dom.NodeListpublic abstract NodeProxy get(int pos)
get in interface NodeSetpos -
public abstract NodeProxy get(NodeProxy p)
get in interface NodeSetp -
public abstract NodeProxy get(DocumentImpl doc,
long nodeId)
get in interface NodeSetdoc - nodeId -
public DocumentSet getDocumentSet()
Sequence
getDocumentSet in interface NodeSetgetDocumentSet in class AbstractSequence
protected NodeSet hasChildrenInSet(NodeSet al,
int mode,
int contextId)
NodeSet.DESCENDANT, the returned node set will contain
all children found in this node set. If mode is NodeSet.ANCESTOR,
the parent itself will be returned if it has child nodes in this set.
mode -
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 dl,
boolean includeSelf,
int contextId)
selectAncestors in interface NodeSetincludeSelf - if true, check if the ancestor node itself is contained
in this node set (ancestor-or-self axis)dl - node set containing potential ancestorscontextId - 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 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,
long gid,
boolean directParent)
public NodeProxy parentWithChild(DocumentImpl doc,
long gid,
boolean directParent,
boolean includeSelf)
parentWithChild in interface NodeSet
public NodeProxy parentWithChild(DocumentImpl doc,
long gid,
boolean directParent,
boolean includeSelf,
int level)
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 NodeSet
public NodeSet getAncestors(int contextId,
boolean includeSelf)
getAncestors in interface NodeSet
public void getRange(NodeSet result,
DocumentImpl doc,
long lower,
long upper)
getRange in interface NodeSetdoc - lower - upper -
public 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 NodeSetother -
public NodeSet except(NodeSet other)
NodeSet
except in interface NodeSetother -
public 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 AbstractSequencepublic boolean isPersistentSet()
isPersistentSet in interface SequenceisPersistentSet in class AbstractSequencepublic java.lang.String toString()
toString in class AbstractSequence
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||