KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > corext > refactoring > typeconstraints2 > ReturnTypeVariable2


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
12 package org.eclipse.jdt.internal.corext.refactoring.typeconstraints2;
13
14 import org.eclipse.jdt.core.ICompilationUnit;
15 import org.eclipse.jdt.core.dom.IMethodBinding;
16
17 import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType;
18
19 /**
20  * A ReturnTypeVariable is a ConstraintVariable which stands for
21  * the return type of a method.
22  */

23 public final class ReturnTypeVariable2 extends ConstraintVariable2 implements ISourceConstraintVariable {
24
25     private final String JavaDoc fKey;
26     private ICompilationUnit fCompilationUnit;
27
28     public ReturnTypeVariable2(TType type, IMethodBinding binding) {
29         super(type);
30         fKey= binding.getKey();
31     }
32
33     public String JavaDoc getKey() {
34         return fKey;
35     }
36
37     /*
38      * @see java.lang.Object#hashCode()
39      */

40     public int hashCode() {
41         return getKey().hashCode();
42     }
43
44     /*
45      * @see java.lang.Object#equals(java.lang.Object)
46      */

47     public boolean equals(Object JavaDoc other) {
48         if (this == other)
49             return true;
50         if (other.getClass() != ReturnTypeVariable2.class)
51             return false;
52         
53         ReturnTypeVariable2 other2= (ReturnTypeVariable2) other;
54         return getKey().equals(other2.getKey());
55     }
56
57     public void setCompilationUnit(ICompilationUnit unit) {
58         fCompilationUnit= unit;
59     }
60
61     public ICompilationUnit getCompilationUnit() {
62         return fCompilationUnit;
63     }
64 }
65
Popular Tags