KickJava   Java API By Example, From Geeks To Geeks.

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


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.internal.corext.refactoring.typeconstraints.types.TType;
15
16 /**
17  * A ImmutableTypeVariable is a ConstraintVariable which stands for an
18  * immutable type (without an updatable Source location)
19  */

20
21 public final class ImmutableTypeVariable2 extends ConstraintVariable2 {
22
23     public ImmutableTypeVariable2(TType type) {
24         super(type);
25     }
26
27     /*
28      * @see java.lang.Object#hashCode()
29      */

30     public int hashCode() {
31         return getType().hashCode();
32     }
33
34     /*
35      * @see java.lang.Object#equals(java.lang.Object)
36      */

37     public boolean equals(Object JavaDoc other) {
38         if (this == other)
39             return true;
40         if (other.getClass() != ImmutableTypeVariable2.class)
41             return false;
42         
43         return getType() == ((ImmutableTypeVariable2) other).getType();
44     }
45     
46     public String JavaDoc toString() {
47         return getType().getPrettySignature();
48     }
49 }
50
Popular Tags