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