Traverses a branch.
189758
private void traverseBranch(Node n, Node parent) {
    switch (n.getToken()) {
      case SCRIPT:
        handleScript(n, parent);
        return;
      case FUNCTION:
        handleFunction(n, parent);
        return;
      case MODULE_BODY:
        handleModule(n, parent);
        return;
      default:
        break;
    }
    curNode = n;
    if (!callback.shouldTraverse(this, n, parent)) {
      return;
    }

    Token type = n.getToken();
    if (type == Token.CLASS) {
      traverseClass(n);
    } else if (type == Token.CLASS_MEMBERS) {
      traverseClassMembers(n);
    } else if (useBlockScope && NodeUtil.createsBlockScope(n)) {
      traverseBlockScope(n);
    } else {
      traverseChildren(n);
    }

    curNode = n;
    callback.visit(this, n, parent);
  }
766766
function traverse(tokens, options) {
    const traverser = new Traverser()
    const nodes = Array.isArray(tokens) ? tokens : [tokens]
    for (const node of nodes) {
        traverser.traverse(node, options)
        if (traverser.isBroken()) {
            return
        }
    }
}
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);
		}
	}
172137
private void cascadingCut(Node<K, V> y) {
        Node<K, V> z;
        while ((z = y.parent) != null) {
            if (!y.mark) {
                y.mark = true;
                break;
            }
            cut(y, z);
            y = z;
        }
    }
1279922
function _exploreBranch(baseWord, currentBranch) {
    var predictedList = [];

    for (var b in currentBranch.branches) { //For each branch forking from the branch
      var prefix = currentBranch.branches[b].prefix; //Get the leading character of the current branch

      if (currentBranch.branches[b].$ === true) { //If the current leaf ends a word, puts the word on the list
        predictedList.push(baseWord + prefix);
      }

      //Recursively calls the function, passing the forking branches as parameter
      var predictedWords = this._exploreBranch(baseWord + prefix, currentBranch.branches[b]);

      predictedList = predictedList.concat(predictedWords);

    }
    return predictedList;
  }
960128
function traverseTopDown(fn) {
    var result, i;
    result = fn.call(this);
    if(result)
        return result;
    if (this instanceof tree.ConsNode || this instanceof tree.ListNode) {
        for (i = 0; i < this.length; i++) {
            traverseTopDown.call(this[i], fn);
        }
    }
    return this;
}
876358
def walk(self,depth=0,fsNode=None) :
        """"""
        if not fsNode :
            fsNode = FSNode(self.init_path,self.init_path,0)
            
        if fsNode.isdir() :
            if self.check_dir(fsNode) :
                if self.check_return(fsNode) :
                    yield fsNode                
                for n in fsNode.children() :
                    if n.islink() :
                        # currently we don't follow links
                        continue
                    for n2 in self.walk(depth+1,n) :
                        if self.check_return(n2) :
                            yield n2
        else :
            if self.check_file(fsNode) :
                if self.check_return(fsNode) :
                    yield fsNode
        raise StopIteration
1331739
def branches(self):
        
        for branch in self._grid.graph_edges():
            if branch['branch'].ring == self:
                yield branch
1088540
protected void traverseDir(String prefix, File dir, TraversalState state) {
    File[]	files;

    // check classes
    files = dir.listFiles(new ClassFileFilter());
    if (files != null) {
      for (File file : files) {
	if (prefix == null)
	  traverse(file.getName(), state);
	else
	  traverse(prefix + "." + file.getName(), state);
      }
    }

    // descend in directories
    files = dir.listFiles(new DirectoryFilter());
    if (files != null) {
      for (File file : files) {
	if (prefix == null)
	  traverseDir(file.getName(), file, state);
	else
	  traverseDir(prefix + "." + file.getName(), file, state);
      }
    }
  }
738672
function traverse(ast) {
    var visitors = flatten(slice.call(arguments, 1));

    estraverse.traverse(ast, {
        enter: function(node) {
            var type = node.type;
            var methodName = type + 'Enter';
            visitorsCall('enter', this, arguments);
            visitorsCall(methodName, this, arguments);
        },
        leave: function(node) {
            var type = node.type;
            var methodName = type + 'Leave';
            visitorsCall('leave', this, arguments);
            visitorsCall(methodName, this, arguments);
        }
    });


    function visitorsCall(methodName, context, args) {
        var callArgs = slice.call(args);
        var callBreak;
        var visitorContext = Object.assign(
            Object.create(context),
            {
                skip: function() {
                    callBreak = true;
                    context.skip();
                },
                break: function() {
                    callBreak = true;
                    context.break();
                }
            }
        );
        visitors.some(function(visitor) {
            var method = visitor[methodName];
            if (method) {
                method.apply(visitorContext, callArgs);
            }
            return callBreak;
        });
    }
}
1349615
void traverseWithScope(Node root, AbstractScope<?, ?> s) {
    checkState(s.isGlobal() || s.isModuleScope(), s);
    try {
      initTraversal(root);
      curNode = root;
      pushScope(s);
      traverseBranch(root, null);
      popScope();
    } catch (Error | Exception unexpectedException) {
      throwUnexpectedException(unexpectedException);
    }
  }
