KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > text > correction > SimilarElement


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.ui.text.correction;
12
13 import java.util.Arrays JavaDoc;
14
15 public class SimilarElement {
16
17     private final int fKind;
18     private final String JavaDoc fName;
19     private final String JavaDoc[] fTypesParameters;
20     private final int fRelevance;
21
22     public SimilarElement(int kind, String JavaDoc name, int relevance) {
23         this(kind, name, null, relevance);
24     }
25
26     public SimilarElement(int kind, String JavaDoc name, String JavaDoc[] typesParameters, int relevance) {
27         fKind= kind;
28         fName= name;
29         fTypesParameters= typesParameters;
30         fRelevance= relevance;
31     }
32
33     /**
34      * Gets the kind.
35      * @return Returns a int
36      */

37     public int getKind() {
38         return fKind;
39     }
40
41     /**
42      * Gets the parameter types.
43      * @return Returns a int
44      */

45     public String JavaDoc[] getTypesParameter() {
46         return fTypesParameters;
47     }
48
49     /**
50      * Gets the name.
51      * @return Returns a String
52      */

53     public String JavaDoc getName() {
54         return fName;
55     }
56
57     /**
58      * Gets the relevance.
59      * @return Returns a int
60      */

61     public int getRelevance() {
62         return fRelevance;
63     }
64
65     /* (non-Javadoc)
66      * @see Object#equals(Object)
67      */

68     public boolean equals(Object JavaDoc obj) {
69         if (obj instanceof SimilarElement) {
70             SimilarElement elem= (SimilarElement) obj;
71             return fName.equals(elem.fName) && fKind == elem.fKind && Arrays.equals(fTypesParameters, elem.fTypesParameters);
72         }
73         return false;
74     }
75
76     /* (non-Javadoc)
77      * @see Object#hashCode()
78      */

79     public int hashCode() {
80         return fName.hashCode() + fKind;
81     }
82 }
83
Popular Tags