Traversal function for the "child" direction The child axis
          contains the children of the context node in document order.
976130
def xpathNextChild(self, cur):
        
        if cur is None: cur__o = None
        else: cur__o = cur._o
        ret = libxml2mod.xmlXPathNextChild(self._o, cur__o)
        if ret is None:raise xpathError('xmlXPathNextChild() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp
144873
private void secondWalk(TreeNode v, double m, int level, double levelStart) {
		// construct the position from the prelim and the level information

		// The rootLocation affects the way how x and y are changed and in what
		// direction.
		double levelChangeSign = getLevelChangeSign();
		boolean levelChangeOnYAxis = isLevelChangeInYAxis();
		double levelSize = getSizeOfLevel(level);

		double x = getPrelim(v) + m;

		double y;
		AlignmentInLevel alignment = configuration.getAlignmentInLevel();
		if (alignment == AlignmentInLevel.Center) {
			y = levelStart + levelChangeSign * (levelSize / 2);
		} else if (alignment == AlignmentInLevel.TowardsRoot) {
			y = levelStart + levelChangeSign * (getNodeThickness(v) / 2);
		} else {
			y = levelStart + levelSize - levelChangeSign
					* (getNodeThickness(v) / 2);
		}

		if (!levelChangeOnYAxis) {
			double t = x;
			x = y;
			y = t;
		}

		positions.put(v, new NormalizedPosition(x, y));

		// update the bounds
		updateBounds(v, x, y);

		// recurse
		if (!tree.isLeaf(v)) {
			double nextLevelStart = levelStart
					+ (levelSize + configuration.getGapBetweenLevels(level + 1))
					* levelChangeSign;
			for (TreeNode w : tree.getChildren(v)) {
				secondWalk(w, m + getMod(v), level + 1, nextLevelStart);
			}
		}
	}
1351060
function (callback, ctx) {
            var _walk = function (depth, node, ctx) {
                if (typeof callback === "function")
                    ctx = callback(depth, node, ctx, false);
                var children = node.children();
                for (var i = 0; i < children.length; i++)
                    ctx = _walk(depth + 1, children[i], ctx);
                if (typeof callback === "function")
                    ctx = callback(depth, node, ctx, true);
                return ctx;
            };
            ctx = _walk(0, this, ctx);
            return ctx;
        }
1087041
function drawNodeContext(nodeId, nbHops){
    clearGraph();

    var node = searchNodeInTree(gTree, nodeId);
    if (!contains(gNodesDisplayed, node.node)){
        addNodeToGraph(node.node);
        addRelToGraph(node.node);
    }

    if (node.childNodes){
        var lastNode;
        var nodesWithChildren = [node];
        for (var i = 0; i < nbHops; ++i){
            var currentNode = nodesWithChildren[i];
            if (currentNode){
                var childNodes = currentNode.childNodes;
                for (var j = 0; j < childNodes.length; ++j){
                    var currChild = childNodes[j];
                    if (!contains(gNodesDisplayed, currChild.node)){
                        addNodeToGraph(currChild.node);
                    }
                    if (contains (gNodesWithRel, currChild.node)){
                        addRelToGraph(currChild.node);
                        nodesWithChildren.push(currChild);
                    }
                }
                lastNode = currentNode;
            } else {
                nbHops = (nodesWithChildren.length > nbHops ? nbHops : nodesWithChildren.length);
            }
        }
    }

    if (isPaused){
        renderer.rerender();
    }
}
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);
		}
	}
619109
def traverse_levelorder(self, leaves=True, internal=True):
        ''''''
        for node in self.root.traverse_levelorder(leaves=leaves, internal=internal):
            yield node
948419
function indexChildren (options) {
  var context = _children.call(this, options)
  var fn = options.fn
  var inverse = options.inverse
  var i = 0
  var ret = ''
  var data

  var contextPath

  if (options.data) {
    data = handlebars.createFrame(options.data)
  }

  for (var j = context.length; i < j; i++) {
    indexDepthIncrement(options)
    if (data) {
      data.index = i
      data.first = (i === 0)
      data.last = (i === (context.length - 1))

      if (contextPath) {
        data.contextPath = contextPath + i
      }
    }
    ret = ret + fn(context[i], { data: data })
    indexDepthDecrement(options)
  }

  if (i === 0) {
    ret = inverse(this)
  }

  return ret
}
1200008
def LayoutChildren( self, dc, children, parent, x,y,w,h, hot_map, depth=0, node_sum=None ):
        
        if node_sum is None:
            nodes = [ (self.adapter.value(node,parent),node) for node in children ]
            nodes.sort(key=operator.itemgetter(0))
            total = self.adapter.children_sum( children,parent )
        else:
            nodes = children
            total = node_sum
        if total:
            if self.square_style and len(nodes) > 5:
                # new handling to make parents with large numbers of parents a little less 
                # "sliced" looking (i.e. more square)
                (head_sum,head),(tail_sum,tail) = split_by_value( total, nodes )
                if head and tail:
                    # split into two sub-boxes and render each...
                    head_coord,tail_coord = split_box( head_sum/float(total), x,y,w,h )
                    if head_coord:
                        self.LayoutChildren( 
                            dc, head, parent, head_coord[0],head_coord[1],head_coord[2],head_coord[3],
                            hot_map, depth,
                            node_sum = head_sum,
                        )
                    if tail_coord and coord_bigger_than_padding( tail_coord, self.padding+self.margin ):
                        self.LayoutChildren( 
                            dc, tail, parent, tail_coord[0],tail_coord[1],tail_coord[2],tail_coord[3],
                            hot_map, depth,
                            node_sum = tail_sum,
                        )
                    return 
                        
            (firstSize,firstNode) = nodes[-1]
            fraction = firstSize/float(total)
            head_coord,tail_coord = split_box( firstSize/float(total), x,y,w,h )
            if head_coord:
                self.DrawBox( 
                    dc, firstNode, head_coord[0],head_coord[1],head_coord[2],head_coord[3], 
                    hot_map, depth+1 
                )
            else:
                return # no other node will show up as non-0 either
                
            if len(nodes) > 1 and tail_coord and coord_bigger_than_padding( tail_coord, self.padding+self.margin ):
                self.LayoutChildren( 
                    dc, nodes[:-1], parent, 
                    tail_coord[0],tail_coord[1],tail_coord[2],tail_coord[3], 
                    hot_map, depth,
                    node_sum = total - firstSize,
                )
