gpt4 book ai didi

org.springframework.ide.vscode.commons.yaml.path.YamlPath.size()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 19:51:31 30 4
gpt4 key购买 nike

本文整理了Java中org.springframework.ide.vscode.commons.yaml.path.YamlPath.size()方法的一些代码示例,展示了YamlPath.size()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlPath.size()方法的具体详情如下:
包路径:org.springframework.ide.vscode.commons.yaml.path.YamlPath
类名称:YamlPath
方法名:size

YamlPath.size介绍

暂无

代码示例

代码示例来源:origin: spring-projects/sts4

public YamlPath dropLast(int dropCount) {
  if (dropCount>=size()) {
    return EMPTY;
  }
  if (dropCount==0) {
    return this;
  }
  YamlPathSegment[] newPath = new YamlPathSegment[segments.length-dropCount];
  for (int i = 0; i < newPath.length; i++) {
    newPath[i] = segments[i];
  }
  return new YamlPath(newPath);
}

代码示例来源:origin: spring-projects/sts4

public YamlPath dropFirst(int dropCount) {
  if (dropCount>=size()) {
    return EMPTY;
  }
  if (dropCount==0) {
    return this;
  }
  YamlPathSegment[] newPath = new YamlPathSegment[segments.length-dropCount];
  for (int i = 0; i < newPath.length; i++) {
    newPath[i] = segments[i+dropCount];
  }
  return new YamlPath(newPath);
}

代码示例来源:origin: spring-projects/sts4

public YamlPath commonPrefix(YamlPath other) {
  ArrayList<YamlPathSegment> common = new ArrayList<>(this.size());
  for (int i = 0; i < this.size(); i++) {
    YamlPathSegment s = this.getSegment(i);
    if (s.equals(other.getSegment(i))) {
      common.add(s);
    }
  }
  return new YamlPath(common);
}

代码示例来源:origin: spring-projects/sts4

protected String createPathInsertionText(YamlPath path, int indent, boolean startOnNewLine, String appendText) {
  StringBuilder buf = new StringBuilder();
  for (int i = 0; i < path.size(); i++) {
    if (startOnNewLine||i>0) {
      indentUtil.addNewlineWithIndent(indent, buf);
    }
    String key = path.getSegment(i).toPropString();
    buf.append(YamlUtil.stringEscape(key));
    buf.append(":");
    if (i<path.size()-1) {
      indent += YamlIndentUtil.INDENT_BY;
    } else {
      buf.append(indentUtil.applyIndentation(appendText, indent));
    }
  }
  return buf.toString();
}

代码示例来源:origin: spring-projects/sts4

/**
 * Determines the actual health-check-type that applies to a given node, taking into account
 * inheritance from parent node, and default value.
 */
private String getEffectiveHealthCheckType(YamlFileAST ast, YamlPath path, Node node) {
  String explicit = NodeUtil.getScalarProperty(node, HEALTH_CHECK_TYPE_PROP);
  if (explicit!=null) {
    return explicit;
  }
  if (path.size()>2) {
    //Must consider inherited props!
    YamlPath parentPath = path.dropLast(2);
    Node parent = parentPath.traverseToNode(ast);
    String inherited = NodeUtil.getScalarProperty(parent, HEALTH_CHECK_TYPE_PROP);
    if (inherited!=null) {
      return inherited;
    }
  }
  return "port";
}

代码示例来源:origin: spring-projects/sts4

private static YamlTraversal getConflictingNodesTraversal(YamlPath path, String[] propertyIds) {
  Assert.isLegal(propertyIds.length > 0);
  YamlTraversal properties = null;
  for (String id : propertyIds) {
    properties = properties == null ? YamlPathSegment.keyAt(id) : properties.or(YamlPathSegment.keyAt(id));
  }
  YamlTraversal traversal = path.then(properties);
  if (path.size() > 2) {
    traversal = traversal.or(path.dropLast(2).then(properties));
  }
  return traversal;
}

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com