diff --git a/AlgebraicDataflowArchitectureModel/src/application/actions/ChangeCallOrderAction.java b/AlgebraicDataflowArchitectureModel/src/application/actions/ChangeCallOrderAction.java deleted file mode 100644 index 14b3dc1..0000000 --- a/AlgebraicDataflowArchitectureModel/src/application/actions/ChangeCallOrderAction.java +++ /dev/null @@ -1,65 +0,0 @@ -package application.actions; - -import com.mxgraph.model.mxCell; -import com.mxgraph.swing.mxGraphComponent; -import models.controlFlowModel.CallEdgeAttribute; - -import javax.swing.*; -import java.awt.event.ActionEvent; - -public class ChangeCallOrderAction extends AbstractPopupAction { - public ChangeCallOrderAction(final mxGraphComponent graphComponent, final mxCell cell) { - super("changeCallOrder", cell, graphComponent); - } - - @Override - public void actionPerformed(ActionEvent e) { - super.actionPerformed(e); - if (targetCell == null) return; - changeCallOrderOfCallEdge(targetCell); - } - - /** - * コントロールフローの呼び出し順を変更する - * - * @param cellObj 選択されたエッジ(コントロールフロー)のセル - */ - private void changeCallOrderOfCallEdge(Object cellObj) { - String input = ""; - int inputOrder = 0; - - CallEdgeAttribute callEdgeAttr = (CallEdgeAttribute) graphComponent.getGraph().getModel().getValue(cellObj); - if (callEdgeAttr == null) return; - - input = JOptionPane.showInputDialog("Call order"); - if (input == null) return; - - if (!isNumeric(input)) { - JOptionPane.showMessageDialog(graphComponent, "Input value must type of number."); - return; - } - - inputOrder = Integer.parseInt(input); - - final int endOfOrderOfSrc = callEdgeAttr.getSourceObjectNode().getOutdegree(); - if (inputOrder <= 0 || endOfOrderOfSrc < inputOrder) { - JOptionPane.showMessageDialog(graphComponent, "Input order must be between 1 and " + endOfOrderOfSrc + "."); - return; - } - - int curOrder = callEdgeAttr.getSourceObjectNode().getOutEdgeCallOrder(callEdgeAttr.getCallEdge()); - callEdgeAttr.getSourceObjectNode().sortOutEdgesByCallOrder(curOrder, inputOrder); - - graphComponent.refresh(); - } - - /** - * フォームに入力された文字列が数値か判定 - * - * @param str フォームに入力された文字列 - */ - private boolean isNumeric(final String str) { - if (str == null) return false; - return str.matches("[0-9.]+"); - } -} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/src/application/actions/IntroduceMediatorObjectAction.java b/AlgebraicDataflowArchitectureModel/src/application/actions/IntroduceMediatorObjectAction.java deleted file mode 100644 index ffa8a02..0000000 --- a/AlgebraicDataflowArchitectureModel/src/application/actions/IntroduceMediatorObjectAction.java +++ /dev/null @@ -1,82 +0,0 @@ -package application.actions; - -import application.editor.stages.ControlFlowModelingStage; -import application.editor.stages.ControlFlowModelingStageStatus; -import com.mxgraph.model.mxCell; -import com.mxgraph.swing.mxGraphComponent; -import models.controlFlowModel.ObjectNodeAttribute; - -import javax.swing.*; -import java.awt.event.ActionEvent; - -public class IntroduceMediatorObjectAction extends AbstractPopupAction { - - private ControlFlowModelingStage stage = null; - - public IntroduceMediatorObjectAction(final ControlFlowModelingStage stage, final mxGraphComponent graphComponent, final mxCell cell) { - super(/*propName*/"insertMediator", cell, graphComponent); - this.stage = stage; - } - - @Override - public void actionPerformed(ActionEvent e) { - super.actionPerformed(e); - insertObjectNode(targetCell); - this.stage.setState(ControlFlowModelingStageStatus.SELECTING_AN_EDGE); - } - - /** - * 仲介者オブジェクトの導入を実行する. - * - * @param cellObj 選択されたエッジのセル - */ - private void insertObjectNode(final Object cellObj) { - if (cellObj == null) return; - - mxCell edgeCell = null; - if (cellObj instanceof mxCell) edgeCell = (mxCell) cellObj; - else return; - - // Inputing name to the dialog. - String objName = JOptionPane.showInputDialog("Object Name:"); - if (objName == null) return; - - if (objName.isEmpty()) { - JOptionPane.showMessageDialog(graphComponent, "You must input a name. \nIt mustn't be empty."); - return; - } - - if (isDuplicatedName(objName)) { - JOptionPane.showMessageDialog(graphComponent, "The named object has already existed."); - return; - } - - stage.insertObjectNodeCellInControlFlowLayer(edgeCell, objName); - } - - /** - * 同名のノードがすでにあるか判定する - * - * @param name つけたいノード名 - */ - private boolean isDuplicatedName(final String name) { - mxCell root = (mxCell) graphComponent.getGraph().getDefaultParent(); - - for (int i = 0; i < root.getChildCount(); i++) { - mxCell layerCell = (mxCell) root.getChildAt(i); - - for (int j = 0; j < layerCell.getChildCount(); j++) { - mxCell cell = (mxCell) layerCell.getChildAt(j); - - ObjectNodeAttribute attr = null; - if (cell.getValue() instanceof ObjectNodeAttribute) - attr = (ObjectNodeAttribute) cell.getValue(); - else continue; - - if (!(attr.getObjectNode().getName().equals(name))) continue; - return true; - } - } - return false; - } -} diff --git a/AlgebraicDataflowArchitectureModel/src/application/actions/ShowDependableMediatorAction.java b/AlgebraicDataflowArchitectureModel/src/application/actions/ShowDependableMediatorAction.java deleted file mode 100644 index 1cc5362..0000000 --- a/AlgebraicDataflowArchitectureModel/src/application/actions/ShowDependableMediatorAction.java +++ /dev/null @@ -1,40 +0,0 @@ -package application.actions; - -import application.editor.stages.ControlFlowModelingStage; -import application.editor.stages.ControlFlowModelingStageStatus; -import com.mxgraph.model.mxCell; -import com.mxgraph.swing.mxGraphComponent; -import models.controlFlowModel.CallEdgeAttribute; - -import java.awt.event.ActionEvent; - -public class ShowDependableMediatorAction extends AbstractPopupAction { - private ControlFlowModelingStage stage; - - public ShowDependableMediatorAction(ControlFlowModelingStage stage, mxGraphComponent graphComponent, mxCell targetCell) { - super("dependsOnMediator", targetCell, graphComponent); - this.stage = stage; - } - - /** - * DoM適用可能範囲の表示まで実行する. - */ - @Override - public void actionPerformed(ActionEvent e) { - super.actionPerformed(e); - showDependableNodesBySelectedEdge(targetCell); - stage.setState(ControlFlowModelingStageStatus.SHOWING_DEPENDABLE_NODES); - // ⇒ 以降のDoM実行操作は, 【ControlFlowModelingCellEditor】で実行される. - } - - /** - * 選択されたセルの, DoM実行な仲介者オブジェクトを表示する. - */ - private void showDependableNodesBySelectedEdge(Object cellObj) { - CallEdgeAttribute callEdgeAttr = (CallEdgeAttribute) graphComponent.getGraph().getModel().getValue(cellObj); - if (callEdgeAttr == null) return; - - ControlFlowModelingStage cfdStage = stage; - cfdStage.showDependableNodes(callEdgeAttr); - } -} diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowModelingCellEditor.java b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowModelingCellEditor.java index e8df61e..0d47462 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowModelingCellEditor.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowModelingCellEditor.java @@ -1,16 +1,11 @@ package application.editor.stages; import application.editor.FlowCellEditor; -import com.mxgraph.model.mxCell; import com.mxgraph.swing.mxGraphComponent; -import models.controlFlowModel.*; -import javax.swing.*; import java.util.EventObject; public class ControlFlowModelingCellEditor extends FlowCellEditor { - private mxCell targetEdgeCell = null; - public ControlFlowModelingCellEditor(ControlFlowModelingStage stage, mxGraphComponent graphComponent) { super(stage, graphComponent); } @@ -20,123 +15,10 @@ if (editingCell != null) { stopEditing(true); } - - ControlFlowModelingStage cfdStage = (ControlFlowModelingStage) stage; - switch (cfdStage.getCurState()) { - case SELECTING_AN_EDGE: { - if (graphComponent.getGraph().getModel().isEdge(cellObj)) { - - targetEdgeCell = (mxCell) cellObj; - - CallEdgeAttribute callEdgeAttr = (CallEdgeAttribute) graphComponent.getGraph().getModel().getValue(targetEdgeCell); - if (callEdgeAttr == null) return; - - String pairNodeStr = "(" + callEdgeAttr.getSourceObjectNode().getName() + ", " + callEdgeAttr.getDestinationObjectNode().getName() + ")"; - - showDelegatableNodesBySelectedEdge(cellObj); - cfdStage.setState(ControlFlowModelingStageStatus.SHOWING_DELEGATABLE_NODES); - } - break; - } - case SHOWING_DELEGATABLE_NODES: { - if (graphComponent.getGraph().getModel().isVertex(cellObj)) { - mxCell dstCell = null; - if (cellObj instanceof mxCell) dstCell = (mxCell) cellObj; - else throw new ClassCastException(); - - CallEdgeAttribute callEdgeAttr = (CallEdgeAttribute) graphComponent.getGraph().getModel().getValue(targetEdgeCell); - if (callEdgeAttr == null) return; - - ObjectNode dstObjNode = ((ObjectNodeAttribute) dstCell.getValue()).getObjectNode(); - if (dstObjNode == null) throw new ClassCastException(); - - // dstObjNode はCFD適用可能なノードかどうか? - if (!cfdStage.isExecutableDelegation(callEdgeAttr, dstObjNode)) { - JOptionPane.showMessageDialog(graphComponent, "It's impossible for \"" + dstObjNode.getName() + "\" to delegate."); - return; - } - - // CFD実行 -> 実行後のグラフを表示. - cfdStage.showDelegatedGraph(graphComponent.getGraph(), targetEdgeCell, (mxCell) cellObj); - cfdStage.setState(ControlFlowModelingStageStatus.SELECTING_AN_EDGE); - } else { - cfdStage.resetAllStyleOfCells(); - cfdStage.setState(ControlFlowModelingStageStatus.SELECTING_AN_EDGE); - } - break; - } - case SHOWING_DEPENDABLE_NODES: { - if (cfdStage.getCachedCell() == null) return; - this.targetEdgeCell = cfdStage.getCachedCell(); - - if (graphComponent.getGraph().getModel().isVertex(cellObj)) { - mxCell targetObjCell = null; - if (cellObj instanceof mxCell) targetObjCell = (mxCell) cellObj; - else throw new ClassCastException(); - - ObjectNodeAttribute targetObjNodeAttr = (targetObjCell.getValue() instanceof ObjectNodeAttribute) ? (ObjectNodeAttribute) targetObjCell.getValue() : null; - if (targetObjNodeAttr == null) return; - - ObjectNode targetObjNode = targetObjNodeAttr.getObjectNode(); - - // 仲介者以外のオブジェクトを選択したときの例外処理 - if (isNotStatelessObject(targetObjNode)) { - JOptionPane.showMessageDialog(graphComponent, "It's impossible for \"" + targetObjNode.getName() + "\" to dependent."); - return; - } - - // DoMを実行 - dependingObjectNode(targetObjCell); - - cfdStage.resetAllStyleOfCells(); - cfdStage.setState(ControlFlowModelingStageStatus.SELECTING_AN_EDGE); - } else { - cfdStage.resetAllStyleOfCells(); - cfdStage.setState(ControlFlowModelingStageStatus.SELECTING_AN_EDGE); - } - break; - } - } } @Override public void stopEditing(boolean cancel) { // Do nothing } - - /** - * 選択されたエッジが, CFDによって呼び出し元にできるオブジェクトを表示する. - * - * @param cellObj コントロールフローのセル - */ - private void showDelegatableNodesBySelectedEdge(Object cellObj) { - CallEdgeAttribute callEdgeAttr = (CallEdgeAttribute) graphComponent.getGraph().getModel().getValue(cellObj); - if (callEdgeAttr == null) return; - - ControlFlowModelingStage cfdStage = (ControlFlowModelingStage) stage; - cfdStage.showDelegatableNodes(callEdgeAttr); - } - - /** - * DoMを実行する. - * - * @param targetMediatorCell 選択された仲介者オブジェクト - */ - private void dependingObjectNode(final mxCell targetMediatorCell) { - if (targetMediatorCell == null) return; - - ControlFlowModelingStage cfdStage = (ControlFlowModelingStage) stage; - cfdStage.dependingOnMediatorObject(targetEdgeCell, targetMediatorCell); - } - - /** - * あるノードが仲介者(状態を持たない)オブジェクトかどうかを判定する. - * - * @param targetObjNode 選択されたノード - */ - private boolean isNotStatelessObject(ObjectNode targetObjNode) { - if (targetObjNode instanceof StatefulObjectNode) return true; - if (targetObjNode instanceof EventChannelObjectNode) return true; - return false; - } } diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowModelingStage.java b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowModelingStage.java index 82376c9..1f98352 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowModelingStage.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowModelingStage.java @@ -3,13 +3,10 @@ import application.editor.Editor; import application.editor.FlowCellEditor; import application.editor.Stage; -import application.views.PopupMenuBase; -import application.views.controlFlowDelegation.ControlFlowDelegationStagePopupMenu; import com.mxgraph.model.mxCell; import com.mxgraph.model.mxGeometry; import com.mxgraph.model.mxGraphModel; import com.mxgraph.swing.mxGraphComponent; -import com.mxgraph.swing.util.mxMouseAdapter; import com.mxgraph.util.mxEventObject; import com.mxgraph.util.mxEventSource.mxIEventListener; import com.mxgraph.util.mxPoint; @@ -20,65 +17,23 @@ import models.dataConstraintModel.ResourcePath; import models.dataFlowModel.*; -import javax.swing.*; -import java.awt.event.MouseEvent; import java.awt.event.MouseListener; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class ControlFlowModelingStage extends Stage { public final int PORT_DIAMETER = 8; public final int PORT_RADIUS = PORT_DIAMETER / 2; - private ControlFlowModelingStageStatus curState; - private ControlFlowGraph controlFlowGraph = null; - private final PopupMenuBase popupMenu; - - private mxCell selectedCellOnAnyEvent = null; public ControlFlowModelingStage(mxGraphComponent graphComponent) { super(graphComponent); - this.curState = ControlFlowModelingStageStatus.SELECTING_AN_EDGE; - this.popupMenu = new ControlFlowDelegationStagePopupMenu(this, graphComponent); } public ControlFlowGraph getControlFlowGraph() { return controlFlowGraph; } - /** - * 今のコントロールフローの操作状態がどうなっているかを取得 - */ - public ControlFlowModelingStageStatus getCurState() { - return curState; - } - - /** - * 今のコントロールフローの操作状態をセット. - */ - public void setState(ControlFlowModelingStageStatus nextState) { - curState = nextState; - } - - /** - * Stage クラス以外の, 他のクラス上で取得されたセルをセット - */ - public void setCellOnAnyEvent(final mxCell selectedCell) { - this.selectedCellOnAnyEvent = selectedCell; - } - - /** - * 「Stage」クラス以外の, 他のクラス上で取得されたセルをget - * Action や CellEditor とセルのインスタンス情報を共有するために必要. - * (this.seletedCellOnAnyEvent == null) ならグラフ上のどのセルも選択されていないことになる. - */ - public mxCell getCachedCell() { - return this.selectedCellOnAnyEvent; - } - @Override public boolean canChangeFrom(Stage prevStage) { if (prevStage instanceof PushPullSelectionStage) return true; @@ -123,8 +78,8 @@ terminals.add(terminal); } } - - if (curState != ControlFlowModelingStageStatus.SELECTING_AN_EDGE) return; + +// if (curState != ControlFlowModelingStageStatus.SELECTING_AN_EDGE) return; if (terminals.size() == 2) { graph.removeCells(new mxCell[]{cell}); @@ -134,386 +89,9 @@ }; } - /** - * Create a mouse event listener to handle clicks on the graph - * - * @param editor The editor instance - */ @Override public MouseListener createMouseEventListener(Editor editor) { - MouseListener listener = new mxMouseAdapter() { - @Override - public void mouseReleased(MouseEvent e) { - if (SwingUtilities.isLeftMouseButton(e)) { - if (graphComponent.getCellAt(e.getX(), e.getY()) != null) return; - if (curState.equals(ControlFlowModelingStageStatus.SELECTING_AN_EDGE)) return; - - resetAllStyleOfCells(); - curState = ControlFlowModelingStageStatus.SELECTING_AN_EDGE; - } else if (SwingUtilities.isRightMouseButton(e)) { - popupMenu.show(e.getX(), e.getY()); - } - } - }; - return listener; - } - - /** - * CFDが適用できるノードの表示 - * - * @param callEdgeAttr 選択された呼び出しエッジの情報 - */ - public void showDelegatableNodes(final CallEdgeAttribute callEdgeAttr) { - mxCell root = (mxCell) graph.getDefaultParent(); - - graph.getModel().beginUpdate(); - try { - ObjectNode delegatingNode = callEdgeAttr.getDestinationObjectNode(); - for (int layerNo = Stage.PUSH_FLOW_LAYER; layerNo <= PULL_FLOW_LAYER; layerNo++) { - - mxCell layerCell = (mxCell) root.getChildAt(layerNo); - for (Object node : graph.getChildVertices(layerCell)) { - if (!(node instanceof mxCell)) continue; - mxCell cell = (mxCell) node; - - ObjectNodeAttribute objNodeAttr = (ObjectNodeAttribute) cell.getValue(); - if (objNodeAttr == null) return; - - ObjectNode objNode = objNodeAttr.getObjectNode(); - ControlFlowDelegator delegator = new ControlFlowDelegator(); - List delegatableNodes = delegator.searchDelegatableNodes(callEdgeAttr.getCallEdge()); - - if (delegatableNodes.contains(objNode)) { - graph.getModel().setStyle(cell, objNodeAttr.getEnableStyle()); - } else { - graph.getModel().setStyle(cell, objNodeAttr.getDisableStyle()); - } - - if (delegatingNode.equals(objNodeAttr.getObjectNode())) { // Base node - graph.getModel().setStyle(cell, objNodeAttr.getDelegatingStyle()); - } - } - } - } finally { - graph.getModel().endUpdate(); - graph.refresh(); - } - } - - /** - * DoMを実行可能なノードの表示 - * - * @param callEdgeAttr 選択された呼び出しエッジの情報 - */ - public void showDependableNodes(final CallEdgeAttribute callEdgeAttr) { - mxCell root = (mxCell) graph.getDefaultParent(); - mxCell layerCell = (mxCell) root.getChildAt(PULL_FLOW_LAYER); - graph.getModel().beginUpdate(); - try { - ObjectNode delegatingNode = callEdgeAttr.getDestinationObjectNode(); - - for (Object node : graph.getChildVertices(layerCell)) { - if (!(node instanceof mxCell)) continue; - mxCell cell = (mxCell) node; - - ObjectNodeAttribute objNodeAttr = (ObjectNodeAttribute) cell.getValue(); - if (objNodeAttr == null) return; - - ObjectNode objNode = objNodeAttr.getObjectNode(); - ControlFlowDelegator delegator = new ControlFlowDelegator(); - List delegatableNodes = delegator.searchDependableMediatorNodes(callEdgeAttr.getCallEdge()); - - if (delegatableNodes.contains(objNode)) { - graph.getModel().setStyle(cell, objNodeAttr.getEnableStyle()); - } else { - graph.getModel().setStyle(cell, objNodeAttr.getDisableStyle()); - } - - if (delegatingNode.equals(objNodeAttr.getObjectNode())) { // Base node - graph.getModel().setStyle(cell, objNodeAttr.getDelegatingStyle()); - } - } - } finally { - graph.getModel().endUpdate(); - graph.refresh(); - } - } - - /** - * CFD実行後のグラフを表示 - * - * @param graph 被操作対象のグラフ - * @param targetEdgeCell CFD実行時に選択された呼び出しエッジ - * @param dstObjNodeCell CFDによって呼び出し元となるセル - */ - public void showDelegatedGraph(mxGraph graph, mxCell targetEdgeCell, final mxCell dstObjNodeCell) { - ObjectNode dstObjNode = ((ObjectNodeAttribute) dstObjNodeCell.getValue()).getObjectNode(); - if (dstObjNode == null) throw new ClassCastException(); - CallEdgeAttribute targetEdgeAttr = (CallEdgeAttribute) targetEdgeCell.getValue(); - if (targetEdgeAttr == null) throw new ClassCastException(); - - ControlFlowDelegator delegator = new ControlFlowDelegator(); - delegator.delegateCallEdge(targetEdgeAttr.getCallEdge(), dstObjNode); - - mxCell root = (mxCell) graph.getDefaultParent(); - mxCell layerCell = null; - switch (targetEdgeAttr.getSelectedOption()) { - case PUSH: - layerCell = (mxCell) root.getChildAt(Stage.PUSH_FLOW_LAYER); - break; - - case PULL: - case PUSHorPULL: - layerCell = (mxCell) root.getChildAt(Stage.PULL_FLOW_LAYER); - break; - } - - try { - mxCell dstNodeCell = targetEdgeAttr.getDestinationCell(); - - // 対象となるコントロールフローをグラフ上から削除. - if (graph.getModel().getValue(targetEdgeCell) != null) { - graph.getModel().remove(targetEdgeCell); - } - - CallEdgeAttribute newAttr = new CallEdgeAttribute(targetEdgeAttr.getCallEdge(), targetEdgeAttr.getOriginalSourceObjectNode(), dstObjNodeCell, dstNodeCell); - graph.insertEdge(layerCell, "", newAttr, dstObjNodeCell, dstNodeCell, "movable=false;"); - - resetAllStyleOfCells(); - } finally { - graph.getModel().endUpdate(); - } - } - - /** - * 仲介者オブジェクトへの依存(DoM)を実行し, mxGraphを変更する. - * - * @param targetEdgeCell DoMによって変更されるコントロールフローのセル - * @param targetMediatorObjNodeCell DoMの対象となる仲介者オブジェクトのセル - */ - public void dependingOnMediatorObject(mxCell targetEdgeCell, mxCell targetMediatorObjNodeCell) { - CallEdgeAttribute targetCallEdgeAttr = (CallEdgeAttribute) targetEdgeCell.getValue(); - if (targetCallEdgeAttr == null) return; - - mxCell root = (mxCell) graph.getDefaultParent(); - mxCell pullFlowLayerCell = (mxCell) root.getChildAt(Stage.PULL_FLOW_LAYER); - - graph.getModel().beginUpdate(); - - try { - // 各ノードの情報を取得. - ObjectNode srcObjNode = targetCallEdgeAttr.getSourceObjectNode(); - ObjectNode dstObjNode = targetCallEdgeAttr.getDestinationObjectNode(); - if (srcObjNode == null || dstObjNode == null) throw new NullPointerException(); - if (!(srcObjNode instanceof ObjectNode && dstObjNode instanceof ObjectNode)) throw new ClassCastException(); - - ObjectNodeAttribute targetObjNodeAttr = (ObjectNodeAttribute) targetMediatorObjNodeCell.getValue(); - if (targetObjNodeAttr == null) throw new NullPointerException(); - - ObjectNode targetMediatorObjNode = targetObjNodeAttr.getObjectNode(); - if (targetMediatorObjNode == null) throw new NullPointerException(); - if (targetMediatorObjNode instanceof StatefulObjectNode || targetMediatorObjNode instanceof EventChannelObjectNode) - return; - - // 新たに接続するエッジ情報を生成. - CallEdge srcToMediatorEdge = new CallEdge(targetCallEdgeAttr.getSourceObjectNode(), targetMediatorObjNode, targetCallEdgeAttr.getSelectedOption()); - CallEdge mediatorToDstEdge = new CallEdge(targetMediatorObjNode, dstObjNode, targetCallEdgeAttr.getSelectedOption()); - if (srcToMediatorEdge == null || mediatorToDstEdge == null) throw new NullPointerException(); - - // ノード同士の接続情報を更新 - srcObjNode.addOutEdge(srcToMediatorEdge); - srcObjNode.removeOutEdge(targetCallEdgeAttr.getCallEdge()); - - dstObjNode.removeInEdge(targetCallEdgeAttr.getCallEdge()); - - targetMediatorObjNode.addInEdge(srcToMediatorEdge); - - // 既に仲介者に接続されているエッジの情報を CompositeCallEdgeAttr に保持させる. - CompositeCallEdgeAttribute compositeEdgeAttr = null; - - for (int i = 0; i < pullFlowLayerCell.getChildCount(); i++) { - mxCell edgeCell = (mxCell) pullFlowLayerCell.getChildAt(i); - if (!edgeCell.isEdge()) continue; - if (!(edgeCell.getValue() instanceof CallEdgeAttribute)) continue; - - CallEdgeAttribute edgeAttr = (CallEdgeAttribute) edgeCell.getValue(); - - if (!(edgeAttr.getSourceObjectNode().equals(targetMediatorObjNode))) continue; - if (!(edgeAttr.getDestinationObjectNode().equals(dstObjNode))) continue; - - compositeEdgeAttr = new CompositeCallEdgeAttribute(edgeAttr); - - break; - } - - if (compositeEdgeAttr != null) compositeEdgeAttr.mergeCallEdgeAttribute(targetCallEdgeAttr); - - // mxGraph へ接続状態を反映する. - for (int i = 0; i < pullFlowLayerCell.getChildCount(); i++) { - mxCell nodeCell = (mxCell) pullFlowLayerCell.getChildAt(i); - if (!nodeCell.isVertex()) continue; - - ObjectNodeAttribute cellObjNodeAttr = (ObjectNodeAttribute) nodeCell.getValue(); - if (cellObjNodeAttr == null) - throw new ClassCastException("dosen't have the value of "); - - // nodeCell が呼び出し元のノードか? - if (nodeCell.equals(targetCallEdgeAttr.getSourceCell())) { - mxCell srcNodeCell = targetCallEdgeAttr.getSourceCell(); - - // mxGraph に変更対象のコントロールフローが存在するなら削除する. - if (graph.getModel().getValue(targetEdgeCell) != null) graph.getModel().remove(targetEdgeCell); - - graph.insertEdge(pullFlowLayerCell, null, compositeEdgeAttr, srcNodeCell, targetMediatorObjNodeCell, "movable=false;"); - continue; - } - } - } finally { - graph.getModel().endUpdate(); - } - } - - /** - * グラフの選択状態をクリアする. - */ - public void resetAllStyleOfCells() { - mxCell root = (mxCell) graph.getDefaultParent(); - - graph.getModel().beginUpdate(); - try { - for (int layerNo = Stage.PUSH_FLOW_LAYER; layerNo <= Stage.PULL_FLOW_LAYER; layerNo++) { - - mxCell layerCell = (mxCell) root.getChildAt(layerNo); - for (Object node : graph.getChildVertices(layerCell)) { - mxCell cell = null; - if (node instanceof mxCell) cell = (mxCell) node; - else continue; - - ObjectNodeAttribute objNodeAttr = (ObjectNodeAttribute) (cell.getValue()); - if (objNodeAttr == null) throw new NullPointerException(""); - - graph.getModel().setStyle(cell, objNodeAttr.getDefaultStyle()); - } - } - } finally { - graph.getModel().endUpdate(); - graph.refresh(); - } - } - - /** - * コントロールフローに対して, 状態を持たないノードを挿入する. - * - * @param targetEdge CFDによって変更されるコントロールフロー. - * @param insertObjName 挿入するノードの名前 - */ - public void insertObjectNodeCellInControlFlowLayer(mxCell targetEdge, final String insertObjName) { - CallEdgeAttribute callEdgeAttr = (CallEdgeAttribute) targetEdge.getValue(); - if (callEdgeAttr == null) throw new NullPointerException(); - - mxCell root = (mxCell) graph.getDefaultParent(); - mxCell layerCell = null; - switch (callEdgeAttr.getSelectedOption()) { - case PUSH: - layerCell = (mxCell) root.getChildAt(Stage.PUSH_FLOW_LAYER); - break; - - case PULL: - case PUSHorPULL: - layerCell = (mxCell) root.getChildAt(Stage.PULL_FLOW_LAYER); - break; - } - - graph.getModel().beginUpdate(); - - try { - // オブジェクトは ObjectNode として挿入する. - ObjectNode insertObjNode = new ObjectNode(insertObjName); - ObjectNodeAttribute objNodeAttr = new ObjectNodeAttribute(insertObjNode); - - mxPoint srcPoint = new mxPoint(callEdgeAttr.getSourceCell().getGeometry().getX(), callEdgeAttr.getSourceCell().getGeometry().getY()); - mxPoint dstPoint = new mxPoint(callEdgeAttr.getDestinationCell().getGeometry().getX(), callEdgeAttr.getDestinationCell().getGeometry().getY()); - mxPoint insertPoint = new mxPoint((srcPoint.getX() + dstPoint.getX()) / 2, (srcPoint.getY() + dstPoint.getY()) / 2); - - mxCell insertObjNodeCell = (mxCell) graph.insertVertex(layerCell, null, objNodeAttr, - /* 座標 */ insertPoint.getX(), insertPoint.getY(), - /* スケール*/ 40, 40, objNodeAttr.getDefaultStyle()); - insertObjNodeCell.setValue(objNodeAttr); - - addObjectNodeToCallGraph(insertObjNode, callEdgeAttr.getSelectedOption()); - - ObjectNode srcObjNode = callEdgeAttr.getSourceObjectNode(); - ObjectNode dstObjNode = callEdgeAttr.getDestinationObjectNode(); - if (srcObjNode == null || dstObjNode == null) throw new NullPointerException(); - if (!(srcObjNode instanceof ObjectNode && dstObjNode instanceof ObjectNode)) throw new ClassCastException(); - - CallEdge srcToInsertEdge = callEdgeAttr.getCallEdge(); - CallEdge insertToDstEdge = new CallEdge(insertObjNode, dstObjNode, callEdgeAttr.getSelectedOption()); - if (srcToInsertEdge == null || insertToDstEdge == null) throw new NullPointerException(); - - // ノードとエッジを再接続する - dstObjNode.removeInEdge(srcToInsertEdge); - dstObjNode.addInEdge(insertToDstEdge); - - srcToInsertEdge.setDestination(insertObjNode); // 呼び出し先オブジェクトを変更する. - - insertObjNode.addInEdge(srcToInsertEdge); - insertObjNode.addOutEdge(insertToDstEdge); - - // mxGraphを更新する. - for (int i = 0; i < layerCell.getChildCount(); i++) { - mxCell nodeCell = (mxCell) layerCell.getChildAt(i); - if (!nodeCell.isVertex()) continue; - - ObjectNodeAttribute cellObjNodeAttr = (ObjectNodeAttribute) nodeCell.getValue(); - if (cellObjNodeAttr == null) - throw new ClassCastException("dosen't have the value of "); - - // nodeCell が呼び出し元のオブジェクトか? - if (nodeCell.equals(callEdgeAttr.getSourceCell())) { - mxCell srcNodeCell = callEdgeAttr.getSourceCell(); - CallEdgeAttribute newInEdgeAttr = new CallEdgeAttribute(srcToInsertEdge, srcNodeCell, insertObjNodeCell); - - // mxGraph上にtargetEdgeが残っているなら削除する. - if (graph.getModel().getValue(targetEdge) != null) graph.getModel().remove(targetEdge); - - mxCell outPortCell = (mxCell) srcNodeCell.getChildAt(0); - if (outPortCell != null) { - graph.insertEdge(layerCell, null, newInEdgeAttr, outPortCell, insertObjNodeCell, "movable=false;"); - } else { - graph.insertEdge(layerCell, null, newInEdgeAttr, srcNodeCell, insertObjNodeCell, "movable=false;"); - } - continue; - } - // nodeCell は呼び出し先オブジェクトか? - else if (nodeCell.equals(callEdgeAttr.getDestinationCell())) { - mxCell dstNodeCell = callEdgeAttr.getDestinationCell(); - CallEdgeAttribute newOutEdgeAttr = new CallEdgeAttribute(insertToDstEdge, insertObjNodeCell, dstNodeCell); - - // mxGraph上にtargetEdgeが残っているなら削除する. - if (graph.getModel().getValue(targetEdge) != null) graph.getModel().remove(targetEdge); - - graph.insertEdge(layerCell, null, newOutEdgeAttr, insertObjNodeCell, dstNodeCell, "movable=false;"); - - continue; - } - } - } finally { - graph.getModel().endUpdate(); - } - } - - /** - * CFD適用可能かどうかを判定する - * - * @param targetEdgeAttr CFDによって呼び出し元が変更されるコントロールフロー - * @param dstObjNode CFDによって呼び出し元となるオブジェクト - */ - public boolean isExecutableDelegation(final CallEdgeAttribute targetEdgeAttr, final ObjectNode dstObjNode) { - ControlFlowDelegator delegator = new ControlFlowDelegator(); - List delegatableNodes = delegator.searchDelegatableNodes(targetEdgeAttr.getCallEdge()); - - return delegatableNodes.contains(dstObjNode); + return null; } /** @@ -576,27 +154,27 @@ mxCell root = (mxCell) graph.getDefaultParent(); mxCell layerCell = (mxCell) root.getChildAt(layer); final Map resourceNodeCells = new HashMap<>(); - + CallGraph callGraph = null; if (layer == PUSH_FLOW_LAYER) { callGraph = controlFlowGraph.getPushCallGraph(); } else if (layer == PULL_FLOW_LAYER) { callGraph = controlFlowGraph.getPullCallGraph(); } - + for (ResourceNode rootNode : controlFlowGraph.getDataFlowGraph().getRootResourceNodes()) { if (callGraph != null && !isResourceOrDescendantsInCallGraph(rootNode, callGraph)) { continue; } - + ResourcePath rootResourcePath = rootNode.getPrimaryResourcePath(); - int width = 320; - int height = 160; + int width = 160; + int height = 80; mxCell insertedCell = (mxCell) graph.insertVertex(layerCell, null, rootResourcePath.getLeafResourceName(), 20, 20, width, height, "shape=ellipse;perimeter=ellipsePerimeter;verticalAlign=top"); // insert a resource as a vertex resourceNodeCells.put(rootNode, insertedCell); - createChildResourceNodeCell(graph, insertedCell, rootNode, resourceNodeCells, width / 2, height / 2, callGraph); + createChildResourceNodeCell(graph, insertedCell, rootNode, resourceNodeCells, (int) (width * 0.6), (int) (height * 0.6), callGraph); } return resourceNodeCells; } @@ -615,7 +193,7 @@ if (callGraph != null && !isResourceOrDescendantsInCallGraph(childNode, callGraph)) { continue; } - + ResourcePath resourcePath = childNode.getPrimaryResourcePath(); mxGeometry parentGeo = parentCell.getGeometry(); @@ -629,13 +207,13 @@ mxCell insertedCell = (mxCell) graph.insertVertex(parentCell, null, resourcePath.getName(), x, y, width, height, "shape=ellipse;perimeter=ellipsePerimeter;verticalAlign=top"); // insert a resource as a vertex resourceNodeCells.put(childNode, insertedCell); - createChildResourceNodeCell(graph, insertedCell, childNode, resourceNodeCells, width / 2, height / 2, callGraph); + createChildResourceNodeCell(graph, insertedCell, childNode, resourceNodeCells, (int) (width * 0.6), (int) (height * 0.6), callGraph); } } - + /** * Check if the resource node or any of its descendants are in the call graph. - * + * * @param node The resource node to check. * @param callGraph The call graph. * @return true if the node or any descendant is in the call graph. @@ -662,8 +240,16 @@ final Map channelNodeCells = new HashMap<>(); final Map outputChannelNodeCells = new HashMap<>(); // TODO: Name it properly + Set inputChannels = new HashSet<>(); + CallGraph callGraph = (layer == PUSH_FLOW_LAYER) ? controlFlowGraph.getPushCallGraph() : controlFlowGraph.getPullCallGraph(); + for (Node node : callGraph.getNodes()) { + if (node instanceof EventChannelObjectNode) { + inputChannels.add(((EventChannelObjectNode) node).getIOChannel()); + } + } + for (ChannelNode rootChannelNode : controlFlowGraph.getDataFlowGraph().getRootChannelNodes()) { - createEventChannelNodeCell(graph, layerCell, rootChannelNode, channelNodeCells, outputChannelNodeCells, 200, 100); + createEventChannelNodeCell(graph, layerCell, rootChannelNode, channelNodeCells, outputChannelNodeCells, inputChannels, 120, 60); } return channelNodeCells; } @@ -676,12 +262,13 @@ * @param channelNode {@link ChannelNode} instance to be registered. * @param channelNodeCells {@link ChannelNode} and its corresponding cell. * @param outputChannelNodeCells {@link ChannelNode} and its corresponding output port cell. + * @param inputChannels The set of input channels in the call graph. * @param cellWidth The width of a new cell. * @param cellHeight The height of a new cell. */ - private void createEventChannelNodeCell(final mxGraph graph, final mxCell parentCell, final ChannelNode channelNode, Map channelNodeCells, Map outputChannelNodeCells, double cellWidth, double cellHeight) { + private void createEventChannelNodeCell(final mxGraph graph, final mxCell parentCell, final ChannelNode channelNode, Map channelNodeCells, Map outputChannelNodeCells, Set inputChannels, double cellWidth, double cellHeight) { DataTransferChannel channel = channelNode.getChannel(); - boolean isEventChannel = channel.getInputResources().isEmpty(); + boolean isEventChannel = channel.getInputResources().isEmpty() || inputChannels.contains(channel); if (!isEventChannel) { return; } @@ -709,7 +296,7 @@ // Create child cells for the channel node recursively for (ChannelNode childChannelNode : channelNode.getChildren()) { - createEventChannelNodeCell(graph, insertedChannelCell, childChannelNode, channelNodeCells, outputChannelNodeCells, cellWidth / 2.0, cellHeight / 2.0); + createEventChannelNodeCell(graph, insertedChannelCell, childChannelNode, channelNodeCells, outputChannelNodeCells, inputChannels, cellWidth / 2.0, cellHeight / 2.0); } } diff --git a/AlgebraicDataflowArchitectureModel/src/application/views/controlFlowDelegation/ControlFlowDelegationStagePopupMenu.java b/AlgebraicDataflowArchitectureModel/src/application/views/controlFlowDelegation/ControlFlowDelegationStagePopupMenu.java deleted file mode 100644 index 36895ff..0000000 --- a/AlgebraicDataflowArchitectureModel/src/application/views/controlFlowDelegation/ControlFlowDelegationStagePopupMenu.java +++ /dev/null @@ -1,98 +0,0 @@ -package application.views.controlFlowDelegation; - -import application.actions.AbstractPopupAction; -import application.actions.ChangeCallOrderAction; -import application.actions.IntroduceMediatorObjectAction; -import application.actions.ShowDependableMediatorAction; -import application.editor.stages.ControlFlowModelingStage; -import application.views.PopupMenuBase; -import com.mxgraph.model.mxCell; -import com.mxgraph.swing.mxGraphComponent; -import models.controlFlowModel.CallEdgeAttribute; -import models.dataFlowModel.PushPullValue; - -import javax.swing.*; -import java.awt.*; - -public class ControlFlowDelegationStagePopupMenu extends PopupMenuBase { - private ControlFlowModelingStage stage = null; - private mxCell selectedCell = null; - - public ControlFlowDelegationStagePopupMenu(final ControlFlowModelingStage stage, mxGraphComponent graphComponent) { - super(graphComponent); - this.stage = stage; - - addMenuItem(new JMenuItem(new IntroduceMediatorObjectAction(stage, graphComponent, selectedCell))); - addMenuItem(new JMenuItem(new ChangeCallOrderAction(graphComponent, selectedCell))); - addMenuItem(new JMenuItem(new ShowDependableMediatorAction(stage, graphComponent, selectedCell))); - } - - @Override - public void show(int x, int y) { - if (graphComponent.getCellAt(x, y) instanceof mxCell) { - selectedCell = (mxCell) graphComponent.getCellAt(x, y); - } else { - selectedCell = null; - } - - if (this.selectedCell == null) return; - - notifyCellCached(selectedCell); - stage.setCellOnAnyEvent(selectedCell); - - boolean isEnable = (graphComponent.getCellAt(x, y) != null) - ? true - : false; - - setEnableMenuItems(isEnable); - - super.show(x, y); - } - - /** - * ポップアップ表示時に選択したセルを, Stageに保存させる. - * - * @param cell 選択したセル - */ - private void notifyCellCached(final mxCell cell) { - if (cell == null) return; - - for (Component component : popupMenu.getComponents()) { - JMenuItem menuItem = null; - if (component instanceof JMenuItem) menuItem = (JMenuItem) component; - else return; - - AbstractPopupAction action = null; - if (menuItem.getAction() instanceof AbstractPopupAction) { - action = (AbstractPopupAction) menuItem.getAction(); - } else return; - - action.updateTargetCell(cell); // 選択したセルをキャッシュする. - } - } - - private void setEnableMenuItems(final boolean isEnable) { - if (this.selectedCell == null) return; - - for (Component component : popupMenu.getComponents()) { - component.setEnabled(isEnable); - - // pull only - if (!isSelectedPullCallEdge(selectedCell)) { - JMenuItem menuItem = null; - if (component instanceof JMenuItem) menuItem = (JMenuItem) component; - - if (menuItem.getAction() instanceof ShowDependableMediatorAction) { - component.setEnabled(false); - continue; - } - } - - } - } - - private boolean isSelectedPullCallEdge(final mxCell selectedCell) { - CallEdgeAttribute callEdgeAttr = (CallEdgeAttribute) selectedCell.getValue(); - return callEdgeAttr.getSelectedOption().equals(PushPullValue.PULL); - } -} diff --git a/AlgebraicDataflowArchitectureModel/src/application/views/controlFlowDelegation/FlowLayerValue.java b/AlgebraicDataflowArchitectureModel/src/application/views/controlFlowDelegation/FlowLayerValue.java deleted file mode 100644 index 7008a40..0000000 --- a/AlgebraicDataflowArchitectureModel/src/application/views/controlFlowDelegation/FlowLayerValue.java +++ /dev/null @@ -1,7 +0,0 @@ -package application.views.controlFlowDelegation; - -public enum FlowLayerValue { - DATA_FLOW, - PUSH_FLOW, - PULL_FLOW -} diff --git a/AlgebraicDataflowArchitectureModel/src/application/views/controlFlowDelegation/FlowLayerWindow.java b/AlgebraicDataflowArchitectureModel/src/application/views/controlFlowDelegation/FlowLayerWindow.java deleted file mode 100644 index 98bb5e0..0000000 --- a/AlgebraicDataflowArchitectureModel/src/application/views/controlFlowDelegation/FlowLayerWindow.java +++ /dev/null @@ -1,98 +0,0 @@ -package application.views.controlFlowDelegation; - -import application.ApplicationWindow; -import application.editor.Editor; -import application.editor.IStageChangeListener; -import application.editor.Stage; -import application.editor.stages.ControlFlowModelingStage; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -/** - * レイヤー表示 - */ -public class FlowLayerWindow extends JDialog implements IStageChangeListener { - private final String title = "Flow Layer"; - private JCheckBox dataFlowCheckBox = null; - private JCheckBox pushFlowCheckBox = null; - private JCheckBox pullFlowCheckBox = null; - - private ControlFlowModelingStage stage = null; - - public FlowLayerWindow(final ApplicationWindow owner) { - super(owner); - - setTitle(title); - setDefaultCloseOperation(HIDE_ON_CLOSE); - - stage = Editor.STAGE_CONTROL_FLOW_DELEGATION; - - // ボタンの追加 - dataFlowCheckBox = new JCheckBox("Data-Flow", false); - pushFlowCheckBox = new JCheckBox("Push-Flow", true); - pullFlowCheckBox = new JCheckBox("Pull-Flow", true); - - // 各Viewにイベントハンドラを追加 - dataFlowCheckBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - stage.setLayerEnabled(Stage.DATA_FLOW_LAYER, dataFlowCheckBox.isSelected()); - } - }); - - pushFlowCheckBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - stage.setLayerEnabled(Stage.PUSH_FLOW_LAYER, pushFlowCheckBox.isSelected()); - } - }); - - pullFlowCheckBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - stage.setLayerEnabled(Stage.PULL_FLOW_LAYER, pullFlowCheckBox.isSelected()); - } - }); - - dataFlowCheckBox.setEnabled(false); - pushFlowCheckBox.setEnabled(false); - pullFlowCheckBox.setEnabled(false); - - // レイヤーのパネルレイアウトの初期化. - Container panel = getContentPane(); - panel.setLayout(new GridLayout(/*low*/3, /*col*/1)); - panel.add(dataFlowCheckBox); - panel.add(pushFlowCheckBox); - panel.add(pullFlowCheckBox); - - pack(); - setResizable(false); - } - - /** - * ステージが変わったら, レイヤー表示のボタンのアクティブ状態を切り替える. - * - * @param newStage 現在のステージ - */ - @Override - public void stageChanged(Stage newStage) { - if (newStage instanceof ControlFlowModelingStage) { - dataFlowCheckBox.setEnabled(true); - pushFlowCheckBox.setEnabled(true); - pullFlowCheckBox.setEnabled(true); - - newStage.setLayerEnabled(Stage.PUSH_FLOW_LAYER, pushFlowCheckBox.isSelected()); - newStage.setLayerEnabled(Stage.PULL_FLOW_LAYER, pullFlowCheckBox.isSelected()); - } else { - dataFlowCheckBox.setEnabled(false); - pushFlowCheckBox.setEnabled(false); - pullFlowCheckBox.setEnabled(false); - - newStage.setLayerEnabled(Stage.PUSH_FLOW_LAYER, false); - newStage.setLayerEnabled(Stage.PULL_FLOW_LAYER, false); - } - } -} diff --git a/AlgebraicDataflowArchitectureModel/src/models/controlFlowModel/ControlFlowGraph.java b/AlgebraicDataflowArchitectureModel/src/models/controlFlowModel/ControlFlowGraph.java index 2b2cd4f..9ba9daa 100644 --- a/AlgebraicDataflowArchitectureModel/src/models/controlFlowModel/ControlFlowGraph.java +++ b/AlgebraicDataflowArchitectureModel/src/models/controlFlowModel/ControlFlowGraph.java @@ -1,12 +1,7 @@ package models.controlFlowModel; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - import generators.CodeGenerator; +import models.DirectedGraph; import models.Edge; import models.Node; import models.algebra.Expression; @@ -14,9 +9,13 @@ import models.algebra.Variable; import models.dataConstraintModel.Channel; import models.dataConstraintModel.ChannelMember; -import models.DirectedGraph; import models.dataFlowModel.*; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + public class ControlFlowGraph extends DirectedGraph implements IFlowGraph { private DataFlowGraph dataFlowGraph; private CallGraph pushCallGraph; @@ -26,13 +25,13 @@ this.dataFlowGraph = dataFlowGraph; this.pushCallGraph = new CallGraph(); this.pullCallGraph = new CallGraph(); - for (Edge resToCh: dataFlowGraph.getEdges()) { + for (Edge resToCh : dataFlowGraph.getEdges()) { if (!((DataFlowEdge) resToCh).isChannelToResource()) { // A resource to channel edge PushPullAttribute pushPull = ((PushPullAttribute) ((DataFlowEdge) resToCh).getAttribute()); ResourceNode srcResNode = (ResourceNode) resToCh.getSource(); ChannelNode chNode = (ChannelNode) resToCh.getDestination(); - for (Edge chToRes: chNode.getOutEdges()) { + for (Edge chToRes : chNode.getOutEdges()) { ResourceNode dstResNode = (ResourceNode) chToRes.getDestination(); if (!CodeGenerator.generatesComponent(srcResNode.getResourceHierarchy())) { srcResNode = srcResNode.getParent(); @@ -52,10 +51,10 @@ } } } - for (Channel ch: model.getInputChannels()) { + for (Channel ch : model.getInputChannels()) { DataTransferChannel evCh = (DataTransferChannel) ch; EventChannelObjectNode srcNode = new EventChannelObjectNode(evCh); - for (ChannelMember cm: evCh.getChannelMembers()) { + for (ChannelMember cm : evCh.getChannelMembers()) { if (srcNode.getName() == null) { Expression exp = cm.getStateTransition().getMessageExpression(); if (exp instanceof Term) { @@ -64,7 +63,7 @@ srcNode.setName(((Variable) exp).getName()); } } - for (ResourceNode dstResNode: dataFlowGraph.getResourceNodes(cm.getResource().getResourceHierarchy())) { + for (ResourceNode dstResNode : dataFlowGraph.getResourceNodes(cm.getResource().getResourceHierarchy())) { if (!CodeGenerator.generatesComponent(dstResNode.getResourceHierarchy())) { dstResNode = dstResNode.getParent(); } @@ -91,16 +90,16 @@ public CallGraph getPullCallGraph() { return pullCallGraph; } - + @Override public Map> getAllComponentNodes() { Map> allNodeSets = new HashMap<>(); - for (Node n: pushCallGraph.getNodes()) { + for (Node n : pushCallGraph.getNodes()) { Set nodeSet = new HashSet<>(); nodeSet.add(n); allNodeSets.put(n, nodeSet); } - for (Node n: pullCallGraph.getNodes()) { + for (Node n : pullCallGraph.getNodes()) { if (n instanceof StatefulObjectNode) { ResourceNode resNode = ((StatefulObjectNode) n).getResource(); Set nodeSet = null;