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


Java Graph.getDataProvider方法代码示例

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


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

示例1: hasComplementary

import y.base.Graph; //导入方法依赖的package包/类
/**
 * test if a strand starting with the given starting node CAN pair up with a
 * new complementary strand
 * 
 * @param startingNode
 * @return true: if each of the base node has free hydrogen bond connection,
 *         otherwise false.
 * @throws org.helm.notation.MonomerException
 * @throws org.jdom.JDOMException
 * @throws java.io.IOException
 */
private boolean hasComplementary(Node startingNode)
		throws MonomerException, JDOMException, IOException {
	NodeList baseList = SequenceGraphTools.getBaseList(startingNode,
			view.getGraph2D(), false);
	Node base = null;
	final Graph graph = view.getGraph2D();
	NodeMap nodeMap = (NodeMap) graph
			.getDataProvider(NodeMapKeys.MONOMER_REF);
	MonomerInfo monomerInfo = null;

	while (!baseList.isEmpty()) {
		base = baseList.popNode();
		monomerInfo = (MonomerInfo) nodeMap.get(base);
		if (monomerInfo.isConnected(monomerInfo
				.getAttachment(Attachment.PAIR_ATTACHMENT))) {
			return false;
		}
	}

	return true;

}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:34,代码来源:MacromoleculeEditor.java

示例2: getSingleOutEdge

import y.base.Graph; //导入方法依赖的package包/类
protected Edge getSingleOutEdge(Node n) {
	EdgeCursor edgeCursor = n.outEdges();
	Graph g = n.getGraph();
	EdgeMap type = (EdgeMap) g.getDataProvider(EdgeMapKeys.EDGE_INFO);

	for (; edgeCursor.ok(); edgeCursor.next()) {
		Edge e = edgeCursor.edge();
		EdgeInfo info = (EdgeInfo) type.get(e);
		if (info.isRegular()) {
			return e;
		}
	}

	return null;

}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:17,代码来源:AbstractSequenceTransformer.java

示例3: pairEdge

import y.base.Graph; //导入方法依赖的package包/类
public Edge pairEdge(Node sourceNode, Node targetNode, final Graph graph) {

		NodeMap nodeMap = (NodeMap) graph
				.getDataProvider(NodeMapKeys.MONOMER_REF);
		EdgeMap edgeMap = (EdgeMap) graph
				.getDataProvider(EdgeMapKeys.EDGE_INFO);
		MonomerInfo sourceMonomerInfo = (MonomerInfo) nodeMap.get(sourceNode);
		MonomerInfo targetMonomerInfo = (MonomerInfo) nodeMap.get(targetNode);

		Attachment sourceAttachment = sourceMonomerInfo
				.getAttachment(Attachment.PAIR_ATTACHMENT);
		Attachment targetAttachment = targetMonomerInfo
				.getAttachment(Attachment.PAIR_ATTACHMENT);

		if (!sourceMonomerInfo.isConnected(sourceAttachment)
				&& !targetMonomerInfo.isConnected(targetAttachment)) {
			sourceMonomerInfo.setConnection(sourceAttachment, true);
			targetMonomerInfo.setConnection(targetAttachment, true);

			Edge newEdge = graph.createEdge(sourceNode, targetNode);
			edgeMap.set(newEdge, new EditorEdgeInfoData(sourceAttachment,
					targetAttachment));

			return newEdge;
		}

		return null;
	}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:29,代码来源:EditorCreateEdgeMode.java

示例4: isFirstPeptideSequenceNode

import y.base.Graph; //导入方法依赖的package包/类
/**
 * test if the given node is the starting node of a peptide sequence
 * 
 * @param startingNode
 * @param graph
 * @return true or false
 * @throws org.helm.notation.MonomerException
 * @throws java.io.IOException
 * @throws org.jdom.JDOMException
 */
