1 11 package org.eclipse.jdt.internal.corext.refactoring.typeconstraints2; 12 13 import org.eclipse.core.runtime.Assert; 14 15 public final class SubTypeConstraint2 implements ITypeConstraint2 { 16 17 private final ConstraintVariable2 fAncestor; 18 19 private final ConstraintVariable2 fDescendant; 20 21 public SubTypeConstraint2(final ConstraintVariable2 descendant, final ConstraintVariable2 ancestor) { 22 Assert.isNotNull(descendant); 23 Assert.isNotNull(ancestor); 24 fDescendant= descendant; 25 fAncestor= ancestor; 26 } 27 28 31 public final boolean equals(Object other) { 32 if (other.getClass() != SubTypeConstraint2.class) 34 return false; 35 36 ITypeConstraint2 otherTC= (ITypeConstraint2) other; 37 return fDescendant == otherTC.getLeft() && fAncestor == otherTC.getRight(); 38 } 39 40 public final ConstraintVariable2 getLeft() { 41 return fDescendant; 42 } 43 44 public final ConstraintVariable2 getRight() { 45 return fAncestor; 46 } 47 48 51 public final int hashCode() { 52 return fDescendant.hashCode() ^ 37 * fAncestor.hashCode(); 53 } 54 55 58 public final String toString() { 59 return fDescendant.toString() + " <= " + fAncestor.toString(); } 61 } 62 | Popular Tags |