/*
* Created on 2004/10/20
* Author aki@www.xucker.jpn.org
* License Apache2.0 or Common Public License
*/
package org.jpn.xucker.tab2tree;
import org.jpn.xucker.freemind.Map;
import org.jpn.xucker.freemind.Node;
import org.jpn.xucker.tree.StringTree;
/**
*
*
*/
public class StringTreeUtils {
private StringTreeUtils(){};
public static Map toFreeMind(StringTree tree){
Map map=new Map();
if(tree.countChildren()>0){
StringTree child=tree.getStringTreeAt(0);
Node node=new Node(child.getTitle());
map.addNode(node);
addChildren(node,child);
}
return map;
}
/**
* @param node
* @param child
*/
private static void addChildren(Node node, StringTree child) {
// TODO Auto-generated method stub
for(int i=0;i<child.countChildren();i++){
Node childNode=new Node(child.getStringTreeAt(i).getTitle());
node.addNode(childNode);
addChildren(childNode,child.getStringTreeAt(i));
}
}
}
|