org.apache.xpath.axes
Class NodeSequence

java.lang.Object
  |
  +--org.apache.xpath.Expression
        |
        +--org.apache.xpath.objects.XObject
              |
              +--org.apache.xpath.axes.NodeSequence
Direct Known Subclasses:
XNodeSet

public class NodeSequence
extends XObject
implements DTMIterator, java.lang.Cloneable, PathComponent

This class is the dynamic wrapper for a Xalan DTMIterator instance, and provides random access capabilities.

See Also:
Serialized Form

Fields inherited from class org.apache.xpath.objects.XObject
CLASS_BOOLEAN, CLASS_NODESET, CLASS_NULL, CLASS_NUMBER, CLASS_RTREEFRAG, CLASS_STRING, CLASS_UNKNOWN, CLASS_UNRESOLVEDVARIABLE
 
Constructor Summary
NodeSequence()
          Create a new NodeSequence in an invalid (null) state.
NodeSequence(java.lang.Object nodeVector)
          Create a new NodeSequence from a (already cloned) iterator.
 
Method Summary
 void allowDetachToRelease(boolean allowRelease)
          Calling this with a value of false will cause the nodeset to be cached.
 java.lang.Object clone()
          Get a clone of this iterator, but don't reset the iteration in the process, so that it may be used from the current position.
 DTMIterator cloneWithReset()
          Note: Not a deep clone.
 void detach()
           
 void fixupVariables(java.util.Vector vars, int globalsSize)
           
 int getAnalysisBits()
           
 int getAxis()
           
 DTMIterator getContainedIter()
          Get the functional iterator that fetches nodes.
 int getCurrentNode()
           
 int getCurrentPos()
           
 DTM getDTM(int nodeHandle)
           
 DTMManager getDTMManager()
           
 boolean getExpandEntityReferences()
           
 int getLength()
           
 int getRoot()
           
 int getWhatToShow()
           
 boolean hasCache()
          If the iterator needs to cache nodes as they are fetched, then this method returns true.
 boolean isDocOrdered()
           
 boolean isFresh()
           
 boolean isMutable()
           
 int item(int index)
           
 int nextNode()
           
 int previousNode()
           
 void reset()
           
 void runTo(int index)
           
 void setCurrentPos(int i)
           
 void setItem(int node, int index)
           
 void setIter(DTMIterator iter)
          Set the functional iterator that fetches nodes.
 void setRoot(int nodeHandle, java.lang.Object environment)
           
 void setShouldCacheNodes(boolean b)
           
 
Methods inherited from class org.apache.xpath.objects.XObject
appendToFsb, bool, boolWithSideEffects, callVisitors, castToType, create, create, deepEquals, destruct, dispatchCharactersEvents, equals, execute, getFresh, getType, getTypeString, greaterThan, greaterThanOrEqual, iter, lessThan, lessThanOrEqual, mutableNodeset, nodelist, nodeset, notEquals, num, numWithSideEffects, object, rtf, rtf, rtree, rtree, str, toString, xstr
 
Methods inherited from class org.apache.xpath.Expression
asIterator, asIteratorRaw, asNode, assertion, bool, canTraverseOutsideSubtree, error, execute, execute, execute, executeCharsToContentHandler, exprAddChild, exprGetChild, exprGetNumChildren, exprGetParent, exprSetParent, getColumnNumber, getExpressionOwner, getLineNumber, getPublicId, getSystemId, isNodesetExpr, isStableNumber, num, warn, xstr
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NodeSequence

public NodeSequence(java.lang.Object nodeVector)
Create a new NodeSequence from a (already cloned) iterator.
Parameters:
nodeVector -  

NodeSequence

public NodeSequence()
Create a new NodeSequence in an invalid (null) state.
Method Detail

hasCache

public boolean hasCache()
If the iterator needs to cache nodes as they are fetched, then this method returns true.

setIter

public final void setIter(DTMIterator iter)
Set the functional iterator that fetches nodes.
Parameters:
iter - The iterator that is to be contained.

getContainedIter

public final DTMIterator getContainedIter()
Get the functional iterator that fetches nodes.
Returns:
The contained iterator.

getDTM

public DTM getDTM(int nodeHandle)
Specified by:
getDTM in interface DTMIterator
See Also:
DTMIterator.getDTM(int)

getDTMManager