public static boolean isFirstPeptideSequenceNode(Node startingNode,
		Graph graph) throws MonomerException, IOException, JDOMException {
	final Map<String, Map<String, Monomer>> monomerDB = getMonomerDB();
	// final Map<String, Map<String, Monomer>> monomerDB = MonomerFactory
	// .getInstance().getMonomerDB();

	NodeMap monomerInfoMap = (NodeMap) graph
			.getDataProvider(NodeMapKeys.MONOMER_REF);
	MonomerInfo monomerInfo = (MonomerInfo) monomerInfoMap
			.get(startingNode);
	if (!monomerInfo.getPolymerType().equalsIgnoreCase(
			Monomer.PEPTIDE_POLYMER_TYPE)) {
		return false;
	}

	Monomer monomer = monomerDB.get(monomerInfo.getPolymerType()).get(
			monomerInfo.getMonomerID());
	if (!monomer.getMonomerType().equalsIgnoreCase(
			Monomer.BACKBONE_MOMONER_TYPE)) {
		return false;
	}

	NodeCursor predecessors = startingNode.predecessors();
	for (; predecessors.ok(); predecessors.next()) {
		monomerInfo = (MonomerInfo) monomerInfoMap.get(predecessors.node());
		monomer = monomerDB.get(monomerInfo.getPolymerType()).get(
				monomerInfo.getMonomerID());

		if (monomerInfo.getPolymerType().equalsIgnoreCase(
				Monomer.PEPTIDE_POLYMER_TYPE)
				&& monomer.getMonomerType().equalsIgnoreCase(
						Monomer.BACKBONE_MOMONER_TYPE)) {
			return false;
		}

	}
	return true;
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:49,代码来源:SequenceGraphTools.java

示例5: isLastPeptideSequenceNode

import y.base.Graph; //导入方法依赖的package包/类
/**
 * test if the given monomer is the last peptide sequence node
 * 
 * @param node
 * @param graph
 * @return true or false
 * @throws org.helm.notation.MonomerException
 * @throws java.io.IOException
 * @throws org.jdom.JDOMException
 */
public static boolean isLastPeptideSequenceNode(Node node, Graph graph)
		throws MonomerException, IOException, JDOMException {
	final Map<String, Map<String, Monomer>> monomerDB = getMonomerDB();

	// final Map<String, Map<String, Monomer>> monomerDB = MonomerFactory
	// .getInstance().getMonomerDB();
	NodeMap monomerInfoMap = (NodeMap) graph
			.getDataProvider(NodeMapKeys.MONOMER_REF);
	MonomerInfo monomerInfo = (MonomerInfo) monomerInfoMap.get(node);
	if (!monomerInfo.getPolymerType().equalsIgnoreCase(
			Monomer.PEPTIDE_POLYMER_TYPE)) {
		return false;
	}

	Monomer monomer = monomerDB.get(monomerInfo.getPolymerType()).get(
			monomerInfo.getMonomerID());
	if (!monomer.getMonomerType().equalsIgnoreCase(
			Monomer.BACKBONE_MOMONER_TYPE)) {
		return false;
	}

	NodeCursor successors = node.successors();
	for (; successors.ok(); successors.next()) {
		monomerInfo = (MonomerInfo) monomerInfoMap.get(successors.node());
		monomer = monomerDB.get(monomerInfo.getPolymerType()).get(
				monomerInfo.getMonomerID());

		if (monomerInfo.getPolymerType().equalsIgnoreCase(
				Monomer.PEPTIDE_POLYMER_TYPE)
				&& monomer.getMonomerType().equalsIgnoreCase(
						Monomer.BACKBONE_MOMONER_TYPE)) {
			return false;
		}

	}
	return true;
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:48,代码来源:SequenceGraphTools.java

示例6: getMonomerInfo

import y.base.Graph; //导入方法依赖的package包/类
public static Object getMonomerInfo(Node node, Object key) {
	Graph graph = node.getGraph();
	// TODO: why graph is null
	if (graph == null) {
		return null;
	}
	DataProvider map = graph.getDataProvider(key);
	return map.get(node);
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:10,代码来源:MonomerInfoUtils.java

示例7: sameSequence

import y.base.Graph; //导入方法依赖的package包/类
private boolean sameSequence(Graph graph, Node sourceNode, Node targetNode) {
	NodeMap node2hyperNode = (NodeMap) graph
			.getDataProvider(NodeMapKeys.NODE2PARENT_HYPERNODE);
	Node targetHyperNode = (Node) node2hyperNode.get(targetNode);
	Node sourceHyperNode = (Node) node2hyperNode.get(sourceNode);

	if ((targetHyperNode == null) || (sourceHyperNode == null)) {
		return false;
	}
	return targetHyperNode.equals(sourceHyperNode);
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:12,代码来源:EditorCreateEdgeMode.java

示例8: isBranchEdge

import y.base.Graph; //导入方法依赖的package包/类
public static boolean isBranchEdge(Edge e) {
	Graph g = e.getGraph();
	DataProvider info = g.getDataProvider(EdgeMapKeys.EDGE_INFO);
	if (info == null) {
		throw new IllegalArgumentException(
				"Graph does not contain edge info");
	}
	EdgeInfo einfo = (EdgeInfo) info.get(e);
	return einfo.isPBranchBackbone() || einfo.isPBranchBranch();
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:11,代码来源:MonomerInfoUtils.java

示例9: isBranchToBackboneEdge

import y.base.Graph; //导入方法依赖的package包/类
public static boolean isBranchToBackboneEdge(Edge e) {
	Graph g = e.getGraph();
	DataProvider info = g.getDataProvider(EdgeMapKeys.EDGE_INFO);
	if (info == null) {
		throw new IllegalArgumentException(
				"Graph does not contain edge info");
	}
	EdgeInfo einfo = (EdgeInfo) info.get(e);
	return einfo.isPBranchBackbone();
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:11,代码来源:MonomerInfoUtils.java

示例10: isBranchToBranchEdge

import y.base.Graph; //导入方法依赖的package包/类
public static boolean isBranchToBranchEdge(Edge e) {
	Graph g = e.getGraph();
	DataProvider info = g.getDataProvider(EdgeMapKeys.EDGE_INFO);
	if (info == null) {
		throw new IllegalArgumentException(
				"Graph does not contain edge info");
	}
	EdgeInfo einfo = (EdgeInfo) info.get(e);
	return einfo.isPBranchBranch();
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:11,代码来源:MonomerInfoUtils.java

示例11: isPInterSequencrEdge

import y.base.Graph; //导入方法依赖的package包/类
public static boolean isPInterSequencrEdge(Edge e) {
	Graph g = e.getGraph();
	NodeMap node2hypernode = (NodeMap) g
			.getDataProvider(NodeMapKeys.NODE2PARENT_HYPERNODE);
	if (node2hypernode == null) {
		throw new IllegalArgumentException(
				"Graph does not contain edge info");
	}
	return !node2hypernode.get(e.source()).equals(
			node2hypernode.get(e.target()))
			&& isPBranchEdge(e);
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:13,代码来源:MonomerInfoUtils.java

示例12: compare

import y.base.Graph; //导入方法依赖的package包/类
public int compare(final Node node1, final Node node2) {
	Graph graph = node1.getGraph();
	final NodeMap nodeNameMap = (NodeMap) graph
			.getDataProvider(NodeMapKeys.HYPERNODE_POLYMER_NOTATION);
	final NodeMap nodeTypeMap = (NodeMap) graph
			.getDataProvider(NodeMapKeys.HYPERNODE_POLYMER_TYPE);

	String type1 = (String) nodeTypeMap.get(node1);
	String type2 = (String) nodeTypeMap.get(node2);

	if (comparePolymerType(type1, type2) != 0) {
		return comparePolymerType(type1, type2);
	} else { // two node are of the same type
		if (parentNode != null) {
			Edge edge1 = parentNode.getEdge(node1);
			Edge edge2 = parentNode.getEdge(node2);

			EdgeMap edgeMap = (EdgeMap) graph
					.getDataProvider(EdgeMapKeys.DESCRIPTION);
			String edgeDesc1 = (String) edgeMap.get(edge1);
			String edgeDesc2 = (String) edgeMap.get(edge2);

			if (edgeDesc1.contains(Attachment.PAIR_ATTACHMENT)) {
				return -1;
			} else if (edgeDesc2.contains(Attachment.PAIR_ATTACHMENT)) {
				return 1;
			}
		}

		String name1 = (String) nodeNameMap.get(node1);
		String name2 = (String) nodeNameMap.get(node2);

		if (name1.compareToIgnoreCase(name2) != 0) {
			return name1.compareToIgnoreCase(name2);
		} else {
			return (node1.degree() - node2.degree());
		}
	}

}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:41,代码来源:NodeComparator.java

示例13: clearNodeMap

import y.base.Graph; //导入方法依赖的package包/类
private static NodeMap clearNodeMap(final Graph graph, Object key) {
	NodeMap nodeMap = (NodeMap) graph.getDataProvider(key);

	if (nodeMap != null) {
		graph.removeDataProvider(key);
	}
	nodeMap = graph.createNodeMap();
	graph.addDataProvider(key, nodeMap);
	return nodeMap;
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:11,代码来源:Graph2NotationTranslator.java

示例14: updateNodeStartingNodeMap

import y.base.Graph; //导入方法依赖的package包/类
private static void updateNodeStartingNodeMap(Graph graph, Graph hyperGraph) {
	NodeMap node2starting = (NodeMap) graph
			.getDataProvider(NodeMapKeys.NODE2STARTING_NODE);
	NodeMap parentNodeMap = (NodeMap) graph
			.getDataProvider(NodeMapKeys.NODE2PARENT_HYPERNODE);
	NodeMap hyper2starting = (NodeMap) hyperGraph
			.getDataProvider(NodeMapKeys.HYPERNODE2STARTING_NODE);

	for (Node n : graph.getNodeArray()) {
		Node hyperNode = (Node) parentNodeMap.get(n);
		Node starting = (Node) hyper2starting.get(hyperNode);
		node2starting.set(n, starting);
	}
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:15,代码来源:Graph2NotationTranslator.java

示例15: 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


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