Version of {@link #preOrder(NodeVisitor, Collection)} with one root.

@param nodeVisitor the visitor of the nodes
@param root        the root node

@return the accumulation result of this traversal
321045
public Object preOrder(NodeVisitor nodeVisitor, Node root) {
        return preOrder(nodeVisitor, Collections.singleton(root));
    }
1101430
@Override
    public void visit(NodeVisitor v) {
        if (v.visit(this)) {
            body.visit(v);
            condition.visit(v);
        }
    }
524861
public static SourceLineAnnotation fromVisitedMethod(PreorderVisitor visitor) {

        SourceLineAnnotation sourceLines = getSourceAnnotationForMethod(visitor.getDottedClassName(), visitor.getMethodName(),
                visitor.getMethodSig());
        return sourceLines;
    }
787809
public static Elements select(Evaluator evaluator, Element root) {
        Validate.notNull(evaluator);
        Validate.notNull(root);
        return Collector.collect(evaluator, root);
    }
1133459
@SuppressWarnings("unchecked") //suppress warnings to return an ADStarNode instead of Node, which is the inherited return type from parent
    @Override
    public ADStarNodeImpl<A, S, C> previousNode() {
        return (ADStarNodeImpl<A, S, C>) previousNode;
    }
852193
public void setRoot(int root)
  {

    super.setRoot(root);

  	m_exprObj = FilterExprIteratorSimple.executeFilterExpr(root, 
  	                  m_lpi.getXPathContext(), m_lpi.getPrefixResolver(), 
  	                  m_lpi.getIsTopLevel(), m_lpi.m_stackFrame, m_expr);

  }
483799
public static void assertTree(int rootType, String preorder, ParseResults parseResults)
    {
        assertTree(rootType, preorder, parseResults.getTree());
    }
364960
public int getPreItemCountByOrder(int order) {
        //if we are empty just return 0 count
        if (mGlobalSize == 0) {
            return 0;
        }

        int size = 0;

        //count the number of items before the adapter with the given order
        for (int i = 0; i < Math.min(order, mAdapters.size()); i++) {
            size = size + mAdapters.get(i).getAdapterItemCount();
        }

        //get the count of items which are before this order
        return size;
    }
289714
public static <N, E, D> boolean traverse(TraversalOrder order,
                                             IndefiniteGraph<N, E> graph,
                                             int limit,
                                             N initialNode,
                                             GraphTraversalVisitor<N, E, D> vis) {
        return traverse(order, graph, limit, Collections.singleton(initialNode), vis);
    }
1310987
@Override
    public void visit(NodeVisitor v) {
        if (v.visit(this)) {
            for (XmlFragment frag : fragments) {
                frag.visit(v);
            }
        }
    }
557430
public static void visitPreOrder(
      Node node, Visitor visitor, Predicate<Node> traverseChildrenPred) {
    visitor.visit(node);

    if (traverseChildrenPred.apply(node)) {
      for (Node c = node.getFirstChild(); c != null; c = c.getNext()) {
        visitPreOrder(c, visitor, traverseChildrenPred);
      }
    }
  }
823281
def preorder(self, skip_seed=False):
        
        for node in self._tree.preorder_node_iter():
            if skip_seed and node is self._tree.seed_node:
                continue
            yield node
1297338
@Override
    public void visit(NodeVisitor v) {
        if (v.visit(this)) {
            if (functionName != null) {
                functionName.visit(v);
            }
            for (AstNode param : getParams()) {
                param.visit(v);
            }
            getBody().visit(v);
            if (!isExpressionClosure) {
                if (memberExprNode != null) {
                    memberExprNode.visit(v);
                }
            }
        }
    }
5527
@Override
    public void visit(NodeVisitor v) {
        if (v.visit(this)) {
            testExpression.visit(v);
            trueExpression.visit(v);
            falseExpression.visit(v);
        }
    }
302987
function topLevelNodeBefore(node, top) {
    while (!node.previousSibling && node.parentNode != top)
      node = node.parentNode;
    return topLevelNodeAt(node.previousSibling, top);
  }
454206
public static List<INodeEntry> rankOrderedNodes(Collection<INodeEntry> nodes, String rankProperty,
            boolean rankAscending) {
        final ArrayList<INodeEntry> nodes1 = new ArrayList<>(nodes);
        //reorder based on configured rank property and order
        final INodeEntryComparator comparator = new INodeEntryComparator(rankProperty);

        Collections.sort(nodes1, rankAscending ? comparator : Collections.reverseOrder(comparator));
        return nodes1;
    }
231761
Node getNode(Node root) {
        if (isRoot()) {
            return root;
        }

        Node startNode = root;
        Matcher pathMatcher = dotWithPreviousChar.matcher(path);
        int pos = 0;
        while (pathMatcher.find()) {
            String step = path.substring(pos, pathMatcher.end() - 1);
            pos = pathMatcher.end();
            startNode = doStep(step, startNode);
        }
        startNode = doStep(path.substring(pos), startNode);
        return startNode;
    }