1
package com.thoughtworks.qdox.parser.structs;
3
import java.util.ArrayList;
4
import java.util.HashSet;
8
public class MethodDef extends LocatedDef {
9
public String name = "";
10
public String returns = "";
11
public Set modifiers = new HashSet();
12
public List params = new ArrayList();
13
public Set exceptions = new HashSet();
14
public boolean constructor = false;
15
public int dimensions;
18
public boolean equals(Object obj) {
19
MethodDef methodDef = (MethodDef) obj;
20
return methodDef.name.equals(name)
21
&& methodDef.returns.equals(returns)
22
&& methodDef.modifiers.equals(modifiers)
23
&& methodDef.params.equals(params)
24
&& methodDef.exceptions.equals(exceptions)
25
&& methodDef.constructor == constructor
26
&& methodDef.dimensions == dimensions;
29
public int hashCode() {
30
return name.hashCode() + returns.hashCode() +
31
modifiers.hashCode() + params.hashCode() +
32
params.hashCode() + exceptions.hashCode() +
33
dimensions + (constructor ? 0 : 1);
36
public String toString() {
37
StringBuffer result = new StringBuffer();
38
result.append(modifiers);
40
result.append(returns);
41
for (int i = 0; i < dimensions; i++) result.append("[]");
45
result.append(params);
47
result.append(" throws ");
48
result.append(exceptions);
50
return result.toString();