1084565
def traverse(self, callback):
        ''' 
        '''
        def _traverse_node(path, node, callback):
            ret_val = callback(path, node)
            if ret_val is not None:
                # replace node with the return value
                node = ret_val
            else:
                # traverse deep into the hierarchy
                if isinstance(node, YAMLDict):
                    for k, v in node.items():
                        node[k] = _traverse_node(path + [k], v,
                                                 callback)
                elif isinstance(node, list):
                    for i, v in enumerate(node):
                        node[i] = _traverse_node(path + ['[{0}]'.format(i)], v,
                                                 callback)
                else:
                    pass
            return node
        _traverse_node([], self, callback)
498654
function nodeChildrenAsMap(node) {
    var map$$1 = {};
    if (node) {
        node.children.forEach(function (child) { return map$$1[child.value.outlet] = child; });
    }
    return map$$1;
}
289402
def _traverse_nodes(self):
        
        node = self.root
        stack = []
        while stack or node is not None:
            if node is not None:
                stack.append(node)
                node = node.left
            else:
                node = stack.pop()
                yield node
                node = node.right
129275
def __descendants(self):
        
        return itertools.chain(self.contents,
                               *[c.descendants for c in self.children])
776413
def node_coord_in_direction(tile_id, direction):
    
    tile_coord = tile_id_to_coord(tile_id)
    for node_coord in nodes_touching_tile(tile_id):
        if tile_node_offset_to_direction(node_coord - tile_coord) == direction:
            return node_coord
    raise ValueError('No node found in direction={} at tile_id={}'.format(
        direction,
        tile_id
    ))
1202314
function traverseNodes(nodes, visitor) {
    const ne = new NodeEventGenerator(visitor)
    traverse(nodes, {
        enter(child) {
            ne.enterNode(child)
        },

        leave(child) {
            ne.leaveNode(child)
        },
    })
}
546457
function(node){
			var context = this,
				children = [],
				child,
				classes,
				items = [],
				out = [];

			classes = this.getUfClassNames(node);
			// if it is a root microformat node
			if(classes && classes.root.length > 0){
				items = this.walkTree(node);

				if(items.length > 0){
					out = out.concat(items);
				}
			}else{
				// check if there are children and one of the children has a root microformat
				children = modules.domUtils.getChildren( node );
				if(children && children.length > 0 && this.findRootNodes(node, true).length > -1){
					for (var i = 0; i < children.length; i++) {
						child = children[i];
						items = context.walkRoot(child);
						if(items.length > 0){
							out = out.concat(items);
						}
					}
				}
			}
			return out;
		}
105835
QNode traversalHead() {
    for (;;) {
      QNode t = this.tail.get();
      QNode h = this.head.get();
      if (h != null && t != null) {
        QNode last = t.next;
        QNode first = h.next;
        if (t == this.tail.get()) {
          if (last != null) {
            this.tail.compareAndSet(t, last);
          } else if (first != null) {
            Object x = first.get();
            if (x == first) {
              advanceHead(h, first);
            } else {
              return h;
            }
          } else {
            return h;
          }
        }
      }
    }
  }
596456
function traverseChildren(tw, type) {
  var child, node, parent, result, sibling;
  node = tw._currentNode[mapChild[type]];
  while (node !== null) {
    result = tw._internalFilter(node);
    if (result === NodeFilter.FILTER_ACCEPT) {
      tw._currentNode = node;
      return node;
    }
    if (result === NodeFilter.FILTER_SKIP) {
      child = node[mapChild[type]];
      if (child !== null) {
        node = child;
        continue;
      }
    }
    while (node !== null) {
      sibling = node[mapSibling[type]];
      if (sibling !== null) {
        node = sibling;
        break;
      }
      parent = node.parentNode;
      if (parent === null || parent === tw.root || parent === tw._currentNode) {
        return null;
      } else {
        node = parent;
      }
    }
  }
  return null;
}