gpt4 book ai didi

org.springframework.ide.vscode.commons.yaml.path.YamlTraversal类的使用及代码示例

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

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

YamlTraversal介绍

暂无

代码示例

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

@Override
public <T extends YamlNavigable<T>> Stream<T> traverseAmbiguously(T start) {
  return Stream.concat(
      first.traverseAmbiguously(start),
      second.traverseAmbiguously(start)
  );
}

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

@Override
public boolean canEmpty() {
  return yamlTraversal.canEmpty();
}

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

default YamlTraversal repeatAtLeast(int howMany) {
  if (isEmpty()) {
    return this;
  } else if (howMany>0) {
    return this.then(this.repeatAtLeast(howMany-1));
  } else {
    return this.repeat();
  }
}

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

default YamlTraversal or(YamlTraversal other) {
  if (this.isEmpty()) {
    return other;
  } else if (other.isEmpty()) {
    return this;
  } else {
    return new AlternativeYamlTraversal(this, other);
  }
}

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

default YamlTraversal thenAnyChild() {
  return then(YamlPathSegment.anyChild());
}
default YamlTraversal or(YamlTraversal other) {

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

default Node traverseToNode(YamlFileAST root) {
  ASTCursor cursor = traverse(new ASTRootCursor(root));
  if (cursor instanceof NodeCursor) {
    return ((NodeCursor)cursor).getNode();
  }
  return null;
}

代码示例来源: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;
}

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

default YamlTraversal then(YamlTraversal other) {
  if (this.isEmpty()) {
    return other;
  } else if (other.isEmpty()) {
    return this;
  }
  return new SequencingYamlTraversal(this, other);
}

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

default YamlTraversal thenValAt(int index) {
  return then(YamlPathSegment.valueAt(index));
}
default YamlTraversal thenValAt(String key) {

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

default Node traverseNode(Node root) {
  if (root!=null) {
    ASTCursor cursor = traverse(new NodeCursor(root));
    if (cursor instanceof NodeCursor) {
      return ((NodeCursor)cursor).getNode();
    }
  }
  return null;
}

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

@Override
public <T extends YamlNavigable<T>> Stream<T> traverseAmbiguously(T start) {
  Stream<T> x = yamlTraversal.traverseAmbiguously(start);
  return x.filter(target ->
    check.traverseAmbiguously(target)
    .findAny()
    .isPresent()
  );
}

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

public AlternativeYamlTraversal(YamlTraversal first, YamlTraversal second) {
  Assert.isLegal(!first.isEmpty());
  Assert.isLegal(!second.isEmpty());
  this.first = first;
  this.second = second;
}

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

@Override
public boolean canEmpty() {
  return first.canEmpty() || second.canEmpty();
}

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

default YamlTraversal thenKeyAt(String key) {
  return then(YamlPathSegment.keyAt(key));
}
default YamlTraversal thenAnyChild() {

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

@Override
public <T extends YamlNavigable<T>> Stream<T> traverseAmbiguously(T start) {
  return first.traverseAmbiguously(start)
      .flatMap(second::traverseAmbiguously);
}

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

/**
 * Filters the end-points of a traversal, retaining only those
 * for which the `check` traversal starting at the end-point
 * leads somewhere.
 */
default YamlTraversal has(YamlTraversal check) {
  if (this.isEmpty()) {
    return this; // don't bother filtering empty!
  }
  return new FilteringTraversal(this, check);
}

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

@Override
public boolean canEmpty() {
  return first.canEmpty() && second.canEmpty();
}

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

default YamlTraversal thenValAt(String key) {
  return then(YamlPathSegment.valueAt(key));
}
default YamlTraversal thenKeyAt(String key) {

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

@Override
public <T extends YamlNavigable<T>> Stream<T> traverseAmbiguously(T start) {
  if (start==null) {
    return Stream.empty();
  } else {
    return Stream.concat(
      Streams.fromNullable(start),
      step.traverseAmbiguously(start).flatMap(next -> {
        return this.traverseAmbiguously(next);
      })
    );
  }
}

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

@Override
public YamlTraversal then(YamlTraversal _other) {
  if (isEmpty()) {
    return _other;
  } else if (_other.isEmpty()) {
    return this;
  } else if (_other instanceof YamlPathSegment) {
    return this.append((YamlPathSegment) _other);
  } else if (_other instanceof YamlPath) {
    YamlPath other = (YamlPath) _other;
    return new YamlPath(
      Stream.concat(
        Arrays.stream(this.segments),
        Arrays.stream(other.segments)
      ).toArray(sz -> new YamlPathSegment[sz])
    );
  } else {
    return new SequencingYamlTraversal(this, _other);
  }
}

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