Exemple #1
0
  /**
   * Redirect the handles from oldList to newList. "This" flow list is assumed to be relative to
   * oldList.
   */
  public FlowList copyAndRedirect(InstructionList oldList, InstructionList newList) {
    final FlowList result = new FlowList();
    if (_elements == null) {
      return result;
    }

    final int n = _elements.size();
    final Iterator oldIter = oldList.iterator();
    final Iterator newIter = newList.iterator();

    while (oldIter.hasNext()) {
      final InstructionHandle oldIh = (InstructionHandle) oldIter.next();
      final InstructionHandle newIh = (InstructionHandle) newIter.next();

      for (int i = 0; i < n; i++) {
        if (_elements.elementAt(i) == oldIh) {
          result.add(newIh);
        }
      }
    }
    return result;
  }