You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@locus.apache.org on 2000/11/06 21:55:47 UTC

cvs commit: xml-xalan/java/src/org/apache/xpath VariableStack.java

sboag       00/11/06 12:55:46

  Modified:    java/src/org/apache/xpath VariableStack.java
  Log:
  Add methods to save and set the search context of the stack.
  
  Revision  Changes    Path
  1.7       +46 -3     xml-xalan/java/src/org/apache/xpath/VariableStack.java
  
  Index: VariableStack.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/VariableStack.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- VariableStack.java	2000/10/30 18:58:24	1.6
  +++ VariableStack.java	2000/11/06 20:55:46	1.7
  @@ -106,6 +106,25 @@
   
     /** NEEDSDOC Field m_globalStackFrameIndex          */
     private int m_globalStackFrameIndex = -1;
  +  
  +  /** NEEDSDOC  */
  +  private int m_searchStart = -1;
  +  
  +  /**
  +   * NEEDSDOC
  +   */
  +  public void setSearchStart(int startPos)
  +  {
  +    m_searchStart = startPos;
  +  }
  +  
  +  /**
  +   * NEEDSDOC
  +   */
  +  public int getSearchStart()
  +  {
  +    return (-1 == m_searchStart) ? this.size() : m_searchStart;
  +  }
   
     /**
      * Hold the position of the start of the current element frame.
  @@ -122,7 +141,31 @@
   
     // Push a context marker onto the stack to let us know when
     // to stop searching for a var.
  -
  +  
  +  /**
  +   * NEEDSDOC Method pushContextPosition 
  +   */
  +  public void pushContextPosition(int pos)
  +  {
  +    m_contextPositions.push(pos);
  +  }
  +  
  +  /**
  +   * NEEDSDOC Method popContextPosition 
  +   */
  +  public void popContextPosition()
  +  {
  +    m_contextPositions.pop();
  +  }
  +  
  +  /**
  +   * NEEDSDOC Method pushContextMarker 
  +   */
  +  public int getContextPos()
  +  {
  +    return m_contextPositions.peek();
  +  }
  +  
     /**
      * NEEDSDOC Method pushContextMarker 
      *
  @@ -170,7 +213,7 @@
     {
   
       XObject val = null;
  -    int nElems = this.size();
  +    int nElems = (-1 == m_searchStart) ? this.size() : m_searchStart;
       int endContextPos = m_contextPositions.peek();
   
       for (int i = (nElems - 1); i >= endContextPos; i--)
  @@ -201,7 +244,7 @@
     public Object getVariable(QName name) throws SAXException
     {
   
  -    int nElems = this.size();
  +    int nElems = (-1 == m_searchStart) ? this.size() : m_searchStart;
       int endContextPos = m_contextPositions.peek();
   
       for (int i = (nElems - 1); i >= endContextPos; i--)