@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()]);
  }
  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()]);
  }
 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;
       }
     }
   }
 }
 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;
       }
     }
   }
 }
  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()]);
  }
Beispiel #6
0
 /** {@inheritDoc} */
 public boolean isNodeExpanded(TreeNode node) {
   return this.expandedNodes.contains(node.getPath());
 }