當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。