delegate不可能な場所にdelegate出来ていたバグを修正.
1 parent 6f9dbb1 commit a6472b79486c7f1f389eda4e55ba4fc4a07671ba
k-fujii authored on 21 Jun 2023
Showing 2 changed files
View
38
AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowDelegationCellEditor.java
 
import application.editor.FlowCellEditor;
import application.editor.Stage;
import models.controlFlowModel.CallEdgeAttribute;
import models.controlFlowModel.ControlFlowDelegator;
import models.controlFlowModel.ObjectNode;
import models.controlFlowModel.ObjectNodeAttribute;
import models.dataFlowModel.PushPullValue;
 
/*************************************************************
public void startEditing(Object cellObj, EventObject eventObj) {
if( editingCell != null) stopEditing(true);
System.out.println("state:" + curState.name());
ControlFlowDelegationStage curStage = (ControlFlowDelegationStage)stage;
switch(curState) {
case SELECTING_AN_EDGE:
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();
 
// invocating delegation method
if(!(cellObj instanceof mxCell)) throw new ClassCastException();
((ControlFlowDelegationStage)stage)
.showDelegatedGraph(graphComponent.getGraph(), targetEdgeCell, (mxCell)cellObj);
CallEdgeAttribute callEdgeAttr = (CallEdgeAttribute)graphComponent.getGraph().getModel().getValue(targetEdgeCell);
if(callEdgeAttr == null) return;
ObjectNode dstObjNode = ((ObjectNodeAttribute)dstCell.getValue()).getObjectNode();
if(dstObjNode == null) throw new ClassCastException();
if(!curStage.isExecutableDelegation(callEdgeAttr, dstObjNode)){
JOptionPane.showMessageDialog(graphComponent, "It's impossible for the chose object to delegate.");
return;
}
curStage.showDelegatedGraph(graphComponent.getGraph(), targetEdgeCell, (mxCell)cellObj);
 
curState = ControlFlowDelegationStageStatus.SELECTING_AN_EDGE;
}
else {
System.out.println("cancel showing state.");
((ControlFlowDelegationStage)stage). resetAllStyleOfCells();
curStage.resetAllStyleOfCells();
curState = ControlFlowDelegationStageStatus.SELECTING_AN_EDGE;
}
break;
}
public void stopEditing(boolean cancel) {
 
}
 
/*************************************************************
* [ *private ]
/*************************************************************
* [ view ]
JOptionPane.showMessageDialog(graphComponent, "You must input a name. \nIt mustn't be empty.");
return;
}
CallEdgeAttribute callEdgeAttr = null;
if(edgeCell.getValue() instanceof CallEdgeAttribute) {
callEdgeAttr = (CallEdgeAttribute)edgeCell.getValue();
}
else throw new ClassCastException();
 
if( isDuplicatedName(objName) ) {
JOptionPane.showMessageDialog(graphComponent, "The named object has already existed.");
return;
}
View
23
AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowDelegationStage.java
}
/*************************************************************
* Inserting an intermediation object type of <Object-Node>.
* todo: support to PUSH/PULL-layer
*/
public void insertObjectNodeCellInControlFlowLayer(mxGraph graph, mxCell targetEdge, final String insertObjName) {
CallEdgeAttribute callEdgeAttr = (CallEdgeAttribute)targetEdge.getValue();
if(callEdgeAttr == null) throw new NullPointerException();
finally {
graph.getModel().endUpdate();
}
}
 
/*************************************************************
*
*/
public boolean isExecutableDelegation(final CallEdgeAttribute targetEdgeAttr, final ObjectNode dstObjNode) {
ControlFlowDelegator delegator = new ControlFlowDelegator(controlFlowGraph);
List<ObjectNode> delegatableNodes = delegator.searchDelegatableNodes(targetEdgeAttr.getCallEdge());
return delegatableNodes.contains(dstObjNode);
}
/*************************************************************
* [ *private ]
/*************************************************************