コード例 #1
0
  @NotNull
  public ContextItem[] findCtxItems(String startCtxPath, String name) {
    String[] path = startCtxPath.split("/");
    int startWith = ("/" + path[1]).startsWith(ContextPath.FILE_CTX_PRX) ? 2 : 1;

    TreeNode cycled = root;
    for (int i = startWith; i < path.length; i++) {
      String encodedName = "/" + path[i];
      cycled = cycled.findChildByEncodedName(encodedName);
      if (cycled == null) {
        return new ContextItem[0];
      }
    }

    List<ContextItem> out = new ArrayList<ContextItem>();
    TreeNode[] children =
        name == null
            ? cycled.getChildren().toArray(new TreeNode[0])
            : cycled.findChildrenBySuffix(name);
    for (TreeNode n : children) {
      // todo -- revise to replace using value directly with a TreeNode instance
      out.add(new ContextItemImpl(n.getPath(), n.getValue()));
    }

    return out.toArray(new ContextItem[out.size()]);
  }
コード例 #2
0
  public ContextItem[] findInRootContext(int[] types) {
    List<ContextItem> out = new ArrayList<ContextItem>();
    for (TreeNode n : root.findChildrenByTypes(types)) {
      // todo -- revise to replace using value directly with a TreeNode instance
      out.add(new ContextItemImpl(n.getPath(), n.getValue()));
    }

    return out.toArray(new ContextItem[out.size()]);
  }
コード例 #3
0
 public void iterateTopNodes(String name, IndexEntriesWalkerInterruptable iproc) {
   List<TreeNodeImpl> list = root.childs.get(name.toLowerCase());
   if (list != null) {
     for (TreeNode n : list) {
       if (!iproc.process(n.getPath(), n.getValue())) {
         return;
       }
     }
   }
 }
コード例 #4
0
 public void iterateTopNodes(IndexEntriesWalkerInterruptable iproc) {
   // iterate thru children
   for (Map.Entry<String, List<TreeNodeImpl>> item : root.childs.entrySet()) {
     for (TreeNode n : item.getValue()) {
       if (!iproc.process(n.getPath(), n.getValue())) {
         return;
       }
     }
   }
 }
コード例 #5
0
  public ContextItem[] findCtxItems(int[] ctxTypes, String name) {
    List<ContextItem> out = new ArrayList<ContextItem>();
    // todo -- subject to simplify
    if (name == null) {
      for (List<TreeNodeImpl> children : root.childs.values()) {
        for (TreeNode n : children) {
          if (hitted(n.getType(), ctxTypes)) {
            out.add(new ContextItemImpl(n.getPath(), n.getValue()));
          }
        }
      }
    } else {
      List<TreeNodeImpl> children = root.childs.get(name);
      if (children != null) {
        for (TreeNode n : children) {
          if (hitted(n.getType(), ctxTypes)) {
            out.add(new ContextItemImpl(n.getPath(), n.getValue()));
          }
        }
      }
    }

    return out.toArray(new ContextItem[out.size()]);
  }
コード例 #6
0
ファイル: BasicTree.java プロジェクト: ubdsgroup/wglobe
 /** {@inheritDoc} */
 public boolean isNodeExpanded(TreeNode node) {
   return this.expandedNodes.contains(node.getPath());
 }