示例#1
0
 /**
  * Filter non-primes
  *
  * @param numbers
  */
 private ATermList filterNonPrimes(ATermList numbers) {
   ATermList primes = factory.makeList();
   numbers = numbers.getNext();
   while (!numbers.isEmpty()) {
     ATermInt prime = (ATermInt) numbers.getFirst();
     numbers = filterMultiples(prime.getInt(), numbers);
     primes = primes.append(prime);
   }
   return factory.makeList(factory.makeInt(1), primes);
 }
示例#2
0
 /**
  * Generate a list of consecutive numbers.
  *
  * @param max
  */
 private ATermList generateNumbers(int max) {
   ATermList numbers = factory.makeList();
   for (int i = max; i > 0; i--) numbers = factory.makeList(factory.makeInt(i), numbers);
   return numbers;
 }