diff --git a/src/org/ntlab/deltaViewer/MagnetRONFrame.java b/src/org/ntlab/deltaViewer/MagnetRONFrame.java index 2085f29..db60dfa 100644 --- a/src/org/ntlab/deltaViewer/MagnetRONFrame.java +++ b/src/org/ntlab/deltaViewer/MagnetRONFrame.java @@ -28,32 +28,81 @@ protected static final String CONTAINER_COMPONENT = "Container-Component"; protected static final String CONTAINER_COMPONENT_COLLECTION = "Container-Component(Collection)"; protected static final String THIS_ANOTHER = "This-Another"; - - private DeltaViewer viewer = null; - + private static Dimension DEFAULT_SIZE = new Dimension(1300, 700); private static String WINDOW_TITLE = "Delta Viewer"; + private TraceJSON trace = null; + private DeltaExtractorJSON s = null; + + private CollaborationViewer viewer = null; + + private Map argsMap = new HashMap<>(); + public MagnetRONFrame() throws HeadlessException { super(WINDOW_TITLE); setSize(DEFAULT_SIZE); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new BorderLayout()); - this.viewer = new DeltaViewer(); + this.viewer = new CollaborationViewer(); getContentPane().add(viewer, BorderLayout.CENTER); pack(); } public void startAnimation() { - Map.Entry extracted = extract(); + // Change Here! + setArgmentsForDeltaExtract(argsMap); + //���o�������f���^�̈������i�[����Map��key +// String argsKey = "ArgoUMLSelect"; +// String argsKey = "ArgoUMLDelete1"; +// String argsKey = "JHotDrawTransform"; +// String argsKey = "JHotDrawSelect3"; +// String argsKey = "sampleArray"; +// String argsKey = "sampleCollection"; +// String argsKey = "sampleCreate"; +// String argsKey = "sampleStatic"; +// String argsKey = "delta_eg1"; +// String argsKey = "pre_Exp1"; + String argsKey1 = "getterOverlap1"; + String argsKey2 = "getterOverlap2"; +// String argsKey = "setterOverlap1"; +// String argsKey = "worstCase"; +// String argsKey = "sample1"; +// String argsKey = "objTrace5"; + List keys = new ArrayList(); + keys.add(argsKey2); + keys.add(argsKey1); + Map.Entry extracted = extractMulti(keys); new Thread() { public void run() { startDeltaViewer(extracted.getKey(), extracted.getValue()); } }.start(); } + + public Map.Entry extractMulti(List keys) { + CollaborationObjectCallGraph cocg = null; + CollaborationAliasCollector cac = null; + trace = new TraceJSON(argsMap.get(keys.get(0))[4]); + s = new DeltaExtractorJSON(trace); - public Map.Entry extract() { + for(String key: keys) { + Map.Entry extracted = extract(key); + if (cocg == null) { + cocg = new CollaborationObjectCallGraph(extracted.getKey()); + } else { + cocg.merge(extracted.getKey()); + } + if (cac == null) { + cac = new CollaborationAliasCollector(extracted.getValue()); + } else { + cac.merge(extracted.getValue()); + } + } + return new AbstractMap.SimpleEntry(cocg, cac); + } + + public Map.Entry extract(String argsKey) { // DeltaExtractorJSON dex = new DeltaExtractorJSON(trace); // HashMap threads = trace.getAllThreads(); // ThreadInstance thread = threads.values().iterator().next(); // �Ō�̃X���b�h�����Ă��邾���c @@ -133,29 +182,7 @@ // } // } - // Change Here! - Map argsMap = new HashMap<>(); - setArgmentsForDeltaExtract(argsMap); - //���o�������f���^�̈������i�[����Map��key -// String argsKey = "ArgoUMLSelect"; -// String argsKey = "ArgoUMLDelete1"; -// String argsKey = "JHotDrawTransform"; -// String argsKey = "JHotDrawSelect3"; -// String argsKey = "sampleArray"; -// String argsKey = "sampleCollection"; -// String argsKey = "sampleCreate"; -// String argsKey = "sampleStatic"; -// String argsKey = "delta_eg1"; - String argsKey = "pre_Exp1"; -// String argsKey = "getterOverlap1"; -// String argsKey = "setterOverlap1"; -// String argsKey = "worstCase"; -// String argsKey = "sample1"; -// String argsKey = "objTrace5"; - long time = System.nanoTime(); - TraceJSON trace = new TraceJSON(argsMap.get(argsKey)[4]); - DeltaExtractorJSON s = new DeltaExtractorJSON(trace); if (argsMap.get(argsKey)[5] == CONTAINER_COMPONENT || argsMap.get(argsKey)[5] == CONTAINER_COMPONENT_COLLECTION) { HashMap threads = trace.getAllThreads(); @@ -204,18 +231,18 @@ } } - public void startDeltaViewer(ExtractedStructure e, IAliasCollector dac) { + public void startDeltaViewer(IObjectCallGraph ocg, IAliasCollector ac) { // Build a frame, create a graph, and add the graph to the frame so you can actually see the graph. - if(e != null) { - List srcSide = e.getDelta().getSrcSide(); - List dstSide = e.getDelta().getDstSide(); - if (srcSide.size() >= 1 && dstSide.size() >= 1) { - WINDOW_TITLE = "extract delta of:" + e.getDelta().getSrcSide().get(0).getDstClassName() + "(" + e.getDelta().getSrcSide().get(0).getDstObjectId() + ")" + " -> " + e.getDelta().getDstSide().get(0).getDstClassName() + "(" + e.getDelta().getDstSide().get(0).getDstObjectId() + ")"; - setTitle(WINDOW_TITLE); - } + if (ocg != null) { + List relatedPoints = ocg.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); } - viewer.init(e, dac); - List aliasList = new ArrayList<>(dac.getAliasList()); + + viewer.init(ocg, ac, new CollaborationLayout()); + List aliasList = new ArrayList<>(ac.getAliasList()); // dv.setCoordinatorPoint(1200, 100); viewer.initAnimation(); @@ -254,7 +281,7 @@ String[] pre_Exp6 = {null, null, "E","C", "traces/pre_Exp6.txt", CONTAINER_COMPONENT_COLLECTION}; map.put("pre_Exp6", pre_Exp6); String[] pre_Exp7 = {null, null, "E","C", "traces/pre_Exp7.txt", CONTAINER_COMPONENT_COLLECTION}; map.put("pre_Exp7", pre_Exp7); - // Samples of Plural Delta + // Samples of Multiple Deltas String[] getterOverlap1 = {null, null, "getterOverlap.F","getterOverlap.D", "traces/getterOverlap.txt", CONTAINER_COMPONENT_COLLECTION}; map.put("getterOverlap1", getterOverlap1); String[] getterOverlap2 = {null, null, "getterOverlap.G","getterOverlap.D", "traces/getterOverlap.txt", CONTAINER_COMPONENT_COLLECTION}; map.put("getterOverlap2", getterOverlap2); String[] setterOverlap1 = {null, null, "setterOverlap.F","setterOverlap.C", "traces/setterOverlap.txt", CONTAINER_COMPONENT_COLLECTION}; map.put("setterOverlap1", setterOverlap1);