循环

 public static * findNodeByPath(* root, int... path) {
    for (int i = 0; i < path.length; i++) {
      int type = path[i];
      boolean hasChildWithType = false;

      for (int j = 0; j < root.getChildCount(); j++) {
        ASTNode node = (ASTNode) root.getChild(j);
        if (node.getToken().getType() == type) {
          hasChildWithType = true;
          root = node;
         if (i == path.length - 1) {
            return root;
          } else {
          
            break;
          }
        } else {
        
          continue;
        }
      }

      if (!hasChildWithType) {
 
        break;
      }
    }

    return null;
  }

你可能感兴趣的:(循环)