Exemple #1
0
        public virtual ATermList removeElementAt(int index)
        {
            if (0 > index || index > length)
            {
                throw new ArgumentException("illegal list index: " + index);
            }

            if (index == 0)
            {
                return(next);
            }

            return(next.removeElementAt(index - 1).insert(first));
        }
Exemple #2
0
		/**
		 * Filter multiples of n.
		 */
		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;
		}
Exemple #3
0
        /**
         * Filter multiples of n.
         */
        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);
        }