diff --git a/org.ntlab.traceCollector/src/org/ntlab/traceCollector/tracer/trace/Alias.java b/org.ntlab.traceCollector/src/org/ntlab/traceCollector/tracer/trace/Alias.java index 4ffeaff..e2ce931 100644 --- a/org.ntlab.traceCollector/src/org/ntlab/traceCollector/tracer/trace/Alias.java +++ b/org.ntlab.traceCollector/src/org/ntlab/traceCollector/tracer/trace/Alias.java @@ -32,8 +32,7 @@ public static final int OCCURRENCE_EXP_ARRAY = 1; public static final int OCCURRENCE_EXP_FIRST_ARG = 1; public static final int OCCURRENCE_EXP_RETURN = -1; - - + public Alias(String objectId, TracePoint occurrencePoint, int occurrenceExp) { this.objectId = objectId; this.occurrencePoint = occurrencePoint; @@ -55,6 +54,11 @@ public MethodExecution getMethodExecution() { return occurrencePoint.getMethodExecution(); } + + public String getMethodExecutionClassName() { + MethodExecution methodExecution = occurrencePoint.getMethodExecution(); + return Trace.getDeclaringType(methodExecution.getSignature(), methodExecution.isConstructor()); + } public String getMethodSignature() { return occurrencePoint.getMethodExecution().getCallerSideSignature(); @@ -152,6 +156,32 @@ } return className; } + + public String getOccurrenceText() { + String statementType = getStatementType(); + switch (statementType) { + case "FieldAccess": + case "FieldUpdate": + return (occurrenceExp == 0) ? "container" : "field"; + case "ArrayAccess": + case "ArrayUpdate": + return (occurrenceExp == 0) ? "arrayObject" : "arrayValue"; + case "ArrayCreate": + return "return"; + case "MethodInvocation": + if (occurrenceExp <= 0) { + return (occurrenceExp == 0) ? "receiver" : "return"; + } + final String[] ORDER_TEXT = {"th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th"}; // 0-13�ɑΉ� + final String ARG = " arg"; + if (occurrenceExp % 100 >= ORDER_TEXT.length) { + return occurrenceExp + ORDER_TEXT[occurrenceExp % 10] + ARG; // ��2����14�ȏ�Ȃ�, ��1���̐����ɑΉ������� + } else if (occurrenceExp % 100 >= 0) { + return occurrenceExp + ORDER_TEXT[occurrenceExp % 100] + ARG; // ��2����0�ȏ�13�ȉ��Ȃ�, ��2���̐����ɑΉ������� + } + } + return String.valueOf(occurrenceExp); + } @Override public String toString() {