当前位置: 首页>>代码示例>>Java>>正文


Java Graph.getEdge方法代码示例

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


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

示例1: removeAttributeIsClickedFromAllGraphElements

import prefuse.data.Graph; //导入方法依赖的package包/类
/**
 * remove the attribute "is clicked" from all nodes and edges
 */
private void removeAttributeIsClickedFromAllGraphElements(Graph graph) {
	for (int i = 0; i < graph.getNodeCount(); i++) {
		Node node = graph.getNode(i);
		node.set(ColumnNames.IS_CLICKED, false);
	}
	for (int i = 0; i < graph.getEdgeCount(); i++) {
		Edge edge = graph.getEdge(i);
		edge.set(ColumnNames.IS_CLICKED, false);
	}
}
 
开发者ID:VisualDataWeb,项目名称:ProtegeVOWL,代码行数:14,代码来源:ControlListener.java

示例2: getSourceTuple

import prefuse.data.Graph; //导入方法依赖的package包/类
/**
 * Get the Tuple from a backing source data set that corresponds most
 * closely to the given VisualItem.
 * @param item the VisualItem for which to retreive the source tuple
 * @return the data source tuple, or null if no such tuple could
 * be found
 */
public Tuple getSourceTuple(VisualItem item) {
    // get the source group and tuple set, exit if none
    String group = item.getGroup();
    TupleSet source = getSourceData(group);
    if ( source == null ) return null;
    
    // first get the source table and row value
    int row = item.getRow();
    Table t = item.getTable();
    while ( t instanceof VisualTable ) {
        VisualTable vt = (VisualTable)t;
        row = vt.getParentRow(row);
        t   = vt.getParentTable();
    }
    
    // now get the appropriate source tuple
    // graphs maintain their own tuple managers so treat them specially
    String cgroup = PrefuseLib.getChildGroup(group);
    if ( cgroup != null ) {
        String pgroup = PrefuseLib.getParentGroup(group);
        Graph g = (Graph)getSourceData(pgroup);
        if ( t == g.getNodeTable() ) {
            return g.getNode(row);
        } else {
            return g.getEdge(row);
        }
    } else {
        return t.getTuple(row);
    }
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:38,代码来源:Visualization.java

示例3: create

import prefuse.data.Graph; //导入方法依赖的package包/类
/**
 * adds random data (nodes & connections) to a given GraphDataModifier
 *
 * @param graph (PrefuseGraph)
 * @return GraphDataModifier (PrefuseGraph) with random nodes and connections
 */
public Graph create(Graph graph) {

	graph = GraphAddColumnDefinition.addColumnDefinition(graph);

	Random rnd = new Random();

	// GraphDataModifier random Nodes with random data
	for (int i = 0; i <= COUNT_NODES; i++) {
		Node n = graph.addNode();
		// add random data (later use protege data)
		n.set(ColumnNames.ID, rnd.nextInt(25000));
		n.set(ColumnNames.NODE_HEIGHT, rnd.nextInt(35));
		n.set(ColumnNames.NODE_WIDTH, rnd.nextInt(35));
		n.set(ColumnNames.TEXT_SIZE, rnd.nextInt(12));
		n.set(ColumnNames.COLOR_RED, rnd.nextInt(250));
		n.set(ColumnNames.COLOR_GREEN, rnd.nextInt(250));
		n.set(ColumnNames.COLOR_BLUE, rnd.nextInt(250));
		n.set(ColumnNames.TEXT_COLOR_RED, rnd.nextInt(250));
		n.set(ColumnNames.TEXT_COLOR_GREEN, rnd.nextInt(250));
		n.set(ColumnNames.TEXT_COLOR_BLUE, rnd.nextInt(250));
		n.set(ColumnNames.TEXT_BACKGROUND_COLOR_RED, rnd.nextInt(250));
		n.set(ColumnNames.TEXT_BACKGROUND_COLOR_BLUE, rnd.nextInt(250));
		n.set(ColumnNames.TEXT_BACKGROUND_COLOR_GREEN, rnd.nextInt(250));
		n.set(ColumnNames.TEXT_BACKGROUND_STROKE_COLOR_RED, rnd.nextInt(250));
		n.set(ColumnNames.TEXT_BACKGROUND_STROKE_COLOR_BLUE, rnd.nextInt(250));
		n.set(ColumnNames.TEXT_BACKGROUND_STROKE_COLOR_GREEN, rnd.nextInt(250));
		n.setString(ColumnNames.NAME, "Node" + rnd.nextInt(100));
		n.setString(ColumnNames.FULL_NAME, "Node" + rnd.nextInt(100));
		n.set(ColumnNames.NODE_FORM, Nodetype.nodetype[rnd.nextInt(3)]);
		n.set(ColumnNames.NODE_VOWL_TYPE, Nodetype.vowltype[rnd.nextInt(3)]);
		n.set(ColumnNames.CLASS_INSTANCE_COUNT, rnd.nextInt(20));
	}

	// GraphDataModifier random connections
	for (int i = 0; i <= COUNT_CONNECTIONS; i++) {
		int a = rnd.nextInt(COUNT_NODES);
		int b = rnd.nextInt(COUNT_NODES);
		int edgeID = graph.addEdge(a, b);
		Edge edge = graph.getEdge(edgeID);
		edge.setString(ColumnNames.NAME, "Edge" + rnd.nextInt(100));
		edge.setString(ColumnNames.FULL_NAME, "Edge" + rnd.nextInt(100));
		edge.set(ColumnNames.TEXT_SIZE, rnd.nextInt(8));
		edge.set(ColumnNames.TEXT_COLOR_RED, rnd.nextInt(250));
		edge.set(ColumnNames.TEXT_COLOR_GREEN, rnd.nextInt(250));
		edge.set(ColumnNames.TEXT_COLOR_BLUE, rnd.nextInt(250));
		edge.set(ColumnNames.TEXT_BACKGROUND_COLOR_RED, rnd.nextInt(250));
		edge.set(ColumnNames.TEXT_BACKGROUND_COLOR_BLUE, rnd.nextInt(250));
		edge.set(ColumnNames.TEXT_BACKGROUND_COLOR_GREEN, rnd.nextInt(250));
		edge.set(ColumnNames.TEXT_BACKGROUND_STROKE_COLOR_RED, rnd.nextInt(250));
		edge.set(ColumnNames.TEXT_BACKGROUND_STROKE_COLOR_BLUE, rnd.nextInt(250));
		edge.set(ColumnNames.TEXT_BACKGROUND_STROKE_COLOR_GREEN, rnd.nextInt(250));
		edge.set(ColumnNames.COLOR_RED, rnd.nextInt(250));
		edge.set(ColumnNames.COLOR_GREEN, rnd.nextInt(250));
		edge.set(ColumnNames.COLOR_BLUE, rnd.nextInt(250));
		edge.set(ColumnNames.EDGE_ARROW_TYPE, EdgesType.arrowtype[rnd.nextInt(3)]);
		edge.set(ColumnNames.EDGE_LINE_TYPE, EdgesType.linetype[rnd.nextInt(3)]);
		edge.set(ColumnNames.ID, rnd.nextInt(25000));
		edge.set(ColumnNames.EDGE_LENGTH, rnd.nextInt(100));

	}

	return graph;
}
 
开发者ID:VisualDataWeb,项目名称:ProtegeVOWL,代码行数:70,代码来源:CreateRandomGraphData.java


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