Ejemplo n.º 1
0
  /**
   * Initialize the context values for this expression after it is cloned.
   *
   * @param context The XPath runtime context for this transformation.
   */
  public void setRoot(int context, Object environment) {
    super.setRoot(context, environment);

    try {
      if (null != m_exprs) {
        int n = m_exprs.length;
        DTMIterator newIters[] = new DTMIterator[n];

        for (int i = 0; i < n; i++) {
          DTMIterator iter = m_exprs[i].asIterator(m_execContext, context);
          newIters[i] = iter;
          iter.nextNode();
        }
        m_iterators = newIters;
      }
    } catch (Exception e) {
      throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(e);
    }
  }
Ejemplo n.º 2
0
  /**
   * Add an iterator to the union list.
   *
   * @param expr non-null reference to a location path iterator.
   */
  public void addIterator(DTMIterator expr) {

    // Increase array size by only 1 at a time.  Fix this
    // if it looks to be a problem.
    if (null == m_iterators) {
      m_iterators = new DTMIterator[1];
      m_iterators[0] = expr;
    } else {
      DTMIterator[] exprs = m_iterators;
      int len = m_iterators.length;

      m_iterators = new DTMIterator[len + 1];

      System.arraycopy(exprs, 0, m_iterators, 0, len);

      m_iterators[len] = expr;
    }
    expr.nextNode();
    if (expr instanceof Expression) ((Expression) expr).exprSetParent(this);
  }