Пример #1
0
  /**
   * Filter multiples of n.
   *
   * @param n
   * @param numbers
   */
  private ATermList filterMultiples(int n, ATermList numbers) {
    int nr, len = numbers.getLength();

    for (int i = 0; i < len; i++) {
      ATermInt el = (ATermInt) numbers.elementAt(i);
      nr = el.getInt();
      if (nr % n == 0) {
        len--;
        numbers = numbers.removeElementAt(i);
      }
    }
    return numbers;
  }
Пример #2
0
  @Override
  // XXX(Leo_Roos;Nov 18, 2011) leads to many recursive calls, a possible
  // reason why there has to be such a big stack size in order to run
  // Tigerseye
  public Visitable visitList(ATermList arg) throws VisitFailure {
    // save annotations
    ATermList annotations = arg.getAnnotations();

    int childCount = arg.getChildCount();
    for (int i = 0; i < childCount; i++) {
      ATerm currentAterm = arg.elementAt(i);
      ATerm t = (ATerm) currentAterm.accept(this);

      if (t != currentAterm) {
        arg = arg.replace(t, i);
      }
    }

    // restore annotations
    arg = (ATermList) arg.setAnnotations(annotations);

    return arg;
  }