/**
   * Pop the RTFDTM's context mark. This discards any RTFs added after the last mark was set.
   *
   * <p>If there is no RTF DTM, there's nothing to pop so this becomes a no-op. If pushes were
   * issued before this was called, we count on the fact that popRewindMark is defined such that
   * overpopping just resets to empty.
   *
   * <p>Complicating factor: We need to handle the case of popping back to a previous RTF DTM, if
   * one of the weird produce-an-RTF-to-build-an-RTF cases arose. Basically: If pop says this DTM is
   * now empty, then return to the previous if one exists, in whatever state we left it in. UGLY,
   * but hopefully the situation which forces us to consider this will arise exceedingly rarely.
   */
  public void popRTFContext() {
    int previous = m_last_pushed_rtfdtm.pop();
    if (null == m_rtfdtm_stack) return;

    if (m_which_rtfdtm == previous) {
      if (previous >= 0) // guard against none-active
      {
        boolean isEmpty = ((SAX2RTFDTM) (m_rtfdtm_stack.elementAt(previous))).popRewindMark();
      }
    } else
      while (m_which_rtfdtm != previous) {
        // Empty each DTM before popping, so it's ready for reuse
        // _DON'T_ pop the previous, since it's still open (which is why we
        // stacked up more of these) and did not receive a mark.
        boolean isEmpty = ((SAX2RTFDTM) (m_rtfdtm_stack.elementAt(m_which_rtfdtm))).popRewindMark();
        --m_which_rtfdtm;
      }
  }
 /** Pop the current node that is the expression's context (i.e. for current() support). */
 public final void popCurrentExpressionNode() {
   m_currentExpressionNodes.quickPop(1);
 }
 /**
  * Set the current node that is the expression's context (i.e. for current() support).
  *
  * @param n The sub-expression node to be current.
  */
 public final void pushCurrentExpressionNode(int n) {
   m_currentExpressionNodes.push(n);
 }
 /**
  * Get the current node that is the expression's context (i.e. for current() support).
  *
  * @return The current sub-expression node.
  */
 public final int getCurrentExpressionNode() {
   return m_currentExpressionNodes.peek();
 }
 public final void popPredicatePos() {
   m_predicatePos.pop();
 }
 public final void pushPredicatePos(int n) {
   m_predicatePos.push(n);
 }
 public final int getPredicatePos() {
   return m_predicatePos.peek();
 }
 /** Pop the current context node. */
 public final void popCurrentNode() {
   m_currentNodes.quickPop(1);
 }
 /**
  * Set the current context node.
  *
  * @param n the <a href="http://www.w3.org/TR/xslt#dt-current-node">current node</a>.
  */
 public final void pushCurrentNode(int n) {
   m_currentNodes.push(n);
 }
 /** Pop the current context node, expression node, and prefix resolver. */
 public final void popExpressionState() {
   m_currentNodes.quickPop(1);
   m_currentExpressionNodes.quickPop(1);
   m_prefixResolvers.pop();
 }
 /**
  * Push the current context node, expression node, and prefix resolver.
  *
  * @param cn the <a href="http://www.w3.org/TR/xslt#dt-current-node">current node</a>.
  * @param en the sub-expression context node.
  * @param nc the namespace context (prefix resolver.
  */
 public final void pushExpressionState(int cn, int en, PrefixResolver nc) {
   m_currentNodes.push(cn);
   m_currentExpressionNodes.push(cn);
   m_prefixResolvers.push(nc);
 }
 /**
  * Set the current context node and expression node.
  *
  * @param cn the <a href="http://www.w3.org/TR/xslt#dt-current-node">current node</a>.
  * @param en the sub-expression context node.
  */
 public final void pushCurrentNodeAndExpression(int cn, int en) {
   m_currentNodes.push(cn);
   m_currentExpressionNodes.push(cn);
 }
 /**
  * Get the current context node.
  *
  * @return the <a href="http://www.w3.org/TR/xslt#dt-current-node">current node</a>.
  */
 public final int getCurrentNode() {
   return m_currentNodes.peek();
 }
 /**
  * Push the RTFDTM's context mark, to allows discarding RTFs added after this point. (If it
  * doesn't exist we don't push, since we might still be able to get away with not creating it.
  * That requires that excessive pops be harmless.)
  */
 public void pushRTFContext() {
   m_last_pushed_rtfdtm.push(m_which_rtfdtm);
   if (null != m_rtfdtm_stack) ((SAX2RTFDTM) (getRTFDTM())).pushRewindMark();
 }