Esempio n. 1
0
  /**
   * Clones the ElementIterator.
   *
   * @return a cloned ElementIterator Object.
   */
  public synchronized Object clone() {

    try {
      ElementIterator it = new ElementIterator(root);
      if (elementStack != null) {
        it.elementStack = new Stack();
        for (int i = 0; i < elementStack.size(); i++) {
          StackItem item = (StackItem) elementStack.elementAt(i);
          StackItem clonee = (StackItem) item.clone();
          it.elementStack.push(clonee);
        }
      }
      return it;
    } catch (CloneNotSupportedException e) {
      throw new InternalError();
    }
  }