diff --git a/src/org/ntlab/deltaViewer/CollaborationAliasCollector.java b/src/org/ntlab/deltaViewer/CollaborationAliasCollector.java index 979f5f7..f53236d 100644 --- a/src/org/ntlab/deltaViewer/CollaborationAliasCollector.java +++ b/src/org/ntlab/deltaViewer/CollaborationAliasCollector.java @@ -8,6 +8,8 @@ import org.ntlab.deltaExtractor.Alias; import org.ntlab.deltaExtractor.IAliasCollector; import org.ntlab.featureExtractor.Extract; +import org.ntlab.trace.MethodExecution; +import org.ntlab.trace.TracePoint; /** * CollaborationAliasCollector is IAliasCollector implementation class to merge aliasList in time stamp order. @@ -52,8 +54,13 @@ if (extract != null && extract.isToConnect() && otherIdx == 0) { Alias thisPrevAlias = aliasList.get(aliasList.size() - 1); if (!otherAlias.getMethodExecution().isStatic() && otherAlias.getMethodExecution().getCallerMethodExecution() != thisPrevAlias.getMethodExecution()) { - // Add a dummy alias to connect disjunct call hierarchies. - aliasList.add(new Alias(Alias.AliasType.RECEIVER, 0, otherAlias.getMethodExecution().getThisObjId(), thisPrevAlias.getOccurrencePoint())); + // Add a dummy alias to connect disjunct call hierarchies. (thisPrevAlias -> otherAlias) + MethodExecution caller = thisPrevAlias.getMethodExecution(); + MethodExecution callee = otherAlias.getMethodExecution(); + DummyMethodInvocation dummyInv = new DummyMethodInvocation(callee, caller.getThisClassName(), caller.getThisObjId(), 0, thisPrevAlias.getOccurrencePoint().getStatement().getThreadNo()); + dummyInv.setTimeStamp(callee.getEntryTime()); + DummyTracePoint dummyTp = new DummyTracePoint(caller, dummyInv); + aliasList.add(new Alias(Alias.AliasType.RECEIVER, 0, callee.getThisObjId(), dummyTp)); thisIdx++; } } @@ -73,8 +80,13 @@ if (extract != null && extract.isToConnect() && otherIdx == 0 && thisIdx > 0) { Alias thisPrevAlias = aliasList.get(thisIdx - 1); if (!otherAlias.getMethodExecution().isStatic() && otherAlias.getMethodExecution().getCallerMethodExecution() != thisPrevAlias.getMethodExecution()) { - // Add a dummy alias to connect disjunct call hierarchies. - aliasList.add(thisIdx, new Alias(Alias.AliasType.RECEIVER, 0, otherAlias.getMethodExecution().getThisObjId(), thisPrevAlias.getOccurrencePoint())); + // Add a dummy alias to connect disjunct call hierarchies. (thisPrevAlias -> otherAlias) + MethodExecution caller = thisPrevAlias.getMethodExecution(); + MethodExecution callee = otherAlias.getMethodExecution(); + DummyMethodInvocation dummyInv = new DummyMethodInvocation(callee, caller.getThisClassName(), caller.getThisObjId(), 0, thisPrevAlias.getOccurrencePoint().getStatement().getThreadNo()); + dummyInv.setTimeStamp(callee.getEntryTime()); + DummyTracePoint dummyTp = new DummyTracePoint(caller, dummyInv); + aliasList.add(new Alias(Alias.AliasType.RECEIVER, 0, callee.getThisObjId(), dummyTp)); thisIdx++; } } @@ -84,8 +96,13 @@ if (extract != null && extract.isToConnect() && thisOrgIdx == 0 && otherIdx > 0) { Alias otherPrevAlias = otherAliasList.get(otherIdx - 1); if (!thisAlias.getMethodExecution().isStatic() && thisAlias.getMethodExecution().getCallerMethodExecution() != otherPrevAlias.getMethodExecution()) { - // Add a dummy alias to connect disjunct call hierarchies. - aliasList.add(thisIdx, new Alias(Alias.AliasType.RECEIVER, 0, thisAlias.getMethodExecution().getThisObjId(), otherPrevAlias.getOccurrencePoint())); + // Add a dummy alias to connect disjunct call hierarchies. (otherPrevAlias -> thisAlias) + MethodExecution caller = otherPrevAlias.getMethodExecution(); + MethodExecution callee = thisAlias.getMethodExecution(); + DummyMethodInvocation dummyInv = new DummyMethodInvocation(callee, caller.getThisClassName(), caller.getThisObjId(), 0, otherPrevAlias.getOccurrencePoint().getStatement().getThreadNo()); + dummyInv.setTimeStamp(callee.getEntryTime()); + DummyTracePoint dummyTp = new DummyTracePoint(caller, dummyInv); + aliasList.add(new Alias(Alias.AliasType.RECEIVER, 0, callee.getThisObjId(), dummyTp)); thisIdx++; } } @@ -105,8 +122,13 @@ Alias thisAlias = aliasList.get(thisIdx); Alias otherPrevAlias = otherAliasList.get(otherIdx - 1); if (!thisAlias.getMethodExecution().isStatic() && thisAlias.getMethodExecution().getCallerMethodExecution() != otherPrevAlias.getMethodExecution()) { - // Add a dummy alias to connect disjunct call hierarchies. - aliasList.add(thisIdx, new Alias(Alias.AliasType.RECEIVER, 0, thisAlias.getMethodExecution().getThisObjId(), otherPrevAlias.getOccurrencePoint())); + // Add a dummy alias to connect disjunct call hierarchies. (otherPrevAlias -> thisAlias) + MethodExecution caller = otherPrevAlias.getMethodExecution(); + MethodExecution callee = thisAlias.getMethodExecution(); + DummyMethodInvocation dummyInv = new DummyMethodInvocation(callee, caller.getThisClassName(), caller.getThisObjId(), 0, otherPrevAlias.getOccurrencePoint().getStatement().getThreadNo()); + dummyInv.setTimeStamp(callee.getEntryTime()); + DummyTracePoint dummyTp = new DummyTracePoint(caller, dummyInv); + aliasList.add(new Alias(Alias.AliasType.RECEIVER, 0, callee.getThisObjId(), dummyTp)); } } }