package org.ntlab.deltaExtractor; import org.ntlab.trace.MethodExecution; import org.ntlab.trace.Statement; import org.ntlab.trace.TracePoint; /** * オブジェクトの参照情報(エイリアス)を表すクラス * @author Isitani * */ public class Alias { private String objectId; private TracePoint occurrencePoint; // 当該オブジェクトの参照が行われている実行箇所に対応するTracePoint private AliasType aliasType; private int index; public enum AliasType { // メソッドへの入口 FORMAL_PARAMETER, THIS, METHOD_INVOCATION, CONSTRACTOR_INVOCATION, // 追跡オブジェクトの切り替え FIELD, CONTAINER, ARRAY_ELEMENT, ARRAY, ARRAY_CREATE, // メソッドからの出口 ACTUAL_ARGUMENT, RECEIVER, RETURN_VALUE } public Alias(AliasType aliasType, int index, String objectId, TracePoint occurrencePoint) { this.aliasType = aliasType; this.index = index; this.objectId = objectId; this.occurrencePoint = occurrencePoint; } public AliasType getAliasType() { return aliasType; } public int getIndex() { return index; } public String getObjectId() { return objectId; } public TracePoint getOccurrencePoint() { return occurrencePoint; } public MethodExecution getMethodExecution() { return occurrencePoint.getMethodExecution(); } public String getMethodSignature() { return occurrencePoint.getMethodExecution().getCallerSideSignature(); } public int getLineNo() { try { Statement statement = occurrencePoint.getStatement(); return statement.getLineNo(); } catch (Exception e) { return -1; } } }