- Timestamp:
- 2003-12-08T17:08:47+13:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/file/FileSystemModel.java
r5785 r6176 49 49 /** Retrieve the node denoted by the given tree path. Note that this isn't equivelent to saying path.lastPathComponent, as the references within the path may be stale. */ 50 50 public FileNode getNode(TreePath path) { 51 /// ystem.err.println("**** getNode(" + path + ") ****");51 ///atherer.println("**** getNode(" + path + ") ****"); 52 52 FileNode current = (FileNode)root; 53 53 // Special case for the root node. Check the first path component is the root node. 54 54 FileNode first_node = (FileNode)path.getPathComponent(0); 55 55 if(current.equals(first_node)) { 56 ///ystem.err.println("First path component matches root node.");57 56 ///atherer.println("First path component matches root node."); 57 // For each path with this tree path 58 58 for(int i = 1; current != null && i < path.getPathCount(); i++) { 59 59 // Retrieve the stale path 60 60 FileNode stale_node = (FileNode) path.getPathComponent(i); 61 /// ystem.err.print("Searching for '" + stale_node + "': ");61 ///atherer.print("Searching for '" + stale_node + "': "); 62 62 // Locate the fresh node by searching current's children. Remember to ensure that current is mapped. 63 63 current.map(); 64 64 boolean found = false; 65 66 // First we search through the mapped children 65 67 for(int j = 0; !found && j < current.getChildCount(); j++) { 66 68 FileNode child_node = (FileNode) current.getChildAt(j); 67 /// ystem.err.print(child_node + " ");69 ///atherer.print(child_node + " "); 68 70 if(stale_node.equals(child_node)) { 69 71 found = true; 70 72 current = child_node; 71 ///ystem.err.println("Found!"); 73 ///atherer.println("Found!"); 74 } 75 child_node = null; 76 } 77 // Failing that we search through all the children, including filtered files 78 for(int j = 0; !found && j < current.size(); j++) { 79 FileNode child_node = (FileNode) current.get(j); 80 ///atherer.print(child_node + " "); 81 if(stale_node.equals(child_node)) { 82 found = true; 83 current = child_node; 84 ///atherer.println("Found!"); 72 85 } 73 86 child_node = null; … … 76 89 if(!found) { 77 90 current = null; 78 /// ystem.err.println("Not Found!");91 ///atherer.println("Not Found!"); 79 92 } 80 93 // Repeat as necessary 81 94 } 82 95 } 83 /// ystem.err.println("Returning node: " + new TreePath(current.getPath()));96 ///atherer.println("Returning node: " + new TreePath(current.getPath())); 84 97 return current; 85 98 }
Note:
See TracChangeset
for help on using the changeset viewer.