Пример #1
0
  private void expand(ScopeNode node, String[] parts, int index) {
    List<ScopeNode> children = node.getNodes();
    String match = parts[index];

    for (ScopeNode child : children) {
      String name = child.getName();

      if (name.equals(match)) {
        expand(child, parts, index + 1);
        break;
      }
    }
  }
Пример #2
0
  public Map<String, Map<String, String>> expand(Set<String> expand) {
    Map<String, Map<String, String>> variables = new HashMap<String, Map<String, String>>();
    ScopeNodeBuilder builder = new ScopeNodeBuilder(variables, context);
    ScopeNode node = new ScopeNodeTree(builder, scope);

    if (!expand.isEmpty()) {
      for (String path : expand) {
        String[] parts = path.split("\\.");
        expand(node, parts, 0);
      }
    } else {
      node.getNodes(); // expand root
    }
    return variables;
  }