コード例 #1
0
 /**
  * recurse through the old datatree and construct the new data tree
  *
  * @param dataTree the new datatree to be constructed
  * @param path the path to start with
  */
 private void recurseThroughDataTree(DataTree dataTree, String path) {
   if (path == null) return;
   DataNodeV1 oldDataNode = oldDataTree.getNode(path);
   HashSet<String> children = oldDataNode.children;
   DataNode parent = null;
   if ("".equals(path)) {
     parent = null;
   } else {
     int lastSlash = path.lastIndexOf('/');
     String parentPath = path.substring(0, lastSlash);
     parent = dataTree.getNode(parentPath);
   }
   DataNode thisDatNode = convertDataNode(dataTree, parent, oldDataNode);
   dataTree.addDataNode(path, thisDatNode);
   if (children == null || children.size() == 0) {
     return;
   } else {
     for (String child : children) {
       recurseThroughDataTree(dataTree, path + "/" + child);
     }
   }
 }
コード例 #2
0
 /**
  * get the datanode for this path
  *
  * @param path the path to lookup
  * @return the datanode for getting the path
  */
 public DataNode getNode(String path) {
   return dataTree.getNode(path);
 }