Ejemplo n.º 1
0
 public void iterateTopNodesForFile(String _filePath, IndexEntriesWalkerInterruptable iproc) {
   String filePath = _filePath.replace(' ', '?').replace('\\', '|').replace('/', '|');
   FileEntitiesHolder fileHolder = files.get(filePath);
   if (fileHolder != null) {
     for (TreeNodeTop d : fileHolder.nodes) {
       if (!iproc.process(d.getPath(), d.getValue())) {
         return;
       }
     }
   }
 }
Ejemplo n.º 2
0
 protected TreeNodeTop findChildByEncodedName(String encodedName, String filePath) {
   String name = encodedName.substring(7, encodedName.length());
   List<TreeNodeImpl> lst = childs.get(name);
   if (lst != null) {
     for (TreeNodeImpl node : lst) {
       TreeNodeTop top = (TreeNodeTop) node;
       if (top.getName().equals(encodedName) && top.getParentPath().equals(filePath)) {
         return top;
       }
     }
   }
   return null;
 }
Ejemplo n.º 3
0
  private TreeNode addTopNode(TreeNodeImpl _root, int type, String encodedName, String filePath) {
    String name = encodedName.substring(7, encodedName.length());

    List<TreeNodeImpl> lst = _root.childs.get(name);
    if (lst == null) {
      lst = new ArrayList<TreeNodeImpl>();
      _root.childs.put(name, lst);
    }

    FileEntitiesHolder fh = files.get(filePath);
    if (fh == null) {
      fh = new FileEntitiesHolder(filePath);
      files.put(filePath, fh);
    }

    TreeNodeTop node = new TreeNodeTop(_root, encodedName, fh);
    node.type = type;
    lst.add(node);

    return node;
  }
Ejemplo n.º 4
0
 public void removeNodeByEncodedName(TreeNodeTop[] toDelete) {
   for (TreeNodeTop top : toDelete) {
     String name = top.getName().substring(7);
     List<TreeNodeImpl> lst = root.childs.get(name);
     if (lst != null) {
       Iterator<TreeNodeImpl> iterator = lst.iterator();
       while (iterator.hasNext()) {
         TreeNodeTop n = (TreeNodeTop) iterator.next();
         if (n.getName().equals(top.getName()) && n.owner.filePath.equals(top.owner.filePath)) {
           n.dispose();
           iterator.remove();
         }
       }
       // todo -- do we need "remove" above and "put" below if lst.size()> 0
       if (lst.size() == 0) {
         root.childs.remove(name);
       }
     }
   }
 }