/** * Create Hashkey for Edges. * * @param node1 First node. * @param node2 Second node. * @return HashKey. */ private String createEdgeKey(Node node1, Node node2, Interaction interaction) { String node1Ident = node1.getIdentifier(); String node2Ident = node2.getIdentifier(); String interactionType = getInteractionTypeId(interaction); return new String(node1Ident + interactionType + node2Ident); }
/** * DOCUMENT ME! * * @param node DOCUMENT ME! * * @return DOCUMENT ME! */ public int getIndex(Node node) { if (node.getRootGraph() == this) return node.getRootGraphIndex(); else return 0; }
if (Cytoscape.getRootGraph().getEdgeCount() != 0) { int[] n1Edges = Cytoscape.getRootGraph() .getAdjacentEdgeIndicesArray(source.getRootGraphIndex(), true, true, true); CyNode edgeSource = (CyNode) edge.getSource(); if ((edgeTarget.getRootGraphIndex() == target.getRootGraphIndex()) && (edgeSource.getRootGraphIndex() == source.getRootGraphIndex())) { return edge; if ((edgeTarget.getRootGraphIndex() == source.getRootGraphIndex()) && (edgeSource.getRootGraphIndex() == target.getRootGraphIndex())) { return edge; String edge_name = CyEdge.createIdentifier(source.getIdentifier(), (String) attribute_value, target.getIdentifier()); edge.setIdentifier(edge_name);
int rootIndex = node.getRootGraphIndex(); GraphView graphView = node_view.getGraphView(); GraphPerspective gp = graphView.getGraphPerspective(); GraphPerspective childGP = node.getGraphPerspective(); throw new IllegalStateException("Node " + node.getIdentifier() + " has a non-empty array " + " of children-node indices, but, it has no child GraphPerspective"); NodeView childNV = graphView.getNodeView(childNode.getRootGraphIndex());
GraphPerspectiveNodesHiddenEvent(Object source, Node[] hiddenNodes) { super(source); m_hiddenNodes = hiddenNodes; m_hiddenNodeInx = new int[m_hiddenNodes.length]; for (int i = 0; i < m_hiddenNodeInx.length; i++) m_hiddenNodeInx[i] = m_hiddenNodes[i].getRootGraphIndex(); }
node = Cytoscape.getCyNode(label, true); if (nodeLabels.get(idx) != null) nodeAttr.setAttribute(node.getIdentifier(), LABEL, nodeLabels.get(idx)); if (nodeNames.get(idx) != null) nodeAttr.setAttribute(node.getIdentifier(), NAME, nodeNames .get(idx)); giny_nodes.add(node.getRootGraphIndex()); nodeIDMap.put(nodes.get(idx), node.getRootGraphIndex()); gml_id2order.put(nodes.get(idx), idx); ((KeyValue) node_root_index_pairs.get(idx)).value = (new Integer( node.getRootGraphIndex())); } else { throw new GMLException("GML id " + nodes.get(idx)
/** * DOCUMENT ME! * * @param source DOCUMENT ME! * @param target DOCUMENT ME! * * @return DOCUMENT ME! */ public int createEdge(Node source, Node target) { return createEdge(source, target, source.getRootGraphIndex() != target.getRootGraphIndex()); }
private String buildStringQuery() { final StringBuilder builder = new StringBuilder(); final Set<Node> selectedNodes = Cytoscape.getCurrentNetwork().getSelectedNodes(); for (Node node : selectedNodes) { builder.append(node.getIdentifier() + " "); } return builder.toString(); }
public int nextInt() { if ((nodeArr[index] == null) || (nodeArr[index].getRootGraph() != root)) throw new IllegalArgumentException(); return nodeArr[index++].getRootGraphIndex(); } },
currentGML.addMapping("id", new GMLNode("" + (-currentNode.getRootGraphIndex()))); String name = currentView.getNode().getIdentifier(); new GMLNode("" + (-currentEdge.getSource().getRootGraphIndex()))); currentGML.addMapping("target", new GMLNode("" + (-currentEdge.getTarget().getRootGraphIndex())));
/** * Return the requested Attribute for the given Node * @param node the given CyNode * @param attribute the name of the requested attribute * @return the value for the give node, for the given attribute */ public Object getNodeAttributeValue(Node node, String attribute) { return getNodeAttributeValue(node.getRootGraphIndex(), attribute); }
/** * Return all the terms in this ontology.<br> * * @return All ontology terms as Set object. */ public Set getTerms() { Set<Term> terms = new HashSet<Term>(); Iterator nodeIt = ontologyGraph.nodesIterator(); while (nodeIt.hasNext()) { final Node node = (Node) nodeIt.next(); final String id = node.getIdentifier(); final Term term = new OntologyTerm(node.getIdentifier(), this.name, termAttr.getStringAttribute(id, OBOTags.DEF.toString())); terms.add(term); } return terms; }
public int nextInt() { if ((nodeArr[index] == null) || (nodeArr[index].getRootGraph() != root)) throw new IllegalArgumentException(); return nodeArr[index++].getRootGraphIndex(); } },
/** * Return the requested Attribute for the given Node * @param node the given CyNode * @param attribute the name of the requested attribute * @param value the value to be set * @return if it overwrites a previous value */ public boolean setNodeAttributeValue(Node node, String attribute, Object value) { return setNodeAttributeValue(node.getRootGraphIndex(), attribute, value); }
/** * @param nodeView The clicked NodeView * @param menu popup menu to add the Bypass menu */ public void addNodeContextMenuItems(NodeView nodeView, JPopupMenu menu) { NodeBypass nb = new NodeBypass(); if (menu == null) menu = new JPopupMenu(); /* * Add Node ID as label. */ final String nodeID = nodeView.getNode().getIdentifier(); final JLabel nodeLabel = new JLabel(nodeID); nodeLabel.setForeground(new Color(10, 50, 250, 150)); nodeLabel.setFont(new Font("SansSerif", Font.BOLD, 18)); nodeLabel.setBorder(new EmptyBorder(5, 10, 5, 5)); menu.add(nodeLabel); menu.add(nb.addMenu(nodeView.getNode())); } }
/** * DOCUMENT ME! * * @param parent DOCUMENT ME! * @param child DOCUMENT ME! * * @return DOCUMENT ME! */ public boolean addMetaChild(Node parent, Node child) { if ((parent.getRootGraph() != this) || (child.getRootGraph() != this)) return false; return addNodeMetaChild(parent.getRootGraphIndex(), child.getRootGraphIndex()); }
/** * Makes nodes request overtime pay. * @param networkList a list of cyNetworks * @return an integer array containing the indices of nodes in the union */ protected static int[] unionizeNodes(List networkList) { /* * This is the set of nodes that will be in the final merged network */ Set<Integer> nodes = new HashSet<Integer>(); for (Iterator it = networkList.iterator(); it.hasNext();) { CyNetwork currentNetwork = (CyNetwork) it.next(); for (Iterator nodeIt = currentNetwork.nodesIterator(); nodeIt.hasNext();) { nodes.add(new Integer(((Node) nodeIt.next()).getRootGraphIndex())); } } int[] result = new int[nodes.size()]; int idx = 0; for (Iterator nodeIt = nodes.iterator(); nodeIt.hasNext(); idx++) { result[idx] = ((Integer) nodeIt.next()).intValue(); } return result; }
public SetNestedNetworkDialog(JFrame parent, boolean modal, NodeView nodeView) { super(parent, "Set Nested Network for " + nodeView.getNode().getIdentifier(), modal); init(nodeView); }
/** * DOCUMENT ME! * * @param child DOCUMENT ME! * @param parent DOCUMENT ME! * * @return DOCUMENT ME! */ public boolean isMetaParent(Node child, Node parent) { if ((child.getRootGraph() != this) || (parent.getRootGraph() != this)) return false; return isNodeMetaParent(child.getRootGraphIndex(), parent.getRootGraphIndex()); }
for (Iterator nodeIt = nodes.iterator(); nodeIt.hasNext(); idx++) { Node currentNode = (Node) nodeIt.next(); result[idx] = currentNode.getRootGraphIndex();