|
|||||||
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(DBBroker broker,
NodeTest 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,
boolean copyMatches)
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,
int contextId)
|
NodeSet |
selectFollowing(NodeSet following,
int position,
int contextId)
|
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,
int contextId)
|
NodeSet |
selectPreceding(NodeSet preceding,
int nth,
int contextId)
|
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)
|
MemoryNodeSet |
toMemNodeSet()
Convert the sequence into an in-memory node set. |
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, isCacheable, 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, isCacheable, isEmpty, itemAt, setSelfAsContext, toJavaObject |
Method Detail |
---|
public abstract NodeSetIterator iterator()
iterator
in interface NodeSet
public abstract SequenceIterator iterate() throws XPathException
Sequence
iterate
in interface Sequence
iterate
in class AbstractSequence
XPathException
- TODOpublic abstract SequenceIterator unorderedIterator() throws XPathException
Sequence
unorderedIterator
in interface Sequence
unorderedIterator
in class AbstractSequence
XPathException
public int getItemType()
Sequence
Type.NODE
for node sets, Type.ITEM
for other sequences with mixed items.
getItemType
in interface Sequence
getItemType
in class AbstractSequence
public abstract boolean contains(NodeProxy proxy)
contains
in interface NodeSet
proxy
- public abstract void add(NodeProxy proxy)
add
in interface NodeSet
proxy
- public void add(NodeProxy proxy, int sizeHint)
add
in interface NodeSet
proxy
- sizeHint
- public void add(Item item) throws XPathException
add
in interface Sequence
add
in class AbstractSequence
XPathException
public void addAll(Sequence other) throws XPathException
addAll
in interface Sequence
addAll
in class AbstractSequence
other
-
XPathException
public abstract void addAll(NodeSet other)
addAll
in interface NodeSet
other
- public abstract int getLength()
getLength
in interface NodeList
public void setIsCached(boolean cached)
Sequence
setIsCached
in interface Sequence
setIsCached
in class AbstractSequence
public boolean isCached()
Sequence
isCached
in interface Sequence
isCached
in class AbstractSequence
public void removeDuplicates()
Sequence
removeDuplicates
in interface Sequence
public abstract Node item(int pos)
item
in interface NodeList
public abstract NodeProxy get(int pos)
get
in interface NodeSet
pos
- public abstract NodeProxy get(NodeProxy p)
get
in interface NodeSet
p
- public DocumentSet getDocumentSet()
Sequence
getDocumentSet
in interface NodeSet
getDocumentSet
in interface Sequence
getDocumentSet
in class AbstractSequence
public Iterator getCollectionIterator()
Sequence
getCollectionIterator
in interface NodeSet
getCollectionIterator
in interface Sequence
getCollectionIterator
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 NodeSet
al
- a node set containing potential parent nodesmode
- selection modepublic 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 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 selectAncestorDescendant(NodeSet al, int mode, boolean includeSelf, int contextId, boolean copyMatches)
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 selection.public NodeSet selectAncestors(NodeSet descendants, boolean includeSelf, int contextId)
selectAncestors
in interface NodeSet
descendants
- 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, int contextId) throws XPathException
selectFollowing
in interface NodeSet
XPathException
public NodeSet selectFollowing(NodeSet following, int position, int contextId) throws XPathException
selectFollowing
in interface NodeSet
XPathException
public NodeSet selectPreceding(NodeSet pl, int contextId) throws XPathException
selectPreceding
in interface NodeSet
XPathException
public NodeSet selectPreceding(NodeSet preceding, int nth, int contextId) throws XPathException, UnsupportedOperationException
selectPreceding
in interface NodeSet
XPathException
UnsupportedOperationException
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 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 directSelectAttribute(DBBroker broker, NodeTest qname, int contextId)
NodeSet
directSelectAttribute
in interface NodeSet
qname
- a node testcontextId
- 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 NodeSet
public NodeSet getParents(int contextId)
getParents
in interface NodeSet
contextId
- an int
value
NodeSet
valuepublic NodeSet getAncestors(int contextId, boolean includeSelf)
getAncestors
getAncestors
in interface NodeSet
contextId
- an int
valueincludeSelf
- a boolean
value
NodeSet
valuepublic int getSizeHint(DocumentImpl doc)
getSizeHint
in interface NodeSet
doc
- public NodeSet intersection(NodeSet other)
intersection
in interface NodeSet
other
- public NodeSet deepIntersection(NodeSet other)
NodeSet
deepIntersection
in interface NodeSet
public NodeSet except(NodeSet other)
NodeSet
except
in interface NodeSet
public NodeSet filterDocuments(NodeSet otherSet)
NodeSet
filterDocuments
in interface NodeSet
public void setProcessInReverseOrder(boolean inReverseOrder)
setProcessInReverseOrder
in interface NodeSet
public boolean getProcessInReverseOrder()
getProcessInReverseOrder
in interface NodeSet
public NodeSet union(NodeSet other)
union
in interface NodeSet
other
- public NodeSet getContextNodes(int contextId)
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 NodeSet toNodeSet() throws XPathException
toNodeSet
in interface Sequence
XPathException
- if the sequence contains items which are not nodes.Sequence.toNodeSet()
public MemoryNodeSet toMemNodeSet() throws XPathException
Sequence
Sequence.isPersistentSet()
to check
if the sequence is a persistent node set.
toMemNodeSet
in interface Sequence
XPathException
- if the sequence contains items which are not nodes or is
a persistent node setpublic int getState()
getState
in interface NodeSet
getState
in interface Sequence
getState
in class AbstractSequence
public boolean hasChanged(int previousState)
hasChanged
in interface NodeSet
hasChanged
in interface Sequence
hasChanged
in class AbstractSequence
public int getIndexType()
Type.ITEM
.
getIndexType
in interface NodeSet
GeneralComparison
,
ValueComparison
public boolean hasTextIndex()
hasTextIndex
in interface NodeSet
public boolean hasMixedContent()
hasMixedContent
in interface NodeSet
public void clearContext(int contextId) throws XPathException
Sequence
clearContext
in interface Sequence
clearContext
in class AbstractSequence
XPathException
public void nodeMoved(NodeId oldNodeId, StoredNode newNode)
Sequence
nodeMoved
in interface Sequence
nodeMoved
in class AbstractSequence
UpdateListener
public boolean isPersistentSet()
isPersistentSet
in interface Sequence
isPersistentSet
in class AbstractSequence
public String toString()
toString
in class AbstractSequence
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |