private GraphNode[] replaceAllSubGraphs() throws GraphException { final SubGraphData[] dataList = findSubGraphs("SubGraph"); final List<GraphNode> savedList = new ArrayList<>(); for (SubGraphData data : dataList) { final GraphNode sourceNode = graphNodeList.findGraphNode(data.nodeID); if (data.subGraph != null) { replaceSubGraph(sourceNode, data.subGraph); removeNode(sourceNode); savedList.add(sourceNode); } } return savedList.toArray(new GraphNode[savedList.size()]); }
private GraphNode[] replaceProductSetReaders() { final ProductSetData[] productSetDataList = findProductSets(ProductSetHandler.PRODUCT_SET_READER_NAME); final List<GraphNode> savedProductSetList = new ArrayList<>(); int cnt = 0; for (ProductSetData psData : productSetDataList) { final GraphNode sourceNode = graphNodeList.findGraphNode(psData.nodeID); for (String filePath : psData.fileList) { replaceProductSetWithReaders(sourceNode, "inserted--" + sourceNode.getID() + "--" + cnt++, filePath); } if (!psData.fileList.isEmpty()) { removeNode(sourceNode); savedProductSetList.add(sourceNode); } } return savedProductSetList.toArray(new GraphNode[savedProductSetList.size()]); }
public GraphNode addOperator(final String opName) { String id = opName; int cnt = 1; while (graphNodeList.findGraphNode(id) != null) { ++cnt; id = opName + '(' + cnt + ')'; } final GraphNode newGraphNode = createNewGraphNode(graph, opName, id); notifyGraphEvent(new GraphEvent(events.ADD_EVENT, newGraphNode)); return newGraphNode; }
/** * Update the nodes in the graph with the given reader file and writer file */ public static void setGraphIO(final GraphExecuter graphEx, final String readID, final File readPath, final String writeID, final File writePath, final String format) { final GraphNode readNode = graphEx.getGraphNodeList().findGraphNode(readID); if (readNode != null) { graphEx.setOperatorParam(readNode.getID(), "file", readPath.getAbsolutePath()); } if (writeID != null) { final GraphNode writeNode = graphEx.getGraphNodeList().findGraphNode(writeID); if (writeNode != null) { graphEx.setOperatorParam(writeNode.getID(), "formatName", format); graphEx.setOperatorParam(writeNode.getID(), "file", writePath.getAbsolutePath()); } } }
void RemoveSourceAction(String id) { if (selectedNode != null) { final GraphNode source = graphEx.getGraphNodeList().findGraphNode(id); selectedNode.disconnectOperatorSources(source.getID()); repaint(); } }
protected void cloneGraphs() throws Exception { final GraphExecuter graphEx = graphExecutorList.get(0); for (int graphIndex = 1; graphIndex < graphExecutorList.size(); ++graphIndex) { final GraphExecuter cloneGraphEx = graphExecutorList.get(graphIndex); cloneGraphEx.ClearGraph(); } graphExecutorList.clear(); graphExecutorList.add(graphEx); final File[] fileList = productSetPanel.getFileList(); for (int graphIndex = 1; graphIndex < fileList.length; ++graphIndex) { final GraphExecuter cloneGraphEx = new GraphExecuter(); LoadGraph(cloneGraphEx, graphFile, false); graphExecutorList.add(cloneGraphEx); // copy UI parameter to clone final GraphNode[] cloneGraphNodes = cloneGraphEx.GetGraphNodes(); for (GraphNode cloneNode : cloneGraphNodes) { final GraphNode node = graphEx.getGraphNodeList().findGraphNode(cloneNode.getID()); if (node != null) cloneNode.setOperatorUI(node.GetOperatorUI()); } } }
private void moveWriterToLast(final Graph graph) { final String writeOperatorAlias = OperatorSpi.getOperatorAlias(WriteOp.class); final GraphNode writerNode = graphNodeList.findGraphNode(writeOperatorAlias); if (writerNode != null) { removeNode(writerNode); graphNodeList.add(writerNode); graph.addNode(writerNode.getNode()); } }
final NodeSource[] nSources = n.getNode().getSources(); for (NodeSource nSource : nSources) { final GraphNode srcNode = graphEx.getGraphNodeList().findGraphNode(nSource.getSourceNodeId()); if (srcNode != null) n.drawConnectionLine(g, srcNode);
@Test public void testFindGraphNode() { GraphNode lostNode = graphEx.addOperator("lostOp"); GraphNode foundNode = graphEx.getGraphNodeList().findGraphNode(lostNode.getID()); assertTrue(foundNode.equals(lostNode)); graphEx.ClearGraph(); }