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


Java Graph.edges方法代码示例

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


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

示例1: appendEdgesWithCondition

import y.base.Graph; //导入方法依赖的package包/类
public static String appendEdgesWithCondition(Graph hyperGraph,
		Map<Node, String> nameMap, Condition condition) {

	StringBuilder notation = new StringBuilder();

	EdgeMap hyperEdgeMap = (EdgeMap) hyperGraph
			.getDataProvider(EdgeMapKeys.DESCRIPTION);
	EdgeCursor edges = hyperGraph.edges();
	int edgeCount = 0;

	for (; edges.ok(); edges.next()) {
		String edgeDesc = (String) hyperEdgeMap.get(edges.edge());

		boolean conditionValue = condition
				.condition(new Object[] { edgeDesc });
		if (edgeCount > 0 && conditionValue) {
			notation.append(NotationCompositor.NOTATION_DELIMETER);
		}

		if (conditionValue) {

			Node sourceNode = edges.edge().source();
			Node targetNode = edges.edge().target();

			notation.append(nameMap.get(sourceNode));
			notation.append(NotationCompositor.NOTATION_COMMA);
			notation.append(nameMap.get(targetNode));
			notation.append(NotationCompositor.NOTATION_COMMA);
			notation.append(edgeDesc);

			edgeCount++;
		}

	}

	return notation.toString();
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:38,代码来源:RegularEdgesCreator.java

示例2: getSelectedGraphManager

import y.base.Graph; //导入方法依赖的package包/类
public static GraphManagerInfo getSelectedGraphManager(GraphData graphData)
		throws IOException, MonomerException, JDOMException {

	GraphManagerInfo graphManagerInfo = new GraphManagerInfo();

	GraphManager selectedGraphManager = new GraphManager();

	// MonomerInfo monomerInfo = graphData.getMonomerInfo();
	NodeMap newMonomerInfoMap = graphData.getNewMonomerInfoMap();

	Graph graph = graphData.getGraph();

	Node newNode = null;
	Monomer monomer = null;
	NodeList specialBases = new NodeList();

	// GraphCopier gc = new GraphCopier();
	// Graph temp = gc.copy(graph, nodes);

	GraphHider gh = new GraphHider(graph);

	// hide pairings and chem edges
	EdgeMap edgeMap = (EdgeMap) graph
			.getDataProvider(EdgeMapKeys.EDGE_INFO);
	for (EdgeCursor ec = graph.edges(); ec.ok(); ec.next()) {
		Edge e = ec.edge();
		EdgeInfo einfo = (EdgeInfo) edgeMap.get(e);
		if (einfo.isPair()) {
			gh.hide(ec.edge());
		}
		if (MonomerInfoUtils.isChemicalModifierPolymer(e.source())
				|| MonomerInfoUtils.isChemicalModifierPolymer(e.target())) {
			gh.hide(e);
		}
		if (MonomerInfoUtils.isPBranchEdge(e)) {
			gh.hide(e);
		}
	}

	for (NodeCursor nodes = graph.nodes(); nodes.ok(); nodes.next()) {
		newNode = nodes.node();
		MonomerInfo monomerInfo = (MonomerInfo) newMonomerInfoMap.get(nodes
				.node());
		monomer = GraphUtils.getMonomerDB()
				.get(monomerInfo.getPolymerType())
				.get(monomerInfo.getMonomerID());
		if (newNode.inDegree() == 0) {
			if (monomer != null
					&& MonomerInfoUtils.isBranchMonomer(monomer)) {
				specialBases.add(newNode);
			} else {
				selectedGraphManager.addStartingNode(nodes.node());
			}
		}

	}

	NodeList[] components = GraphConnectivity.connectedComponents(graph);

	for (NodeList component : components) {
		GraphCopier gc = new GraphCopier();
		Graph temp = gc.copy(graph, component.nodes());
		if (GraphChecker.isCyclic(temp)) {
			selectedGraphManager.addStartingNode(component.firstNode());
		}
	}

	gh.unhideAll();

	graphManagerInfo.setGraphManager(selectedGraphManager);
	graphManagerInfo.setSpecialBases(specialBases);

	return graphManagerInfo;
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:75,代码来源:GraphSelection.java


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