427156
protected boolean flow(DiGraphNode<N, Branch> node) {
    FlowState<L> state = node.getAnnotation();
    if (isForward()) {
      L outBefore = state.out;
      state.out = flowThrough(node.getValue(), state.in);
      return !outBefore.equals(state.out);
    } else {
      L inBefore = state.in;
      state.in = flowThrough(node.getValue(), state.out);
      return !inBefore.equals(state.in);
    }
  }
519042
def traversal(root):
    ''''''
    stack = [root]
    while len(stack) > 0:
        node = stack.pop()
        if hasattr(node,'children'):
            if node.children == set():
                try:
                    stack[-1].children.remove(node)
                except:
                    pass
                yield (node,stack)
            else:
                childnode = node.children.pop()
                stack += [node,childnode]
        else: 
            children = [x for x in ast.iter_child_nodes(node)]
            node.children = set(children)
            stack.append(node)
1181676
private Result branchNext(int pos, int length, int inUnit) {
        // Branch according to the current unit.
        if(length==0) {
            length=chars_.charAt(pos++);
        }
        ++length;
        // The length of the branch is the number of units to select from.
        // The data structure encodes a binary search.
        while(length>kMaxBranchLinearSubNodeLength) {
            if(inUnit<chars_.charAt(pos++)) {
                length>>=1;
                pos=jumpByDelta(chars_, pos);
            } else {
                length=length-(length>>1);
                pos=skipDelta(chars_, pos);
            }
        }
        // Drop down to linear search for the last few units.
        // length>=2 because the loop body above sees length>kMaxBranchLinearSubNodeLength>=3
        // and divides length by 2.
        do {
            if(inUnit==chars_.charAt(pos++)) {
                Result result;
                int node=chars_.charAt(pos);
                if((node&kValueIsFinal)!=0) {
                    // Leave the final value for getValue() to read.
                    result=Result.FINAL_VALUE;
                } else {
                    // Use the non-final value as the jump delta.
                    ++pos;
                    // int delta=readValue(pos, node);
                    int delta;
                    if(node<kMinTwoUnitValueLead) {
                        delta=node;
                    } else if(node<kThreeUnitValueLead) {
                        delta=((node-kMinTwoUnitValueLead)<<16)|chars_.charAt(pos++);
                    } else {
                        delta=(chars_.charAt(pos)<<16)|chars_.charAt(pos+1);
                        pos+=2;
                    }
                    // end readValue()
                    pos+=delta;
                    node=chars_.charAt(pos);
                    result= node>=kMinValueLead ? valueResults_[node>>15] : Result.NO_VALUE;
                }
                pos_=pos;
                return result;
            }
            --length;
            pos=skipValue(chars_, pos);
        } while(length>1);
        if(inUnit==chars_.charAt(pos++)) {
            pos_=pos;
            int node=chars_.charAt(pos);
            return node>=kMinValueLead ? valueResults_[node>>15] : Result.NO_VALUE;
        } else {
            stop();
            return Result.NO_MATCH;
        }
    }
1001789
void checkout(File project, String branch) {
		try {
			String currentBranch = currentBranch(project);
			if (currentBranch.equals(branch)) {
				log.info("Won't check out the same branch. Skipping");
				return;
			}
			log.info("Checking out branch [" + branch + "]");
			checkoutBranch(project, branch);
			log.info("Successfully checked out the branch [" + branch + "]");
		}
		catch (Exception e) {
			throw new IllegalStateException(e);
		}
	}
774476
@Override
	public void walkTree(IResourceVisitor visitor) throws IOException {
		if (!exists()) {
			throw new FileNotFoundException(file.getAbsolutePath());
		}
		if (!file.isDirectory()) {
			return;
		}
		recurse(file, visitor, ""); //$NON-NLS-1$
	}
583232
function walk(node, rootNode, prev) {
      var sibling, parent, startName = prev ? 'lastChild' : 'firstChild', siblingName = prev ? 'prev' : 'next';

      // Walk into nodes if it has a start
      if (node[startName]) {
        return node[startName];
      }

      // Return the sibling if it has one
      if (node !== rootNode) {
        sibling = node[siblingName];

        if (sibling) {
          return sibling;
        }

        // Walk up the parents to look for siblings
        for (parent = node.parent; parent && parent !== rootNode; parent = parent.parent) {
          sibling = parent[siblingName];

          if (sibling) {
            return sibling;
          }
        }
      }
    }