當前位置: 首頁>>代碼示例>>Java>>正文


Java DataProvider類代碼示例

本文整理匯總了Java中y.base.DataProvider的典型用法代碼示例。如果您正苦於以下問題:Java DataProvider類的具體用法?Java DataProvider怎麽用?Java DataProvider使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DataProvider類屬於y.base包,在下文中一共展示了DataProvider類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initFromMap

import y.base.DataProvider; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void initFromMap() {
  try {
    setLineType(LineType.LINE_1);
    setLineColor(Color.RED);

    DataProvider cysBridgeMap = getEdge().getGraph().getDataProvider(AbConst.EDGE_TO_CONNECTION_KEY);
    CysteinConnection bridge = (CysteinConnection) cysBridgeMap.get(getEdge());
    super.setLabelText("Cys:Cys : " + bridge.getSourcePosition() + ":" + bridge.getTargetPosition());
    getLabel().setFontSize(8);

  } catch (Exception e) {
    // Not yet ready for initialization
  }
}
 
開發者ID:PistoiaHELM,項目名稱:HELMAntibodyEditor,代碼行數:19,代碼來源:CysBridgeEdgeRealizer.java

示例2: initFromMap

import y.base.DataProvider; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void initFromMap() {
  try {
    setLineColor(Color.BLUE);

    DataProvider cysBridgeMap = getEdge().getGraph().getDataProvider(AbConst.EDGE_TO_CONNECTION_KEY);
    GeneralConnection bridge = (GeneralConnection) cysBridgeMap.get(getEdge());
    super.setLabelText(bridge.getSourcePosition() + ":" + bridge.getSourceRest() + "-" + bridge.getTargetPosition()
        + ":" + bridge.getTargetRest());
    getLabel().setFontSize(8);
    
  } catch (Exception e) {
    // Not yet ready for initialization
  }
}
 
開發者ID:PistoiaHELM,項目名稱:HELMAntibodyEditor,代碼行數:19,代碼來源:GeneralConnectionEdgeRealizer.java

示例3: setFlipState

import y.base.DataProvider; //導入依賴的package包/類
public void setFlipState(NodeCursor nodeCursor, boolean isFlipped) {
	DataProvider node2LabelInfo = nodeCursor.node().getGraph()
			.getDataProvider(NodeMapKeys.LABEL_INFO_MAP);

	// TODO remove it
	if (node2LabelInfo == null)
		return;

	for (; nodeCursor.ok(); nodeCursor.next()) {
		LabelInfo labelInfo = (LabelInfo) node2LabelInfo.get(nodeCursor
				.node());
		if (labelInfo != null) {
			labelInfo.setFlipped(isFlipped);
		}
	}
}
 
開發者ID:PistoiaHELM,項目名稱:HELMEditor,代碼行數:17,代碼來源:AbstractLayoutPrimitives.java

示例4: getRNode

import y.base.DataProvider; //導入依賴的package包/類
/**
 * given a base node, find its R node
 * 
 * @param baseNode
 * @return node
 */
public Node getRNode(Node baseNode) {
	if (MonomerInfoUtils.isPeptidePolymer(baseNode)) {
		return baseNode;
	}

	DataProvider parentNodeMap = baseNode.getGraph().getDataProvider(
			NodeMapKeys.NODE2PARENT_HYPERNODE);

	NodeCursor predecessors = baseNode.predecessors();
	Node rNode = null;
	for (; predecessors.ok(); predecessors.next()) {
		if (MonomerInfoUtils.isRMonomer(predecessors.node())) {
			// double check if they belong to the same paprent hyper
			// startingNode
			if (parentNodeMap.get(predecessors.node()) == parentNodeMap
					.get(baseNode)) {
				// we got our R startingNode;
				rNode = predecessors.node();
				break;

			}
		}
	}
	return rNode;
}
 
開發者ID:PistoiaHELM,項目名稱:HELMEditor,代碼行數:32,代碼來源:EditorViewLayoutPrimitives.java

示例5: arrangeNodesVisualisationSettings

import y.base.DataProvider; //導入依賴的package包/類
@Override
public void arrangeNodesVisualisationSettings(Graph2D graph) {
	DataProvider labelInfoMap = graph
			.getDataProvider(NodeMapKeys.LABEL_INFO_MAP);
	if (labelInfoMap == null) {
		return;
	}
	// 5 and n labels
	for (Node node : graph.getNodeArray()) {
		LabelInfo labelInfo = (LabelInfo) labelInfoMap.get(node);
		if (labelInfo == null)
			continue;
		String terminalLabel = labelInfo.getTerminalLabel();
		if (terminalLabel != null
				&& MonomerInfoUtils.isAnnotation(terminalLabel)) {
			boolean isFlipped = labelInfo.isFlipped()
					&& !isPeptidePolymer(node);
			add5label(graph, node, terminalLabel, isFlipped);
		}
	}
}
 
