1 6 package de.uka.ipd.coverage.natures.all_uses; 7 8 import de.uka.ipd.coverage.natures.ISourceCodeLine; 9 import de.uka.ipd.coverage.recording.RegisteredMethod; 10 11 15 public class Definition implements ISourceCodeLine { 16 17 private int line; 18 private int bytecodePos; 19 private RegisteredMethod method; 20 private String variableName; 21 22 public Definition(int sourceCodeLine, 23 int bytecodePos, 24 String variableName, 25 RegisteredMethod method) { 26 this.line = sourceCodeLine; 27 this.bytecodePos = bytecodePos; 28 this.variableName = variableName; 29 this.method = method; 30 } 31 32 public int getSourceCodeLine() { 33 return line; 34 } 35 36 public RegisteredMethod getMethod() { 37 return method; 38 } 39 40 public boolean equals(Object obj) { 41 if (obj instanceof Definition) { 42 Definition def = (Definition) obj; 43 if ( line == def.line 44 && bytecodePos == def.bytecodePos 45 && variableName.equals(def.variableName) 46 && method == def.method ) { 47 return true; 48 } 49 } 50 return false; 51 } 52 53 public int hashCode() { 54 return new Integer (line * bytecodePos).hashCode(); 55 } 56 public String toString() { 57 return "DEF "+variableName+" ["+line+"(Source)/"+bytecodePos+"(Bytecode)] in " + method.getMethod().getName(); } 59 60 public String getVariableName() { 61 return variableName; 62 } 63 } 64 | Popular Tags |