public void walk ( Term term ) { // Set up the traverser on the term to walk over. term . setTermTraverser ( traverser ) ; // Create a fresh search starting from the term. search . reset ( ) ; if ( goalPredicate != null ) { search . setGoalPredicate ( goalPredicate ) ; } search . addStartState ( term ) ; Iterator < Term > treeWalker = Searches . allSolutions ( search ) ; // If the traverser is a term visitor, allow it to visit the top-level term in the walk to establish // an initial context. if ( traverser instanceof TermVisitor ) { term . accept ( ( TermVisitor ) traverser ) ; } // Visit every goal node discovered in the walk over the term. while ( treeWalker . hasNext ( ) ) { Term nextTerm = treeWalker . next ( ) ; nextTerm . accept ( visitor ) ; } // Remote the traverser on the term to walk over. term . setTermTraverser ( null ) ; }
Walks over the supplied term .