• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Tree类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中prefuse.data.Tree的典型用法代码示例。如果您正苦于以下问题:Java Tree类的具体用法?Java Tree怎么用?Java Tree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Tree类属于prefuse.data包,在下文中一共展示了Tree类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: processHierarchy

import prefuse.data.Tree; //导入依赖的package包/类
/**
 * Processes the specified hierarchy, building hierarchy tree and creating instance table
 * used in visualizations.
 * 
 * @param hierarchy
 *            the hierarchy to process
 */
public void processHierarchy( HVConfig config )
{
	// TODO:
	// Might want to use some kind of algorithm to figure out optimal tree layout area?
	// 1024x1024 seems to work well enough for now.
	Pair<Tree, TreeLayoutData> treeData = HierarchyProcessor.buildHierarchyTree(
		mainHierarchy.getRoot(), 2048, 2048
	);
	hierarchyTree = treeData.getLeft();
	hierarchyTreeLayout = treeData.getRight();

	instanceTable = HierarchyProcessor.createInstanceTable(
		config, this, hierarchyTree
	);
}
 
开发者ID:kartoFlane,项目名称:hiervis,代码行数:23,代码来源:LoadedHierarchy.java


示例2: process

import prefuse.data.Tree; //导入依赖的package包/类
public void process(OutputStream out) throws Exception {
	Tree tree = new Tree();
	tree.addColumn("name", String.class);
	tree.addColumn(VisualItem.EXPANDED, Boolean.class);
	Node root = tree.addNode();
	root.set("name", "Root");
	genTree(tree, root, 5, 2);	
	
	
	CommonTreeView view = new CommonTreeView(tree, "name", 6);
	view.setSize(1440, 900);
	Thread.sleep(800);
	view.zoomToFit();
	Thread.sleep(800);
	view.saveImage(out, "JPG", 1);
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:17,代码来源:TemplateTree.java


示例3: GroupFileReader

import prefuse.data.Tree; //导入依赖的package包/类
public GroupFileReader(){
	t = new Tree();
	t.addColumn("group", String.class);
	t.addColumn("subnets", String.class);
	t.addColumn("x", float.class);
	t.addColumn("y", float.class);

	root = t.addRoot();
	root.setString("group", "Network");
	root.setString("subnets", null);

	local = t.addChild(root);
	local.setString("group", "Local Network");

	foreign = t.addChild(root);
	foreign.setString("group", "Foreign Network");
}
 
开发者ID:codydunne,项目名称:netgrok,代码行数:18,代码来源:GroupFileReader.java


示例4: XMLTreeGen

import prefuse.data.Tree; //导入依赖的package包/类
public XMLTreeGen(){
		t = new Tree();
		t.addColumn("group", String.class);
		t.addColumn("subnets", String.class);
//		t.addColumn("x", float.class);
//		t.addColumn("y", float.class);

		root = t.addRoot();
		root.setString("group", "Network");
		root.setString("subnets", null);

		local = t.addChild(root);
		local.setString("group", "Local Network");

		foreign = t.addChild(root);
		foreign.setString("group", "Foreign Network");
	}
 
开发者ID:codydunne,项目名称:netgrok,代码行数:18,代码来源:XMLTreeGen.java


示例5: getDiamondTree

import prefuse.data.Tree; //导入依赖的package包/类
/**
 * Create a diamond tree, with a given branching factor at
 * each level, and depth levels for the two main branches.
 * @param b the number of children of each branch node
 * @param d1 the length of the first (left) branch
 * @param d2 the length of the second (right) branch
 * @return the generated Tree
 */
public static Tree getDiamondTree(int b, int d1, int d2) {
    Tree t = new Tree();
    t.getNodeTable().addColumns(LABEL_SCHEMA);
    
    Node r = t.addRoot();
    r.setString(LABEL, "0,0");
    
    Node left = t.addChild(r);
    left.setString(LABEL, "1,0");
    Node right = t.addChild(r);
    right.setString(LABEL, "1,1");
    
    deepHelper(t, left, b, d1-2, true);
    deepHelper(t, right, b, d1-2, false);
    
    while ( left.getFirstChild() != null )
        left = left.getFirstChild();
    while ( right.getLastChild() != null )
        right = right.getLastChild();
    
    deepHelper(t, left, b, d2-1, false);
    deepHelper(t, right, b, d2-1, true);
    
    return t;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:34,代码来源:GraphLib.java


示例6: convertTree

import prefuse.data.Tree; //导入依赖的package包/类
private prefuse.data.Tree convertTree(Node root) {

		prefuse.data.Tree pTree = new prefuse.data.Tree();
		pTree.getNodeTable().addColumn("name", String.class);
		pTree.getNodeTable().addColumn("path", String.class);
		pTree.getNodeTable().addColumn("size", double.class);

		node = pTree.addRoot();
		node.set("name", root.getName());
		node.set("path", root.getPath());
		node.set("size", new Double(root.getSize()));

		buildTree(root, pTree);

		return pTree;
	}
 
开发者ID:jdepend,项目名称:cooper,代码行数:17,代码来源:TreeGraphUtil.java


示例7: createInstanceTable

import prefuse.data.Tree; //导入依赖的package包/类
public static TableEx createInstanceTable( HVConfig config, LoadedHierarchy hierarchy, Tree hierarchyTree )
{
	String[] dataNames = getFeatureNames( hierarchy );

	TableEx table = createEmptyInstanceTable( hierarchy.options, dataNames );
	processInstanceData( config, hierarchy, hierarchyTree, table );

	return table;
}
 
开发者ID:kartoFlane,项目名称:hiervis,代码行数:10,代码来源:HierarchyProcessor.java


示例8: processInstanceData

import prefuse.data.Tree; //导入依赖的package包/类
/**
 * Processes raw hierarchy data and saves it in the specified table.
 * 
 * @param config
 *            the application config
 * @param hierarchy
 *            the hierarchy to process
 * @param hierarchyTree
 *            the processed hierarchy tree
 * @param table
 *            the table the processed data will be saved in.
 */
private static void processInstanceData(
	HVConfig config,
	LoadedHierarchy hierarchy,
	Tree hierarchyTree, Table table )
{
	// TODO: Implement some sort of culling so that we remove overlapping instances?
	// Could use k-d trees maybe?

	for ( Instance instance : hierarchy.getMainHierarchy().getRoot().getSubtreeInstances() ) {
		int row = table.addRow();

		double[] data = instance.getData();
		for ( int i = 0; i < data.length; ++i ) {
			table.set( row, i, data[i] );
		}

		prefuse.data.Node node = findGroup( hierarchyTree, instance.getNodeId() );
		table.set( row, HVConstants.PREFUSE_INSTANCE_NODE_COLUMN_NAME, node );

		if ( hierarchy.options.hasTrueClassAttribute ) {
			table.set( row, HVConstants.PREFUSE_INSTANCE_TRUENODE_ID_COLUMN_NAME, instance.getTrueClass() );
		}

		if ( hierarchy.options.hasInstanceNameAttribute ) {
			table.set( row, HVConstants.PREFUSE_INSTANCE_LABEL_COLUMN_NAME, instance.getInstanceName() );
		}
	}
}
 
开发者ID:kartoFlane,项目名称:hiervis,代码行数:41,代码来源:HierarchyProcessor.java


示例9: findGroup

import prefuse.data.Tree; //导入依赖的package包/类
public static prefuse.data.Node findGroup( Tree hierarchyTree, String name )
{
	// TODO:
	// Can potentially speed this up by using a lookup cache in the form of a hash map.
	// Not sure if worth it, though.
	int nodeCount = hierarchyTree.getNodeCount();
	for ( int i = 0; i < nodeCount; ++i ) {
		prefuse.data.Node n = hierarchyTree.getNode( i );
		if ( n.getString( HVConstants.PREFUSE_NODE_ID_COLUMN_NAME ).equals( name ) ) {
			return n;
		}
	}

	return null;
}
 
开发者ID:kartoFlane,项目名称:hiervis,代码行数:16,代码来源:HierarchyProcessor.java


示例10: NodeSelectionControl

import prefuse.data.Tree; //导入依赖的package包/类
public NodeSelectionControl(
	Supplier<Tree> treeSupplier,
	Supplier<Integer> currentSelectionGetter,
	Consumer<Integer> currentSelectionSetter )
{
	this.treeSupplier = treeSupplier;
	this.getter = currentSelectionGetter;
	this.setter = currentSelectionSetter;
}
 
开发者ID:kartoFlane,项目名称:hiervis,代码行数:10,代码来源:NodeSelectionControl.java


示例11: genTree

import prefuse.data.Tree; //导入依赖的package包/类
private void genTree(Tree t, Node parent, int level, int child) {
	if (level == 0) {
		return;
	}
	for (int i = 0; i < child; i++) {
		Node n = t.addChild(parent);
		n.set("name", "Node[" + level + "," + child +"]");
		n.set(VisualItem.EXPANDED, true);
		genTree(t, n, level-1, child);
	}
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:12,代码来源:TemplateTree.java


示例12: CommonTreeView

import prefuse.data.Tree; //导入依赖的package包/类
public CommonTreeView(Tree t, String label) {
    super(new Visualization());
    m_label = label;
    m_vis.add(tree, t);
    
    init();
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:8,代码来源:CommonTreeView.java


示例13: getReferenceTree

import prefuse.data.Tree; //导入依赖的package包/类
public Tree getReferenceTree(String alias) {
	Tree t = new Tree();
	setupModel(t);
	CiBean bean = this.tModel.getBean(alias);
	if (bean == null) {
		System.out.println("Reference Tree Alias=" + alias + " is not found in " + tModel);
		return(t);
	}
	Node root = t.addRoot();
	root.set("alias", bean.getAlias());
	root.set("name", bean.getAlias());
	root.set("checked", true);
	buildDependecyTree(t, root, "/" + alias,bean);
	return(t);
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:16,代码来源:TemplateRelationGraphControl.java


示例14: addChild

import prefuse.data.Tree; //导入依赖的package包/类
private Node addChild(Tree t, Node parent, AttributeBean a, CiBean bean, boolean inBound) {
	Node child = t.addChild(parent);
	Edge e = child.getParentEdge();
	e.set("type", a.getRefType());
	e.set("inBound", inBound);
	updateData(child, bean, a, inBound);
	return(child);
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:9,代码来源:TemplateRelationGraphControl.java


示例15: TreeView

import prefuse.data.Tree; //导入依赖的package包/类
public TreeView(Tree t, String label) {
    super(new Visualization());
    m_label = label;
    m_vis.add(tree, t);
    
    init();
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:8,代码来源:TreeView.java


示例16: update

import prefuse.data.Tree; //导入依赖的package包/类
public void update() {
	Graph templateGraph = TemplateModel.get("Root").getTemplateGraph();
	
	Tree tree = templateGraph.getSpanningTree();
	
	JPrefuseTree.showTreeWindow(tree, "name");
	
	jtree = new JPrefuseTree(tree, "name");
	CheckBoxTreeRenderer render = new CheckBoxTreeRenderer();
	jtree.setCellRenderer(render);
	jtree.setEditable(true);
	
	NodTableEditor editor = new NodTableEditor();
	editor.setListener(new IEventListener() {

		public void onEvent(Event e) {
			EventDispatcher.fireEvent(this, new Event(CEvents.ITEM_MODIFIED, e.getData()));
		}
		
	});

	jtree.setCellEditor(editor);
	JTabbedPane tp = new JTabbedPane();
	tp.add(new JScrollPane(jtree), "Tree");
	tp.add(new TreeView(tree, "name"), "Tree View");
	
	
	add(tp, BorderLayout.CENTER);
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:30,代码来源:TemplateTree.java


示例17: initHierarchyTree

import prefuse.data.Tree; //导入依赖的package包/类
private void initHierarchyTree(Tuple root, Graph g)
{
	cluster_hierarchy = new Tree();
	cluster_hierarchy.addColumn("tuple_ref", Tuple.class);
	root_node = cluster_hierarchy.addRoot();
	root_node.set("tuple_ref",root_cluster);
	TupleSet graph_nodes = g.getNodes();
	Iterator graph_tuples_iter = graph_nodes.tuples();
	while(graph_tuples_iter.hasNext())
	{
		Tuple t = (Tuple)graph_tuples_iter.next();
		Node child = cluster_hierarchy.addChild(root_node);
		child.set("tuple_ref", t);
	}
}
 
开发者ID:codydunne,项目名称:netgrok,代码行数:16,代码来源:HostClusterTree.java


示例18: add

import prefuse.data.Tree; //导入依赖的package包/类
/**
 * Add a data set to this visualization, using the given data group name.
 * A visual abstraction of the data will be created and registered with
 * the visualization. An exception will be thrown if the group name is
 * already in use.
 * @param group the data group name for the visualized data
 * @param data the data to visualize
 * @param filter a filter Predicate determining which data Tuples in the
 * input data set are visualized
 * @return a visual abstraction of the input data, a VisualTupleSet
 * instance
 */
public synchronized VisualTupleSet add(
        String group, TupleSet data, Predicate filter)
{
    if ( data instanceof Table ) {
        return addTable(group, (Table)data, filter);
    } else if ( data instanceof Tree ) {
        return addTree(group, (Tree)data, filter);
    } else if ( data instanceof Graph ) {
        return addGraph(group, (Graph)data, filter);
    } else {
        throw new IllegalArgumentException("Unsupported TupleSet type.");
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:26,代码来源:Visualization.java


示例19: addTree

import prefuse.data.Tree; //导入依赖的package包/类
/**
 * Adds a tree to this visualization, using the given data group
 * name. A visual abstraction of the data will be created and registered
 * with the visualization. An exception will be thrown if the group name
 * is already in use.
 * @param group the data group name for the visualized tree. The nodes
 * and edges will be available in the "group.nodes" and "group.edges"
 * subgroups.
 * @param tree the tree to visualize
 * @param filter a filter Predicate determining which data Tuples in the
 * input graph are visualized
 * @param nodeSchema the data schema to use for the visual node table
 * @param edgeSchema the data schema to use for the visual edge table
 */
public synchronized VisualTree addTree(String group, Tree tree,
        Predicate filter, Schema nodeSchema, Schema edgeSchema)
{
	checkGroupExists(group); // check before adding sub-tables
    String ngroup = PrefuseLib.getGroupName(group, Graph.NODES); 
    String egroup = PrefuseLib.getGroupName(group, Graph.EDGES);
    
    VisualTable nt, et;
    nt = addTable(ngroup, tree.getNodeTable(), filter, nodeSchema);
    et = addTable(egroup, tree.getEdgeTable(), filter, edgeSchema);

    VisualTree vt = new VisualTree(nt, et, tree.getNodeKeyField(),
            tree.getEdgeSourceField(), tree.getEdgeTargetField());
    vt.setVisualization(this);
    vt.setGroup(group);
    
    addDataGroup(group, vt, tree);
    
    TupleManager ntm = new TupleManager(nt, vt, TableNodeItem.class);
    TupleManager etm = new TupleManager(et, vt, TableEdgeItem.class);
    nt.setTupleManager(ntm);
    et.setTupleManager(etm);
    vt.setTupleManagers(ntm, etm);
    
    return vt;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:41,代码来源:Visualization.java


示例20: getBalancedTree

import prefuse.data.Tree; //导入依赖的package包/类
/**
 * Returns a balanced tree of the requested breadth and depth.
 * @param breadth the breadth of each level of the tree
 * @param depth the depth of the tree
 * @return a balanced tree
 */
public static Tree getBalancedTree(int breadth, int depth) {
    Tree t = new Tree();
    t.getNodeTable().addColumns(LABEL_SCHEMA);
    
    Node r = t.addRoot();
    r.setString(LABEL, "0,0");
    
    if ( depth > 0 )
        balancedHelper(t, r, breadth, depth-1);
    return t;
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:18,代码来源:GraphLib.java



注:本文中的prefuse.data.Tree类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SourceTaskContext类代码示例发布时间:2022-05-22
下一篇:
Java AbstractSerializationsTester类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap