本文整理汇总了Java中edu.uci.ics.jung.graph.Tree.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java Tree.getChildren方法的具体用法?Java Tree.getChildren怎么用?Java Tree.getChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.uci.ics.jung.graph.Tree
的用法示例。
在下文中一共展示了Tree.getChildren方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: print
import edu.uci.ics.jung.graph.Tree; //导入方法依赖的package包/类
private static void print( Tree<Parameter, Integer> tree, Parameter node ) {
if ( log.isDebugEnabled() ) {
StringBuilder sb = new StringBuilder( "Parameter Tree:" );
int depth = tree.getDepth( node );
for ( int i = 0; i < depth; i++ ) {
sb.append( " " );
}
sb.append( tree.getRoot().equals( node ) ? "<root>" : node );
log.debug( sb.toString() );
for ( Parameter p : tree.getChildren( node ) ) {
print( tree, p );
}
}
}
示例2: printTree
import edu.uci.ics.jung.graph.Tree; //导入方法依赖的package包/类
public static <V, E> void printTree( V root,
Tree<V, E> tree, int depth ) {
StringBuilder sb = new StringBuilder();
for ( int i = 0; i < depth; i++ ) {
sb.append( " " );
}
sb.append( root );
log.debug( sb.toString() );
for ( V child : tree.getChildren( root ) ) {
printTree( child, tree, depth + 1 );
}
}
示例3: fillInCombos
import edu.uci.ics.jung.graph.Tree; //导入方法依赖的package包/类
private void fillInCombos( Tree<Parameter, Integer> tree ) {
// we only need to run queries for the toplevel parameters, because
// everything else is handled by the item listener
for ( Parameter p : tree.getChildren( tree.getRoot() ) ) {
requery( p );
}
}
示例4: printCluster
import edu.uci.ics.jung.graph.Tree; //导入方法依赖的package包/类
private void printCluster(Tree<ClusterVO, ItemAssocVO<Integer,Integer>> tree, ClusterVO vertex) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < tree.getDepth(vertex); i++) {
sb.append(" ");
}
logger.info(sb.toString() + vertex.getName());
Collection<ClusterVO> children = tree.getChildren(vertex);
for (ClusterVO clusterVO : children) {
printCluster(tree, clusterVO);
}
}
示例5: writeNode
import edu.uci.ics.jung.graph.Tree; //导入方法依赖的package包/类
private ClusterNode writeNode(Tree<ClusterVO, ItemAssocVO<Integer,Integer>> tree,
ClusterVO node, ClusterVO root) {
ClusterNode n = new ClusterNode();
n.setData(node.getName());
NodeAttributes na = new NodeAttributes(node.getName(), node.getDescription() == null ? node.getName() : node.getDescription());
n.setAttr(na);
if (node == root) {
n.setRel("root");
}
if (!Strings.isNullOrEmpty(node.getDescription())) {
n.setDescription(node.getDescription());
}
Collection<ClusterVO> children = tree.getChildren(node);
if (children.size() > 0) {
ArrayList<ClusterNode> childNodes = new ArrayList<>();
for (ClusterVO child : children) {
ClusterNode cn = writeNode(tree,child, root);
childNodes.add(cn);
}
n.setChildren(childNodes);
}
return n;
}
示例6: writeNode
import edu.uci.ics.jung.graph.Tree; //导入方法依赖的package包/类
private void writeNode(Tree<ClusterVO, ItemAssocVO<Integer,Integer>> tree,
ClusterVO node, JSONWriter writer, ClusterVO root) throws JSONException {
writer.object()
.key("data").value(node.getName())
.key("attr")
.object()
.key("id")
.value(node.getName())
.key("title")
.value(node.getDescription() == null ? node.getName() : node.getDescription());
if (node == root)
writer.key("rel").value("root");
writer.endObject();
if (!Strings.isNullOrEmpty(node.getDescription()))
writer.key("description").value(node.getDescription());
Collection<ClusterVO> children = tree.getChildren(node);
if (children.size() > 0) {
writer.key("children")
.array();
for (ClusterVO child : children) {
writeNode(tree, child, writer, root);
}
writer.endArray();
}
writer.endObject();
}