|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xpath.Expression | +--org.apache.xpath.axes.UnionPathIterator
**For advanced use only** This class extends NodeSetDTM, which implements DTMIterator, and fetches nodes one at a time in document order based on a XPath UnionExpr. As each node is iterated via nextNode(), the node is also stored in the NodeVector, so that previousNode() can easily be done.
Constructor Summary | |
UnionPathIterator()
Constructor to create an instance which you can add location paths to. |
|
UnionPathIterator(Compiler compiler,
int opPos)
Create a UnionPathIterator object, including creation of location path iterators from the opcode list, and call back into the Compiler to create predicate expressions. |
Method Summary | |
void |
addIterator(LocPathIterator iter)
Add an iterator to the union list. |
void |
allowDetachToRelease(boolean allowRelease)
Specify if it's OK for detach to release the iterator for reuse. |
DTMIterator |
asIterator(XPathContext xctxt,
int contextNode)
**Experimental** Given an select expression and a context, evaluate the XPath and return the resulting iterator. |
java.lang.Object |
clone()
Get a cloned LocPathIterator that holds the same position as this iterator. |
DTMIterator |
cloneWithReset()
Get a cloned Iterator that is reset to the beginning of the query. |
void |
detach()
Detaches the iterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state. |
XObject |
execute(XPathContext xctxt)
Execute this iterator, meaning create a clone that can store state, and initialize it for fast execution from the current runtime state. |
void |
fixupVariables(java.util.Vector vars,
int globalsSize)
This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time. |
int |
getAxis()
Returns the axis being iterated, if it is known. |
int |
getCurrentContextNode()
The node context from where the expression is being executed from (i.e. |
int |
getCurrentNode()
Return the last fetched node. |
int |
getCurrentPos()
Get the current position, which is one less than the next nextNode() call will retrieve. |
DTM |
getDTM(int nodeHandle)
Get an instance of a DTM that "owns" a node handle. |
DTMManager |
getDTMManager()
Get an instance of the DTMManager. |
boolean |
getExpandEntityReferences()
The value of this flag determines whether the children of entity reference nodes are visible to the iterator. |
DTMFilter |
getFilter()
The filter used to screen nodes. |
int |
getLast()
Get the index of the last node in the itteration. |
int |
getLastPos(XPathContext xctxt)
Get the index of the last node that can be itterated to. |
int |
getLength()
The number of nodes in the list. |
int |
getRoot()
The root node of the Iterator, as specified when it was created. |
int |
getWhatToShow()
This attribute determines which node types are presented via the iterator. |
boolean |
isDocOrdered()
Returns true if all the nodes in the iteration well be returned in document order. |
boolean |
isFresh()
Tells if this NodeSetDTM is "fresh", in other words, if the first nextNode() that is called will return the first node in the set. |
boolean |
isMutable()
Tells if this iterator can have nodes added to it or set via the setItem(int node, int index) method. |
int |
item(int index)
Returns the index th item in the collection. |
int |
nextNode()
Returns the next node in the set and advances the position of the iterator in the set. |
int |
previousNode()
Returns the previous node in the set and moves the position of the iterator backwards in the set. |
void |
reset()
Reset the iterator. |
void |
runTo(int index)
If an index is requested, NodeSetDTM will call this method to run the iterator to the index. |
void |
setCurrentPos(int i)
Set the current position in the node set. |
void |
setEnvironment(java.lang.Object environment)
Set the environment in which this iterator operates, which should provide: a node (the context node... |
void |
setItem(int node,
int index)
Sets the node at the specified index of this vector to be the specified node. |
void |
setLast(int last)
Set the index of the last node in the itteration. |
void |
setRoot(int n)
Set the current context node for this iterator. |
void |
setRoot(int context,
java.lang.Object environment)
Initialize the context values for this expression after it is cloned. |
void |
setShouldCacheNodes(boolean b)
If setShouldCacheNodes(true) is called, then nodes will be cached. |
int |
size()
Get the length of the list. |
Methods inherited from class org.apache.xpath.Expression |
asNode,
assertion,
bool,
canTraverseOutsideSubtree,
error,
execute,
execute,
executeCharsToContentHandler,
isNodesetExpr,
isStableNumber,
num,
setSourceLocator,
warn,
xstr |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public UnionPathIterator()
public UnionPathIterator(Compiler compiler, int opPos) throws javax.xml.transform.TransformerException
compiler
- The Compiler which is creating
this expression.opPos
- The position of this iterator in the
opcode list from the compiler.Method Detail |
public void setRoot(int context, java.lang.Object environment)
execContext
- The XPath runtime context for this
transformation.public void allowDetachToRelease(boolean allowRelease)
allowRelease
- true if it is OK for detach to release this iterator
for pooling.public void detach()
detach
has been invoked, calls to
nextNode
orpreviousNode
will raise the
exception INVALID_STATE_ERR.public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
xctxt
- The XPath execution context.public void setShouldCacheNodes(boolean b)
b
- True if this iterator should cache nodes.public boolean isMutable()
setItem(int node, int index)
method.public void setCurrentPos(int i)
i
- Must be a valid index.public int size()
public boolean isFresh()
public int previousNode()
Node
in the set being iterated over,
ornull
if there are no more members in that set.public int getWhatToShow()
DTMFilter
interface.public DTMFilter getFilter()
public int getRoot()
public boolean getExpandEntityReferences()
public void addIterator(LocPathIterator iter)
iter
- non-null reference to a location path iterator.public DTMIterator cloneWithReset() throws java.lang.CloneNotSupportedException
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
public DTMIterator asIterator(XPathContext xctxt, int contextNode) throws javax.xml.transform.TransformerException
xctxt
- The execution context.contextNode
- The node that "." expresses.namespaceContext
- The context in which namespaces in the
XPath are supposed to be expanded.public void reset()
public int nextNode()
Node
in the set being iterated over, or
null
if there are no more members in that set.public void runTo(int index)
index
- The index to run to, or -1 if the iterator
should run to the end.public int getCurrentPos()
public int getLength()
length-1
inclusive.public int getLastPos(XPathContext xctxt)
xctxt
- XPath runtime context.public int item(int index)
index
th item in the collection. If
index
is greater than or equal to the number of nodes in
the list, this returns null
.index
- Index into the collection.index
th position in the
NodeList
, or null
if that is not a valid
index.public void setItem(int node, int index)
The index must be a value greater than or equal to 0 and less than the current size of the vector. The iterator must be in cached mode.
Meant to be used for sorted iterators.
node
- Node to setindex
- Index of where to set the nodepublic final void setRoot(int n)
n
- Must be a non-null reference to the node context.public void setEnvironment(java.lang.Object environment)
At this time the exact implementation of this environment is application dependent. Probably a proper interface will be created fairly soon.
environment
- The environment object.public DTMManager getDTMManager()
public int getCurrentNode()
public void fixupVariables(java.util.Vector vars, int globalsSize)
vars
- List of QNames that correspond to variables. This list
should be searched backwards for the first qualified name that
corresponds to the variable reference qname. The position of the
QName in the vector from the start of the vector will be its position
in the stack frame (but variables above the globalsTop value will need
to be offset to the current stack frame).public DTM getDTM(int nodeHandle)
nodeHandle
- the nodeHandle.public int getCurrentContextNode()
public int getLast()
public void setLast(int last)
public boolean isDocOrdered()
public int getAxis()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |