TypeVar zu subtype von TypePlaceholder gemacht

This commit is contained in:
Pluemicke Martin 2017-05-05 14:28:36 +02:00
parent f48bb2ac0c
commit ce220abaf5
4 changed files with 18 additions and 11 deletions

View File

@ -2,31 +2,30 @@ package de.dhbwstuttgart.strucTypes5.typeVars;
import org.antlr.v4.runtime.Token; import org.antlr.v4.runtime.Token;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
/** /**
* Created by sebastian on 14.04.17. * Created by sebastian on 14.04.17.
*/ */
public class TypeVar extends RefTypeOrTPHOrWildcardOrGeneric { public class TypeVar extends TypePlaceholder {
private String id; //private String id;
public TypeVar(String id) { public TypeVar(String id) {
super(); super(id);
this.id = id;
} }
@Override @Override
public String toString() { public String toString() {
return String.format("TVar_%s" , id); return String.format("TVar_%s" , this.getName());
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj.getClass().equals(TypeVar.class)) { if (obj.getClass().equals(TypeVar.class)) {
TypeVar t = (TypeVar) obj; TypeVar t = (TypeVar) obj;
if (t.id.equals(id)) { if (t.getName().equals(this.getName())) {
return true; return true;
} }
else { else {

View File

@ -3,7 +3,7 @@ package de.dhbwstuttgart.strucTypes5.typeVars;
import de.dhbwstuttgart.strucTypes5.constraints.InterfaceForConstraint; import de.dhbwstuttgart.strucTypes5.constraints.InterfaceForConstraint;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
/** /** LOESCHEN
* Created by sebastian on 30.04.17. * Created by sebastian on 30.04.17.
*/ */
public class TypeVarInterface extends RefTypeOrTPHOrWildcardOrGeneric { public class TypeVarInterface extends RefTypeOrTPHOrWildcardOrGeneric {

View File

@ -4,7 +4,7 @@ package de.dhbwstuttgart.strucTypes5.typeVars;
import de.dhbwstuttgart.strucTypes4.syntaxtree.Class; import de.dhbwstuttgart.strucTypes4.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
/** /**LOESCHEN
* Created by sebastian on 14.04.17. * Created by sebastian on 14.04.17.
*/ */
public class TypeVarType extends RefTypeOrTPHOrWildcardOrGeneric { public class TypeVarType extends RefTypeOrTPHOrWildcardOrGeneric {

View File

@ -18,9 +18,17 @@ public class TypePlaceholder extends RefTypeOrTPHOrWildcardOrGeneric
private static Hashtable<String, TypePlaceholder> m_TypePlaceholdersRegistry = new Hashtable<String, TypePlaceholder>(); private static Hashtable<String, TypePlaceholder> m_TypePlaceholdersRegistry = new Hashtable<String, TypePlaceholder>();
private final String name; final String name;
/**
* Protected Konstruktor - nur noetig für TypVar
* <br>Author: Martin Pluemicke
*/
protected TypePlaceholder(String name)
{
super(null);
this.name = name;
}
/** /**
* Privater Konstruktor - Eine TypePlaceholder-Variable wird �ber die * Privater Konstruktor - Eine TypePlaceholder-Variable wird �ber die