From 2e3042925232a05adb6a7b94427e3980066a7b73 Mon Sep 17 00:00:00 2001 From: Florian Steurer Date: Mon, 4 Apr 2016 10:18:34 +0200 Subject: [PATCH] added wildcardtype --- .../unify/model/WildcardType.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/de/dhbwstuttgart/typeinference/unify/model/WildcardType.java 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); + } +}