1 package net.sf.jlayercheck.util;
2
3
4
5
6
7
8
9
10 public class MethodCall {
11 @Override
12 public boolean equals(Object obj) {
13 MethodCall other = (MethodCall) obj;
14
15 if (getType() != other.getType()) return false;
16 if (getLineNumber() != other.getLineNumber()) return false;
17
18 String classname1 = getClassName();
19 if (classname1 == null) classname1 = "";
20 String classname2 = other.getClassName();
21 if (classname2 == null) classname2 = "";
22
23 if (!classname1.equals(classname2)) return false;
24
25 String methodname1 = getMethodName();
26 if (methodname1 == null) methodname1 = "";
27 String methodname2 = other.getMethodName();
28 if (methodname2 == null) methodname2 = "";
29
30 if (!methodname1.equals(methodname2)) return false;
31
32 return true;
33 }
34
35 @Override
36 public int hashCode() {
37 return (""+getClassName()+" "+getMethodName()+" "+getLineNumber()+" "+getType()).hashCode();
38 }
39
40 protected String className;
41 protected String methodName;
42
43 public enum Type {
44 CONSTRUCTOR,
45 METHOD
46 };
47
48 protected Type type;
49
50 protected int lineNumber;
51
52 public MethodCall(String className, String methodName, Type type, int lineNumber) {
53 this.className = className;
54 this.methodName = methodName;
55 this.type = type;
56 this.lineNumber = lineNumber;
57 }
58
59 public int getLineNumber() {
60 return lineNumber;
61 }
62
63 public Type getType() {
64 return type;
65 }
66
67 public String getMethodName() {
68 return methodName;
69 }
70
71 public String getClassName() {
72 return className;
73 }
74 }