Exemplo n.º 1
0
        /**
         * Filter non-primes
         */
        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));
        }
Exemplo n.º 2
0
        public virtual void TestList()
        {
            factory = Tester.theFactory;
            ATermList list   = (ATermList)factory.parse("[1,2,3]");
            ATermList result = list.remove(factory.parse("2"));

            AssertTrue(result.Equals(factory.parse("[1,3]")));

            list   = (ATermList)factory.parse("[1,2,3]");
            result = list.replace(factory.parse("99"), 1);
            AssertTrue(result.Equals(factory.parse("[1,99,3]")));

            list   = factory.makeList();
            result = list.append(factory.parse("1"));
            AssertTrue(result.Equals(factory.parse("[1]")));

            list   = (ATermList)factory.parse("[]");
            result = factory.makeList();
            AssertTrue(result.Equals(list));

//			Console.Out.WriteLine("pass: testList");
        }