Traversal function for the "child" direction The child axis
          contains the children of the context node in document order.
197521
def xpathNextChild(self, ctxt):
        
        if ctxt is None: ctxt__o = None
        else: ctxt__o = ctxt._o
        ret = libxml2mod.xmlXPathNextChild(ctxt__o, self._o)
        if ret is None:raise xpathError('xmlXPathNextChild() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp
493243
def _recursiveSetNodePath(self, nodePath):
        
        self._nodePath = nodePath
        for childItem in self.childItems:
            childItem._recursiveSetNodePath(nodePath + '/' + childItem.nodeName)
489978
public int getPositionInContextNodeList(XPathContext xctxt)
  {

    // System.out.println("FuncPosition- entry");
    // If we're in a predicate, then this will return non-null.
    SubContextList iter = m_isTopLevel ? null : xctxt.getSubContextList();

    if (null != iter)
    {
      int prox = iter.getProximityPosition(xctxt);
 
      // System.out.println("FuncPosition- prox: "+prox);
      return prox;
    }

    DTMIterator cnl = xctxt.getContextNodeList();

    if (null != cnl)
    {
      int n = cnl.getCurrentNode();
      if(n == DTM.NULL)
      {
        if(cnl.getCurrentPos() == 0)
          return 0;
          
        // Then I think we're in a sort.  See sort21.xsl. So the iterator has 
        // already been spent, and is not on the node we're processing. 
        // It's highly possible that this is an issue for other context-list 
        // functions.  Shouldn't be a problem for last(), and it shouldn't be 
        // a problem for current().
        try 
        { 
          cnl = cnl.cloneWithReset(); 
        }
        catch(CloneNotSupportedException cnse)
        {
          throw new org.apache.xml.utils.WrappedRuntimeException(cnse);
        }
        int currentNode = xctxt.getContextNode();
        // System.out.println("currentNode: "+currentNode);
        while(DTM.NULL != (n = cnl.nextNode()))
        {
          if(n == currentNode)
            break;
        }
      }
      // System.out.println("n: "+n);
      // System.out.println("FuncPosition- cnl.getCurrentPos(): "+cnl.getCurrentPos());
      return cnl.getCurrentPos();
    }

    // System.out.println("FuncPosition - out of guesses: -1");
    return -1;
  }
223252
public ResourceHandle findUpwards(String basePath, Pattern namePattern, String childType) {
        ResourceHandle current = this;
        while (current != null && current.isValid()) {
            ResourceHandle base = ResourceHandle.use(current.getChild(basePath));
            if (base.isValid()) {
                for (ResourceHandle child : base.getChildrenByType(childType)) {
                    if (namePattern.matcher(child.getName()).matches()) {
                        return child;
                    }
                }
            }
            current = current.getParent();
        }
        return null;
    }
230175
protected void layoutChild(final int dataIndex) {
        Widget child = mContainer.get(dataIndex);
        if (child != null) {
            float offset = mOffset.get(Axis.X);
            if (!equal(offset, 0)) {
                updateTransform(child, Axis.X, offset);
            }

            offset = mOffset.get(Axis.Y);
            if (!equal(offset, 0)) {
                updateTransform(child, Axis.Y, offset);
            }

            offset = mOffset.get(Axis.Z);
            if (!equal(offset, 0)) {
                updateTransform(child, Axis.Z, offset);
            }
       }
    }
1003561
def traverse_layout(root, callback):
    
    callback(root)
    if isinstance(root, collections.Iterable):
        for child in root:
            traverse_layout(child, callback)
1350555
def traverse_depth_first_pre_order(self, callback):
        
        n = len(self.suftab)
        root = [0, 0, n - 1, ""]  # <l, i, j, char>

        def _traverse_top_down(interval):  # TODO: Rewrite with stack? As in bottom-up
            callback(interval)
            i, j = interval[1], interval[2]
            if i != j:
                children = self._get_child_intervals(i, j)
                children.sort(key=lambda child: child[3])
                for child in children:
                    _traverse_top_down(child)

        _traverse_top_down(root)
517052
function(layerContext, node) {
        var srs    = this.getChildValue(node);
        if (typeof layerContext.projections != "object") {
            layerContext.projections = {};
        }
        var values = srs.split(/ +/);
        for (var i=0, len=values.length; i<len; i++) {
            layerContext.projections[values[i]] = true;
        }
    }
1202314
function traverseNodes(nodes, visitor) {
    const ne = new NodeEventGenerator(visitor)
    traverse(nodes, {
        enter(child) {
            ne.enterNode(child)
        },

        leave(child) {
            ne.leaveNode(child)
        },
    })
}
1044558
def traverse_children(aParentNode)
      children = aParentNode.children
      broadcast(:before_subnodes, aParentNode, children)

      # Let's proceed with the visit of children
      children.each_with_index do |a_node, i|
        edge_sign = aParentNode.signatures[i]
        if a_node.kind_of?(SPPF::CompositeNode)
          push_node(a_node, edge_sign)
          access_paths = node_accesses[a_node]
          last_path = legs.last[-1]
          path_reused = access_paths.include?(last_path)
          unless path_reused
            node_accesses[a_node].push(last_path)
            a_node.accept(self)
          end
          pop_node
        else
          a_node.accept(self)
        end
      end

      broadcast(:after_subnodes, aParentNode, children)
    end
264387
function getPosition(nodeA, offsetA, nodeB, offsetB) {
	// "If node A is the same as node B, return equal if offset A equals offset
	// B, before if offset A is less than offset B, and after if offset A is
	// greater than offset B."
	if (nodeA == nodeB) {
		if (offsetA == offsetB) {
			return "equal";
		}
		if (offsetA < offsetB) {
			return "before";
		}
		if (offsetA > offsetB) {
			return "after";
		}
	}

	// "If node A is after node B in tree order, compute the position of (node
	// B, offset B) relative to (node A, offset A). If it is before, return
	// after. If it is after, return before."
	if (nodeB.compareDocumentPosition(nodeA) & Node.DOCUMENT_POSITION_FOLLOWING) {
		var pos = getPosition(nodeB, offsetB, nodeA, offsetA);
		if (pos == "before") {
			return "after";
		}
		if (pos == "after") {
			return "before";
		}
	}

	// "If node A is an ancestor of node B:"
	if (nodeB.compareDocumentPosition(nodeA) & Node.DOCUMENT_POSITION_CONTAINS) {
		// "Let child equal node B."
		var child = nodeB;

		// "While child is not a child of node A, set child to its parent."
		while (child.parentNode != nodeA) {
			child = child.parentNode;
		}

		// "If the index of child is less than offset A, return after."
		if (getNodeIndex(child) < offsetA) {
			return "after";
		}
	}

	// "Return before."
	return "before";
}
777523
function traverseRecursive(rootNode, options) {
  options = extend({
    subnodesAccessor: function(node) { return node.subnodes; },
    onNode: function(node, callback, userdata) {},
    onComplete: function(rootNode) {},
    userdata: null
  }, options);

  (function visitNode(node, callback) {
    var subnodes = options.subnodesAccessor(node);
    async.eachSeries(subnodes, function(subnode, next) {
      visitNode(subnode, function() {
        async.setImmediate(next);
      });
    },
    function() {
      options.onNode(node, function() {
        async.setImmediate(callback);
      }, options.userdata);
    });
  })(rootNode, function() {
    options.onComplete(rootNode);
  });
}
300524
function traverseBreadthFirst(rootNode, options) {
  options = extend({
    subnodesAccessor: function(node) { return node.subnodes; },
    userdataAccessor: function(node, userdata) { return userdata; },
    onNode: function(node, callback, userdata) { callback(); },
    onComplete: function(rootNode) {},
    userdata: null
  }, options);

  var queue = [];
  queue.push([rootNode, options.userdata]);

  (function next() {
    if (queue.length == 0) {
      options.onComplete(rootNode);
      return;
    }

    var front = queue.shift();
    var node = front[0];
    var data = front[1];

    options.onNode(node, function() {
      var subnodeData = options.userdataAccessor(node, data);
      var subnodes = options.subnodesAccessor(node);
      async.eachSeries(subnodes,
        function(subnode, nextNode) {
          queue.push([subnode, subnodeData]);
          async.setImmediate(nextNode);
        },
        function() {
          async.setImmediate(next);
        }
      );
    },
    data);
  })();
}
1273919
function nodeForPoint(model, point, direction) {
	const node = model.nodeForPoint(point);

	if (node) {
		return node;
	}

	// Looks like caret is outside of any top-level node.
	const topLevelNodes = model.dom.children;

	if (direction === 'next') {
		// Find next node, which is closest top-level to given position
		return topLevelNodes.find(node => node.start.isGreaterThanOrEqual(point));
	}

	// Find previous node, which is deepest child of closest previous node
	for (let i = topLevelNodes.length - 1; i >= 0; i--) {
		if (topLevelNodes[i].end.isLessThanOrEqual(point)) {
			return deepestChild(topLevelNodes[i]);
		}
	}
}
1143231
private final static void traverse(Element element, ElementVisitor visitor) {

		visitor.visit(element);

		NodeList children = element.getChildNodes();

		for (int i = 0; i < children.getLength(); i++) {
			Node node = children.item(i);

			if (node.getNodeType() != Node.ELEMENT_NODE)
				continue;

			traverse((Element) node, visitor);
		}
	}
129275
def __descendants(self):
        
        return itertools.chain(self.contents,
                               *[c.descendants for c in self.children])
848832
def get_children_treepos(self, treepos):
        """"""
        children_treepos = []
        for i, child in enumerate(self.dgtree[treepos]):
            if isinstance(child, nltk.Tree):
                children_treepos.append(child.treeposition())
            elif is_leaf(child):
                # we can't call .treeposition() on a leaf node
                treepos_list = list(treepos)
                treepos_list.append(i)
                leaf_treepos = tuple(treepos_list)
                children_treepos.append(leaf_treepos)
        return children_treepos