Stay organized with collections
Save and categorize content based on your preferences.
public class QueryTreeWalker<T>
The walking of the query tree. This class takes care of visiting
a tree resulting from parsing a query. As it traverses the tree
it calls appropriate methods of the visitor, set at the construction
time. The class uses a depth-first search, visiting all children
of a node, before visiting the node. The visit is done by calling
an appropriate method of the visitor. Typical code should match
the following pattern:
class MyVisitor implements QueryTreeVisitor {
...
}
class MyContext extends QueryTreeContext<MyContext> {
...
@Override
protected MyContext newChildContext() {
return new MyContext();
}
}
MyContext context = new MyContext();
QueryTreeWalker<MyContext> walker = new QueryTreeWalker<MyContext>(new MyVisitor());
Tree root = parser.query(queryStr);
walker.walk(root, context);
// retrieve whatever information you need from context
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-26 UTC."],[],[]]