開發者ID:PistoiaHELM,項目名稱:HELMEditor,代碼行數:22,代碼來源:EditorViewLayoutPrimitives.java

示例6: resetCysteinBridges

import y.base.DataProvider; //導入依賴的package包/類
/**
 * We delete all {@link CysteinConnection}, which are not an intraBridge. Attention: Each
 * {@link Graph2D#removeEdge(Edge)} fires an {@link GraphEvent} which is implemented in {@linkAntibodyEditorPane}. The
 * implementation removes the {@link CysteinConnection} from the {@link Antibody} model.
 * 
 * {@link Antibody}
 * 
 * @param graph
 */
public static void resetCysteinBridges(Graph2D graph) {
  DataProvider edgeToBridge = graph.getDataProvider(AbConst.EDGE_TO_CONNECTION_KEY);
  ConnectionService cs = ConnectionService.getInstance();
  Connection con;
  for (Edge curEdge : graph.getEdgeArray()) {
    con = (Connection) edgeToBridge.get(curEdge);
    if (edgeToBridge.get(curEdge) != null && con instanceof CysteinConnection) {
      CysteinConnection cysCon = (CysteinConnection) con;
      if (cs.isIntraDomainConnection(cysCon) && !cysCon.isHingeConnected()) {
        graph.removeEdge(curEdge);
      }
    }
  }
}
 
開發者ID:PistoiaHELM,項目名稱:HELMAntibodyEditor,代碼行數:24,代碼來源:AbstractGraphService.java

示例7: createEdge

import y.base.DataProvider; //導入依賴的package包/類
@Override
protected Edge createEdge(Graph2D graph, Node startNode, Node targetNode, EdgeRealizer realizer) {
  DataProvider nodeToDomain = graph.getDataProvider(AbConst.NODE_TO_SEQUENCE_KEY);
  CysteinConnection createdBridge = null;
  Domain source = (Domain) nodeToDomain.get(startNode);
  Domain target = (Domain) nodeToDomain.get(targetNode);
  // identify and handle IntraBridges
  if (isIntraEdge(source, target)) {
    if (isIntraCysConnectionAllowd(source)) {
      LOG.debug("IntraCysteinBridgeCreation identified. Operation is allowed!");
      createdBridge = createCysteinBridge(source, target);
    }
    else {
      return null;
    }
  } else if (isBridgeAllowd(source, target)) {
    LOG.debug("CysteinBridgeCeation between two different domains identified. Operation is allowed!");
    createdBridge = createCysteinBridge(source, target);
  }
  else {
    LOG.debug("No connection between domain allowed... removing edge!");
    return null;
  }

  if (createdBridge != null) {
    graph.firePreEvent();
    createdBridge.getSource().getAntibody().addConnection(createdBridge);
    EdgeMap map = (EdgeMap) graph.getDataProvider(AbConst.EDGE_TO_CONNECTION_KEY);
    Edge e = super.createEdge(graph, startNode, targetNode, new CysBridgeEdgeRealizer());
    map.set(e, createdBridge);
    graph.firePostEvent();
    return e;
  }
  return null;
}
 
開發者ID:PistoiaHELM,項目名稱:HELMAntibodyEditor,代碼行數:36,代碼來源:CysteinBridgeEdgeMode.java

示例8: acceptTargetNode

import y.base.DataProvider; //導入依賴的package包/類
@Override
protected boolean acceptTargetNode(Node target, double x, double y) {
  DataProvider sequenceMap = target.getGraph().getDataProvider(AbConst.NODE_TO_SEQUENCE_KEY);
  if (sequenceMap.get(target) instanceof Domain) {
    return true;
  }
  return false;
}
 
開發者ID:PistoiaHELM,項目名稱:HELMAntibodyEditor,代碼行數:9,代碼來源:CysteinBridgeEdgeMode.java

示例9: acceptSourceNode

import y.base.DataProvider; //導入依賴的package包/類
@Override
protected boolean acceptSourceNode(Node source, double x, double y) {
  DataProvider sequenceMap = source.getGraph().getDataProvider(AbConst.NODE_TO_SEQUENCE_KEY);
  if (sequenceMap.get(source) instanceof Domain) {
    return true;
  }
  return false;
}
 
開發者ID:PistoiaHELM,項目名稱:HELMAntibodyEditor,代碼行數:9,代碼來源:CysteinBridgeEdgeMode.java

示例10: nodeClicked

import y.base.DataProvider; //導入依賴的package包/類
@Override
// we show/update the property-table if a domain was selected
protected void nodeClicked(Graph2D graph, Node node, boolean wasSelected, double x, double y, boolean modifierSet) {
  DataProvider nodeToDomain = graph.getDataProvider(AbConst.NODE_TO_SEQUENCE_KEY);
  if (nodeToDomain.get(node) instanceof Domain) {
    viewDialog.updatePane(((Domain) nodeToDomain.get(node)));
  }
  else {
    viewDialog.updatePane(null);
  }
  super.nodeClicked(graph, node, wasSelected, x, y, modifierSet);
}
 
