diff --git a/magnetFiles/ArgoUML.magnet b/magnetFiles/ArgoUML.magnet new file mode 100644 index 0000000..e0a91de --- /dev/null +++ b/magnetFiles/ArgoUML.magnet @@ -0,0 +1,63 @@ +{ + "trace": "ArgoUMLBenchmarkWithMoreStandardClasses.trace", + "features": [ + { + "feature": "ArgoUML�폜�@�\", + "extracts": [ + { + "src": { + "class": "public void org.argouml.uml.diagram.ui.ActionRemoveFromDiagram.actionPerformed(", + "id": null + }, + "dst": { + "class": "org.argouml.uml.diagram.static_structure.ui.FigClass", + "id": null + }, + "type": "This-Another", + "order": "0" + }, + { + "src": { + "class": "java.util.Vector", + "id": "450474599" + }, + "dst": { + "class": "org.argouml.uml.diagram.static_structure.ui.FigClass", + "id": "1675174935" + }, + "type": "Container-Component(Collection)", + "order": "0" + } + ] + }, + { + "feature": "ArgoUML�I���@�\", + "extracts": [ + { + "src": { + "class": "org.argouml.uml.diagram.static_structure.ui.SelectionClass", + "id": "1672744985" + }, + "dst": { + "class": "org.argouml.uml.diagram.static_structure.ui.FigClass", + "id": "1675174935" + }, + "type": "Container-Component", + "order": "0" + }, + { + "src": { + "class": "java.util.ArrayList", + "id": "125345735" + }, + "dst": { + "class": "org.argouml.uml.diagram.static_structure.ui.SelectionClass", + "id": "1672744985" + }, + "type": "Container-Component(Collection)", + "order": "0" + } + ] + } + ] +} \ No newline at end of file diff --git a/magnetFiles/JHotDraw.magnet b/magnetFiles/JHotDraw.magnet new file mode 100644 index 0000000..91d30cf --- /dev/null +++ b/magnetFiles/JHotDraw.magnet @@ -0,0 +1,87 @@ +{ + "trace": "jHotDrawBenchmarkWithMoreStandardClasses.trace", + "features": [ + { + "feature": "JHotDraw�ړ��@�\", + "extracts": [ + { + "src": { + "class": "java.util.HashSet", + "id": "176893671" + }, + "dst": { + "class": "org.jhotdraw.draw.RectangleFigure", + "id": "1952912699" + }, + "type": "Container-Component(Collection)", + "order": "0" + } + ] + }, + { + "feature": "JHotDraw�I���@�\", + "extracts": [ + { + "src": { + "class": "org.jhotdraw.draw.tool.DefaultDragTracker", + "id": "758826749" + }, + "dst": { + "class": "org.jhotdraw.draw.RectangleFigure", + "id": "1952912699" + }, + "type": "Container-Component", + "order": "1" + }, + { + "src": { + "class": "java.util.HashSet", + "id": "1378082106" + }, + "dst": { + "class": "org.jhotdraw.draw.RectangleFigure", + "id": "1952912699" + }, + "type": "Container-Component(Collection)", + "order": "0" + }, + { + "src": { + "class": "org.jhotdraw.draw.tool.DelegationSelectionTool", + "id": "599587451" + }, + "dst": { + "class": "org.jhotdraw.draw.tool.DefaultDragTracker", + "id": "758826749" + }, + "type": "Container-Component", + "order": "1" + }, + { + "src": { + "class": "java.util.LinkedHashSet", + "id": "1787265837" + }, + "dst": { + "class": "org.jhotdraw.draw.RectangleFigure", + "id": "1952912699" + }, + "type": "Container-Component(Collection)", + "order": "0" + }, + { + "src": { + "class": "org.jhotdraw.draw.tool.DefaultDragTracker", + "id": "758826749" + }, + "dst": { + "class": "org.jhotdraw.draw.DefaultDrawingEditor", + "id": "1859859960" + }, + "type": "Container-Component", + "order": "3" + } + ] + } + ] +} \ No newline at end of file diff --git a/magnetFiles/TinyProblemA1_B1_C1_D1.magnet b/magnetFiles/TinyProblemA1_B1_C1_D1.magnet new file mode 100644 index 0000000..aa25cef --- /dev/null +++ b/magnetFiles/TinyProblemA1_B1_C1_D1.magnet @@ -0,0 +1,22 @@ +{ + "trace": "pre_Exp1.txt", + "features": [ + { + "feature": "���ۑ�A1/B1/C1/D1", + "extracts": [ + { + "src": { + "class": "E", + "id": null + }, + "dst": { + "class": "C", + "id": null + }, + "type": "Container-Component(Collection)", + "order": "0" + } + ] + } + ] +} \ No newline at end of file diff --git a/magnetFiles/TinyProblemA2_B2_C6_D6.magnet b/magnetFiles/TinyProblemA2_B2_C6_D6.magnet new file mode 100644 index 0000000..40dafe9 --- /dev/null +++ b/magnetFiles/TinyProblemA2_B2_C6_D6.magnet @@ -0,0 +1,22 @@ +{ + "trace": "pre_Exp2.txt", + "features": [ + { + "feature": "���ۑ�A2/B2/C6/D6", + "extracts": [ + { + "src": { + "class": "E", + "id": null + }, + "dst": { + "class": "C", + "id": null + }, + "type": "Container-Component(Collection)", + "order": "0" + } + ] + } + ] +} \ No newline at end of file diff --git a/magnetFiles/TinyProblemA3_B3_C5_D5.magnet b/magnetFiles/TinyProblemA3_B3_C5_D5.magnet new file mode 100644 index 0000000..49491bc --- /dev/null +++ b/magnetFiles/TinyProblemA3_B3_C5_D5.magnet @@ -0,0 +1,22 @@ +{ + "trace": "pre_Exp3.txt", + "features": [ + { + "feature": "���ۑ�A3/B3/C5/D5", + "extracts": [ + { + "src": { + "class": "E", + "id": null + }, + "dst": { + "class": "C", + "id": null + }, + "type": "Container-Component(Collection)", + "order": "0" + } + ] + } + ] +} \ No newline at end of file diff --git a/magnetFiles/TinyProblemA4_B4_C4_D4.magnet b/magnetFiles/TinyProblemA4_B4_C4_D4.magnet new file mode 100644 index 0000000..96e7518 --- /dev/null +++ b/magnetFiles/TinyProblemA4_B4_C4_D4.magnet @@ -0,0 +1,22 @@ +{ + "trace": "pre_Exp4.txt", + "features": [ + { + "feature": "���ۑ�A4/B4/C4/D4", + "extracts": [ + { + "src": { + "class": "E", + "id": null + }, + "dst": { + "class": "C", + "id": null + }, + "type": "Container-Component(Collection)", + "order": "0" + } + ] + } + ] +} \ No newline at end of file diff --git a/magnetFiles/TinyProblemA5_B5_C3_D3.magnet b/magnetFiles/TinyProblemA5_B5_C3_D3.magnet new file mode 100644 index 0000000..d84da76 --- /dev/null +++ b/magnetFiles/TinyProblemA5_B5_C3_D3.magnet @@ -0,0 +1,22 @@ +{ + "trace": "pre_Exp5.txt", + "features": [ + { + "feature": "���ۑ�A5/B5/C3/D3", + "extracts": [ + { + "src": { + "class": "E", + "id": null + }, + "dst": { + "class": "C", + "id": null + }, + "type": "Container-Component(Collection)", + "order": "0" + } + ] + } + ] +} \ No newline at end of file diff --git a/magnetFiles/TinyProblemA6_B6_C2_D2.magnet b/magnetFiles/TinyProblemA6_B6_C2_D2.magnet new file mode 100644 index 0000000..2ade70a --- /dev/null +++ b/magnetFiles/TinyProblemA6_B6_C2_D2.magnet @@ -0,0 +1,22 @@ +{ + "trace": "pre_Exp7.txt", + "features": [ + { + "feature": "���ۑ�A6/B6/C2/D2", + "extracts": [ + { + "src": { + "class": "E", + "id": null + }, + "dst": { + "class": "C", + "id": null + }, + "type": "Container-Component(Collection)", + "order": "0" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/org/ntlab/deltaViewer/MagnetRONFrame.java b/src/org/ntlab/deltaViewer/MagnetRONFrame.java index c7d6f75..1c8c6d7 100644 --- a/src/org/ntlab/deltaViewer/MagnetRONFrame.java +++ b/src/org/ntlab/deltaViewer/MagnetRONFrame.java @@ -47,7 +47,7 @@ public class MagnetRONFrame extends JFrame implements IMagnetRON { private static Dimension DEFAULT_SIZE = new Dimension(1300, 700); - private static String WINDOW_TITLE = "Delta Viewer"; + private static String WINDOW_TITLE = "MagnetRON Viewer "; private TraceJSON trace = null; private DeltaExtractorJSON s = null; @@ -140,7 +140,12 @@ Map magnetJson = MagnetronParser.doParse(reader); reader.close(); if (magnetJson.get("trace") != null) { - trace = new TraceJSON(file.getParent() + "\\" + magnetJson.get("trace")); + String tracesPath = file.getParent(); + if (tracesPath.contains("magnetFiles")) { + tracesPath = tracesPath.substring(0, tracesPath.lastIndexOf('\\') + 1) + "traces"; + } + trace = new TraceJSON(tracesPath + "\\" + magnetJson.get("trace")); +// trace = new TraceJSON(file.getParent() + "\\" + magnetJson.get("trace")); s = new DeltaExtractorJSON(trace); if (magnetJson.get("features") != null) { features = (List) magnetJson.get("features"); @@ -158,6 +163,10 @@ @Override public void doExtract(Feature feature) { Map.Entry extracted = extractMulti(feature); + if (feature.getName() != null) { + WINDOW_TITLE = feature.getName() + " "; + setTitle(WINDOW_TITLE); + } objectCallGraph = extracted.getKey(); aliasCollector = extracted.getValue(); } @@ -499,8 +508,13 @@ List relatedPoints = objectCallGraph.getRelatedPoints(); TracePoint lastRP = relatedPoints.get(relatedPoints.size() - 1); Map.Entry rpInf = MagnetRONViewer.getRelatedInformation(lastRP); - WINDOW_TITLE = "extract delta of:" + rpInf.getKey().getSrcClassName() + "(" + rpInf.getKey().getSrcObjectId() + ")" + " -> " + rpInf.getKey().getDstClassName()+ "(" + rpInf.getKey().getDstObjectId()+ ")"; - setTitle(WINDOW_TITLE); + if (WINDOW_TITLE.contains("extract delta of")) { + String[] splits = WINDOW_TITLE.split("extract delta of"); + String featureName = splits[0]; + WINDOW_TITLE = featureName; + } + WINDOW_TITLE += "extract delta of:" + rpInf.getKey().getSrcClassName() + "(" + rpInf.getKey().getSrcObjectId() + ")" + " -> " + rpInf.getKey().getDstClassName()+ "(" + rpInf.getKey().getDstObjectId()+ ")"; + setTitle(WINDOW_TITLE); viewer.clear(); viewer.init(objectCallGraph, aliasCollector, new CollaborationLayout()); @@ -561,7 +575,7 @@ TracePoint lastRP = relatedPoints.get(relatedPoints.size() - 1); Map.Entry rpInf = MagnetRONViewer.getRelatedInformation(lastRP); WINDOW_TITLE = "extract delta of:" + rpInf.getKey().getSrcClassName() + "(" + rpInf.getKey().getSrcObjectId() + ")" + " -> " + rpInf.getKey().getDstClassName()+ "(" + rpInf.getKey().getDstObjectId()+ ")"; - setTitle(WINDOW_TITLE); + setTitle(WINDOW_TITLE); } viewer.init(ocg, ac, new CollaborationLayout()); diff --git a/src/org/ntlab/deltaViewer/MagnetRONMenuBar.java b/src/org/ntlab/deltaViewer/MagnetRONMenuBar.java index 1e330cc..6530248 100644 --- a/src/org/ntlab/deltaViewer/MagnetRONMenuBar.java +++ b/src/org/ntlab/deltaViewer/MagnetRONMenuBar.java @@ -2,13 +2,12 @@ import java.util.List; +import javax.swing.JCheckBox; import javax.swing.JMenu; import javax.swing.JMenuBar; import org.ntlab.actions.ExtractAction; import org.ntlab.actions.OpenAction; -import org.ntlab.actions.StartAnimationAction; -import org.ntlab.actions.StopAnimationAction; import org.ntlab.actions.ZoomInAction; import org.ntlab.actions.ZoomOutAction; import org.ntlab.featureExtractor.Feature; @@ -28,15 +27,15 @@ extractsMenu = add(new JMenu("�@�\���o")); JMenu animationSettingMenu = add(new JMenu("�A�j���[�V�����ݒ�")); - + JCheckBox defaultCheck = new JCheckBox("�ʏ�", true); + defaultCheck.addActionListener(new ZoomActualAction(magnetRON.getViewer())); + defaultCheck.setEnabled(false); + animationSettingMenu.add(defaultCheck); + JMenu viewMenu = add(new JMenu("�\��")); viewMenu.add(new ZoomInAction(magnetRON.getViewer())); viewMenu.add(new ZoomOutAction(magnetRON.getViewer())); - viewMenu.add(new ZoomActualAction(magnetRON.getViewer())); - - JMenu animationMenu = add(new JMenu("�A�j���[�V����")); - animationMenu.add(new StartAnimationAction(magnetRON)); - animationMenu.add(new StopAnimationAction(magnetRON)); + viewMenu.add(new ZoomActualAction(magnetRON.getViewer())); } public void updateExtractsMenu(List features) { diff --git a/src/org/ntlab/deltaViewer/MagnetRONViewer.java b/src/org/ntlab/deltaViewer/MagnetRONViewer.java index 84808f0..9e281c5 100644 --- a/src/org/ntlab/deltaViewer/MagnetRONViewer.java +++ b/src/org/ntlab/deltaViewer/MagnetRONViewer.java @@ -656,11 +656,12 @@ mxCell objectVertexCell = ((mxCell) objectVertex.getCell()); if (objectVertexCell != null) { int time = 0; - for (int i = 0; i < objectVertexCell.getChildCount(); i++) { - if (!(objectVertexCell.getChildAt(i).getId()).contains("clone")) { - time++; - } - } +// for (int i = 0; i < objectVertexCell.getChildCount(); i++) { +// if (!(objectVertexCell.getChildAt(i).getId()).contains("clone")) { +// time++; +// } +// } + time = countChildVertex(objectVertex); if (time == 0) { time = 1; } @@ -673,6 +674,11 @@ double overlapY = (targetDimension.getHeight() - objectVertexCell.getGeometry().getHeight()) / 2 / Math.sqrt(2); System.out.println("updateVertexObjectPosition: " + objectVertexCell.getGeometry().getX() + " - " + overlapX); mxPoint targetPoint = new mxPoint(objectVertexCell.getGeometry().getX() - overlapX, objectVertexCell.getGeometry().getY() + overlapY); + int idxFromParent = objectVertexCell.getParent().getIndex(objectVertexCell); + if (idxFromParent >= 2) { + overlapY = (targetDimension.getHeight() - objectVertexCell.getGeometry().getHeight()) / 2; + targetPoint.setY(objectVertexCell.getGeometry().getY() + overlapY); + } for (MethodExecutionVertex methodExecVertex: methodExecToVertexMap.values()) { List arguments = methodExecVertex.getArguments(); if (arguments != null && arguments.contains(objectVertex)) { diff --git a/traces/JHotDraw.magnet b/traces/JHotDraw.magnet index ca10024..91d30cf 100644 --- a/traces/JHotDraw.magnet +++ b/traces/JHotDraw.magnet @@ -2,7 +2,7 @@ "trace": "jHotDrawBenchmarkWithMoreStandardClasses.trace", "features": [ { - "feature": "JHotDraw�}�`�ړ��@�\", + "feature": "JHotDraw�ړ��@�\", "extracts": [ { "src": { diff --git a/traces/TinyProblemA1_B1_C1_D1.magnet b/traces/TinyProblemA1_B1_C1_D1.magnet new file mode 100644 index 0000000..aa25cef --- /dev/null +++ b/traces/TinyProblemA1_B1_C1_D1.magnet @@ -0,0 +1,22 @@ +{ + "trace": "pre_Exp1.txt", + "features": [ + { + "feature": "���ۑ�A1/B1/C1/D1", + "extracts": [ + { + "src": { + "class": "E", + "id": null + }, + "dst": { + "class": "C", + "id": null + }, + "type": "Container-Component(Collection)", + "order": "0" + } + ] + } + ] +} \ No newline at end of file diff --git a/traces/TinyProblemA2_B2_C6_D6.magnet b/traces/TinyProblemA2_B2_C6_D6.magnet new file mode 100644 index 0000000..40dafe9 --- /dev/null +++ b/traces/TinyProblemA2_B2_C6_D6.magnet @@ -0,0 +1,22 @@ +{ + "trace": "pre_Exp2.txt", + "features": [ + { + "feature": "���ۑ�A2/B2/C6/D6", + "extracts": [ + { + "src": { + "class": "E", + "id": null + }, + "dst": { + "class": "C", + "id": null + }, + "type": "Container-Component(Collection)", + "order": "0" + } + ] + } + ] +} \ No newline at end of file diff --git a/traces/TinyProblemA3_B3_C5_D5.magnet b/traces/TinyProblemA3_B3_C5_D5.magnet new file mode 100644 index 0000000..49491bc --- /dev/null +++ b/traces/TinyProblemA3_B3_C5_D5.magnet @@ -0,0 +1,22 @@ +{ + "trace": "pre_Exp3.txt", + "features": [ + { + "feature": "���ۑ�A3/B3/C5/D5", + "extracts": [ + { + "src": { + "class": "E", + "id": null + }, + "dst": { + "class": "C", + "id": null + }, + "type": "Container-Component(Collection)", + "order": "0" + } + ] + } + ] +} \ No newline at end of file diff --git a/traces/TinyProblemA4_B4_C4_D4.magnet b/traces/TinyProblemA4_B4_C4_D4.magnet new file mode 100644 index 0000000..96e7518 --- /dev/null +++ b/traces/TinyProblemA4_B4_C4_D4.magnet @@ -0,0 +1,22 @@ +{ + "trace": "pre_Exp4.txt", + "features": [ + { + "feature": "���ۑ�A4/B4/C4/D4", + "extracts": [ + { + "src": { + "class": "E", + "id": null + }, + "dst": { + "class": "C", + "id": null + }, + "type": "Container-Component(Collection)", + "order": "0" + } + ] + } + ] +} \ No newline at end of file diff --git a/traces/TinyProblemA5_B5_C3_D3.magnet b/traces/TinyProblemA5_B5_C3_D3.magnet new file mode 100644 index 0000000..d84da76 --- /dev/null +++ b/traces/TinyProblemA5_B5_C3_D3.magnet @@ -0,0 +1,22 @@ +{ + "trace": "pre_Exp5.txt", + "features": [ + { + "feature": "���ۑ�A5/B5/C3/D3", + "extracts": [ + { + "src": { + "class": "E", + "id": null + }, + "dst": { + "class": "C", + "id": null + }, + "type": "Container-Component(Collection)", + "order": "0" + } + ] + } + ] +} \ No newline at end of file diff --git a/traces/TinyProblemA6_B6_C2_D2.magnet b/traces/TinyProblemA6_B6_C2_D2.magnet new file mode 100644 index 0000000..2ade70a --- /dev/null +++ b/traces/TinyProblemA6_B6_C2_D2.magnet @@ -0,0 +1,22 @@ +{ + "trace": "pre_Exp7.txt", + "features": [ + { + "feature": "���ۑ�A6/B6/C2/D2", + "extracts": [ + { + "src": { + "class": "E", + "id": null + }, + "dst": { + "class": "C", + "id": null + }, + "type": "Container-Component(Collection)", + "order": "0" + } + ] + } + ] +} \ No newline at end of file