diff --git a/src/de/dhbwstuttgart/typeinference/unify/model/WildcardType.java b/src/de/dhbwstuttgart/typeinference/unify/model/WildcardType.java new file mode 100644 index 00000000..08c49783 --- /dev/null +++ b/src/de/dhbwstuttgart/typeinference/unify/model/WildcardType.java @@ -0,0 +1,34 @@ +package de.dhbwstuttgart.typeinference.unify.model; + +public abstract class WildcardType extends UnifyType { + + protected UnifyType wildcardedType; + + protected WildcardType(String name, UnifyType wildcardedType, UnifyType[] typeParams) { + super(name, typeParams); + this.wildcardedType = wildcardedType; + } + + protected WildcardType(String name, UnifyType wildcardedType, TypeParams p) { + super(name, p); + this.wildcardedType = wildcardedType; + } + + public UnifyType getWildcardedType() { + return wildcardedType; + } + + @Override + public int hashCode() { + return wildcardedType.hashCode() + getName().hashCode() + 17; + } + + @Override + public boolean equals(Object obj) { + if(!(obj instanceof WildcardType)) + return false; + + WildcardType other = (WildcardType) obj; + return other.getWildcardedType().equals(wildcardedType); + } +}