lojix/logic/src/main/com/thesett/aima/logic/fol/Functor.java
public Iterator<Operator<Term>> getChildren(boolean reverse)
    {
        if ((traverser != null) && (traverser instanceof FunctorTraverser))
        {
            return ((FunctorTraverser) traverser).traverse(this, reverse);
        }
        else
        {
            if (arguments == null)
            {
                return new LinkedList<Operator<Term>>().iterator();
            }
            else if (!reverse)
            {
                return Arrays.asList((Operator<Term>[]) arguments).iterator();
            }
            else
            {
                List<Operator<Term>> argList = new LinkedList<Operator<Term>>();

                for (int i = arity - 1; i >= 0; i--)
                {
                    argList.add(arguments[i]);
                }

                return argList.iterator();
            }
        }
    }
public Iterator<Operator<Term>> getChildren(boolean reverse)
    {
        if ((traverser != null) && (traverser instanceof FunctorTraverser))
        {
            return ((FunctorTraverser) traverser).traverse(this, reverse);
        }
        else
        {
            if (arguments == null)
            {
                return new LinkedList<Operator<Term>>().iterator();
            }
            else if (!reverse)
            {
                return Arrays.asList((Operator<Term>[]) arguments).iterator();
            }
            else
            {
                List<Operator<Term>> argList = new LinkedList<Operator<Term>>();

                for (int i = arity - 1; i >= 0; i--)
                {
                    argList.add(arguments[i]);
                }

                return argList.iterator();
            }
        }
    }
Provides an iterator over the child terms, if there are any. Only functors are compound, and built across a list
of child arguments.

@param  reverse Set, if the children should be presented in reverse order.

@return The sub-terms of a compound term.