org.apache.xpath
Class VariableStack

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.Vector
                    |
                    +--java.util.Stack
                          |
                          +--org.apache.xpath.VariableStack

public class VariableStack
extends java.util.Stack

**For internal use only** Defines a class to keep track of a stack for template arguments and variables, since we can't simply bind the variables to templates and walk the preceding children and ancestors. The stack is delimited by context markers which bound call frames, and which you can't search past for a variable, and by element frames, which are Arg objects with the given ElemTemplateElement instead of a qname. You can search past element frames, and they accumulate until they are popped. Note: Someone recently made the suggestion that the globals should not be kept at the bottom of the stack, but should be implemented in a hash table.

See Also:
Serialized Form

Constructor Summary
VariableStack()
          **For internal use only** Constructor for a variable stack.
 
Method Summary
 int getCurrentStackFrameIndex()
          **For internal use only** Get the top of the stack frame from where a search for a variable or param should take place.
 XObject getParamVariable(QName qname)
          **For internal use only** Same as getVariable, except don't look in the global space.
 java.lang.Object getVariable(QName name)
          **For internal use only** Given a name, return a string representing the value.
 void markGlobalStackFrame()
          **For internal use only** Mark the top of the global stack frame.
 java.lang.Object pop()
          **For internal use only** Override the pop in order to track the m_currentStackFrameIndex correctly.
 void popCurrentContext()
          **For internal use only** Pop the current context from the current context stack.
 void popElemFrame()
          **For internal use only** Pop the current context from the current context stack.
 java.lang.Object push(java.lang.Object o)
          **For internal use only** Override the push in order to track the m_currentStackFrameIndex correctly.
 void pushContextMarker()
          **For internal use only**  
 void pushElemFrame()
          **For internal use only** Push an argument onto the stack.
 void pushVariable(QName qname, XObject val)
          **For internal use only** Push an argument onto the stack.
 void setCurrentStackFrameIndex(int currentStackFrameIndex)
          **For internal use only** Set the top of the stack frame from where a search for a variable or param should take place.
 void setStackSize(int sz)
          **For internal use only** Override the setSize in order to track the m_currentStackFrameIndex correctly.
 
Methods inherited from class java.util.Stack
empty, peek, search
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VariableStack

public VariableStack()
**For internal use only** Constructor for a variable stack.
Method Detail

markGlobalStackFrame

public void markGlobalStackFrame()
**For internal use only** Mark the top of the global stack frame.

setCurrentStackFrameIndex

public void setCurrentStackFrameIndex(int currentStackFrameIndex)
**For internal use only** Set the top of the stack frame from where a search for a variable or param should take place.

getCurrentStackFrameIndex

public int getCurrentStackFrameIndex()
**For internal use only** Get the top of the stack frame from where a search for a variable or param should take place.

pushContextMarker

public void pushContextMarker()

push

public java.lang.Object push(java.lang.Object o)
**For internal use only** Override the push in order to track the m_currentStackFrameIndex correctly.
Overrides:
push in class java.util.Stack

pop

public java.lang.Object pop()
**For internal use only** Override the pop in order to track the m_currentStackFrameIndex correctly.
Overrides:
pop in class java.util.Stack

setStackSize

public void setStackSize(int sz)
**For internal use only** Override the setSize in order to track the m_currentStackFrameIndex correctly.

popCurrentContext

public void popCurrentContext()
**For internal use only** Pop the current context from the current context stack.

pushVariable

public void pushVariable(QName qname,
                         XObject val)
**For internal use only** Push an argument onto the stack. Don't forget to call startContext before pushing a series of arguments for a given macro call.

getParamVariable

public XObject getParamVariable(QName qname)
                         throws SAXException
**For internal use only** Same as getVariable, except don't look in the global space.

getVariable

public java.lang.Object getVariable(QName name)
                             throws SAXException
**For internal use only** Given a name, return a string representing the value.

pushElemFrame

public void pushElemFrame()
**For internal use only** Push an argument onto the stack. Don't forget to call startContext before pushing a series of arguments for a given macro call.

popElemFrame

public void popElemFrame()
**For internal use only** Pop the current context from the current context stack.


Copyright © 2000 Apache XML Project. All Rights Reserved.