開發者ID:PistoiaHELM,項目名稱:HELMAntibodyEditor,代碼行數:13,代碼來源:AntibodyEditMode.java

示例11: acceptEdge

import y.base.DataProvider; //導入依賴的package包/類
@Override
protected boolean acceptEdge(Graph2D graph, Edge edge) {
  // only delete edges, which have a model attached (cysteinbridges).
  boolean readyToDelete = super.acceptEdge(graph, edge);
  DataProvider map = graph.getDataProvider(AbConst.EDGE_TO_CONNECTION_KEY);
  if (map.get(edge) != null) {
    return readyToDelete & true;
  }
  return false;
}
 
開發者ID:PistoiaHELM,項目名稱:HELMAntibodyEditor,代碼行數:11,代碼來源:GraphDeleteAction.java

示例12: acceptNode

import y.base.DataProvider; //導入依賴的package包/類
@Override
protected boolean acceptNode(Graph2D graph, Node node) {
  boolean readyToDelete = super.acceptNode(graph, node);
  LOG.trace("Node selected: {} -> {} readyToDelete: {}", node, graph.isSelected(node), readyToDelete);
  DataProvider deletable = graph.getDataProvider(AbConst.NODE_DELETABLE_KEY);
  if (deletable.getBool(node)) {
    return readyToDelete & true;
  }
  return false;
}
 
開發者ID:PistoiaHELM,項目名稱:HELMAntibodyEditor,代碼行數:11,代碼來源:GraphDeleteAction.java

示例13: onGraphEvent

import y.base.DataProvider; //導入依賴的package包/類
@Override
public void onGraphEvent(GraphEvent e) {
  // we catch the delete event of an edge. and remove the CysteinBridge
  // from the Model.
  if (e.getType() == GraphEvent.POST_EDGE_REMOVAL) {
    Edge removedEdge = (Edge) e.getData();
    DataProvider edgeToBridge = e.getGraph().getDataProvider(AbConst.EDGE_TO_CONNECTION_KEY);
    Connection bridgeToDelete = (Connection) edgeToBridge.get(removedEdge);
    // can be null, if Edge is a Backbone. This is a logical connection.
    // but it is not contained in the model.
    if (bridgeToDelete != null) {
      antibody.removeConnection(bridgeToDelete);
    }
    updateGraphLayout();
  }

  if (e.getType() == GraphEvent.POST_NODE_REMOVAL) {
    Node removedNode = (Node) e.getData();
    DataProvider nodeToSequence = e.getGraph().getDataProvider(
        AbConst.NODE_TO_SEQUENCE_KEY);
    Sequence seqToDelete = (Sequence) nodeToSequence.get(removedNode);
    AntibodyService.getInstance().removeSequence(seqToDelete, antibody);
    updateGraphLayout();
  }

  if (e.getType() == GraphEvent.EDGE_CREATION
      || e.getType() == GraphEvent.NODE_CREATION) {
    updateGraphLayout();
  }
}
 
開發者ID:PistoiaHELM,項目名稱:HELMAntibodyEditor,代碼行數:31,代碼來源:AntibodyEditorPane.java

示例14: checkDistance

import y.base.DataProvider; //導入依賴的package包/類
public static boolean checkDistance(Node node1, Node node2, Graph graph,
		boolean ifPairEdgeAdded) {
	GraphHider graphHider = null;
	if (ifPairEdgeAdded) {
		// hide pair edges and find all sequences
		graphHider = new GraphHider(graph);
		for (Edge edge : graph.getEdgeArray()) {
			DataProvider edgeTypeMap = graph
					.getDataProvider(EdgeMapKeys.EDGE_INFO);
			if (((EdgeInfo) edgeTypeMap.get(edge)).isPair()) {
				graphHider.hide(edge);
			}
		}
	}

	NodeList neighbours = GraphConnectivity.getNeighbors(graph,
			new NodeList(node1),
			ifPairEdgeAdded ? MINIMAL_DISTANCE_PAIRED_NODES
					: MINIMAL_NODES_DISTANCE);

	if (ifPairEdgeAdded) {
		graphHider.unhideAll();
	}

	// if neighbours contains node2 then the distance is less than
	// acceptable
	return !neighbours.contains(node2);
}
 
開發者ID:PistoiaHELM,項目名稱:HELMEditor,代碼行數:29,代碼來源:SequenceGraphTools.java

示例15: getMonomerInfo

import y.base.DataProvider; //導入依賴的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


注:本文中的y.base.DataProvider類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。