lojix/logic/src/main/com/thesett/aima/logic/fol/compiler/BasicTraverser.java
public Iterator<Operator<Term>> traverse(Predicate predicate, boolean reverse)
    {
        /*log.fine("Traversing predicate " + predicate.toString());*/

        Clause[] body = predicate.getBody();

        Queue<Operator<Term>> queue = (!reverse) ? new StackQueue<Operator<Term>>() : new LinkedList<Operator<Term>>();

        // For the predicate bodies.
        if (body != null)
        {
            for (int i = leftToRightPredicateBodies ? 0 : (body.length - 1);
                    leftToRightPredicateBodies ? (i < body.length) : (i >= 0);
                    i = i + (leftToRightPredicateBodies ? 1 : -1))
            {
                Clause bodyClause = body[i];

                bodyClause.setReversable(createClauseOperator(bodyClause, i, body, predicate));
                bodyClause.setTermTraverser(this);
                queue.offer(bodyClause);
            }
        }

        return queue.iterator();
    }
public Iterator<Operator<Term>> traverse(Predicate predicate, boolean reverse)
    {
        /*log.fine("Traversing predicate " + predicate.toString());*/

        Clause[] body = predicate.getBody();

        Queue<Operator<Term>> queue = (!reverse) ? new StackQueue<Operator<Term>>() : new LinkedList<Operator<Term>>();

        // For the predicate bodies.
        if (body != null)
        {
            for (int i = leftToRightPredicateBodies ? 0 : (body.length - 1);
                    leftToRightPredicateBodies ? (i < body.length) : (i >= 0);
                    i = i + (leftToRightPredicateBodies ? 1 : -1))
            {
                Clause bodyClause = body[i];

                bodyClause.setReversable(createClauseOperator(bodyClause, i, body, predicate));
                bodyClause.setTermTraverser(this);
                queue.offer(bodyClause);
            }
        }

        return queue.iterator();
    }
{@inheritDoc}