public DTMManager getDTMManager()
Specified by:
getDTMManager in interface DTMIterator
See Also:
DTMIterator.getDTMManager()

getRoot

public int getRoot()
Specified by:
getRoot in interface DTMIterator
See Also:
DTMIterator.getRoot()

setRoot

public void setRoot(int nodeHandle,
                    java.lang.Object environment)
Specified by:
setRoot in interface DTMIterator
See Also:
DTMIterator.setRoot(int, Object)

reset

public void reset()
Specified by:
reset in interface DTMIterator
Overrides:
reset in class XObject
See Also:
DTMIterator.reset()

getWhatToShow

public int getWhatToShow()
Specified by:
getWhatToShow in interface DTMIterator
See Also:
DTMIterator.getWhatToShow()

getExpandEntityReferences

public boolean getExpandEntityReferences()
Specified by:
getExpandEntityReferences in interface DTMIterator
See Also:
DTMIterator.getExpandEntityReferences()

nextNode

public int nextNode()
Specified by:
nextNode in interface DTMIterator
See Also:
DTMIterator.nextNode()

previousNode

public int previousNode()
Specified by:
previousNode in interface DTMIterator
See Also:
DTMIterator.previousNode()

detach

public void detach()
Specified by:
detach in interface DTMIterator
Overrides:
detach in class XObject
See Also:
DTMIterator.detach()

allowDetachToRelease

public void allowDetachToRelease(boolean allowRelease)
Calling this with a value of false will cause the nodeset to be cached.
Specified by:
allowDetachToRelease in interface DTMIterator
Overrides:
allowDetachToRelease in class XObject
See Also:
DTMIterator.allowDetachToRelease(boolean)

getCurrentNode

public int getCurrentNode()
Specified by:
getCurrentNode in interface DTMIterator
See Also:
DTMIterator.getCurrentNode()

isFresh

public boolean isFresh()
Specified by:
isFresh in interface DTMIterator
See Also:
DTMIterator.isFresh()

setShouldCacheNodes

public void setShouldCacheNodes(boolean b)
Specified by:
setShouldCacheNodes in interface DTMIterator
See Also:
DTMIterator.setShouldCacheNodes(boolean)

isMutable

public boolean isMutable()
Specified by:
isMutable in interface DTMIterator
See Also:
DTMIterator.isMutable()

getCurrentPos

public int getCurrentPos()
Specified by:
getCurrentPos in interface DTMIterator
See Also:
DTMIterator.getCurrentPos()

runTo

public void runTo(int index)
Specified by:
runTo in interface DTMIterator
See Also:
DTMIterator.runTo(int)

setCurrentPos

public void setCurrentPos(int i)
Specified by:
setCurrentPos in interface DTMIterator
See Also:
DTMIterator.setCurrentPos(int)

item

public int item(int index)
Specified by:
item in interface DTMIterator
See Also:
DTMIterator.item(int)

setItem

public void setItem(int node,
                    int index)
Specified by:
setItem in interface DTMIterator
See Also:
DTMIterator.setItem(int, int)

getLength

public int getLength()
Specified by:
getLength in interface DTMIterator
See Also:
DTMIterator.getLength()

cloneWithReset

public DTMIterator cloneWithReset()
                           throws java.lang.CloneNotSupportedException
Note: Not a deep clone.
Specified by:
cloneWithReset in interface DTMIterator
See Also:
DTMIterator.cloneWithReset()

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Get a clone of this iterator, but don't reset the iteration in the process, so that it may be used from the current position. Note: Not a deep clone.
Specified by:
clone in interface DTMIterator
Returns:
A clone of this object.
Throws:
java.lang.CloneNotSupportedException -  

isDocOrdered

public boolean isDocOrdered()
Specified by:
isDocOrdered in interface DTMIterator
See Also:
DTMIterator.isDocOrdered()

getAxis

public int getAxis()
Specified by:
getAxis in interface DTMIterator
See Also:
DTMIterator.getAxis()

getAnalysisBits

public int getAnalysisBits()
Specified by:
getAnalysisBits in interface PathComponent
See Also:
PathComponent.getAnalysisBits()

fixupVariables

public void fixupVariables(java.util.Vector vars,
                           int globalsSize)
Overrides:
fixupVariables in class XObject
See Also:
Expression.fixupVariables(Vector, int)


Copyright 2006 Apache XML Project. All Rights Reserved.