KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > ba > XMethodParameter


1 /*
2  * FindBugs - Find Bugs in Java programs
3  * Copyright (C) 2005, University of Maryland
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19
20 package edu.umd.cs.findbugs.ba;
21
22 /**
23  * @author pugh
24  */

25 public class XMethodParameter implements Comparable JavaDoc<XMethodParameter>{
26     public XMethodParameter(XMethod m, int p) {
27         method = m;
28         parameter = p;
29     }
30     private final XMethod method;
31     private final int parameter;
32     public XMethod getMethod() {
33         return method;
34     }
35     public int getParameterNumber() {
36         return parameter;
37     }
38     @Override JavaDoc
39          public boolean equals(Object JavaDoc o) {
40         if (!(o instanceof XMethodParameter)) return false;
41         XMethodParameter mp2 = (XMethodParameter) o;
42         return parameter == mp2.parameter && method.equals(mp2.method);
43     }
44     @Override JavaDoc
45          public int hashCode() {
46         return method.hashCode() + parameter;
47     }
48     public int compareTo(XMethodParameter mp2) {
49         int result = method.compareTo(mp2.method);
50         if (result != 0) return result;
51         return parameter - mp2.parameter;
52     }
53     @Override JavaDoc
54          public String JavaDoc toString() {
55         return "parameter " + parameter + " of " + method;
56     }
57 }
58
Popular Tags