29 lines
811 B
Java
29 lines
811 B
Java
package unify;
|
|
|
|
import de.dhbwstuttgart.typeinference.Menge;
|
|
import de.dhbwstuttgart.typeinference.Pair;
|
|
import de.dhbwstuttgart.typeinference.unify.FC_TTO;
|
|
import de.dhbwstuttgart.syntaxtree.Class;
|
|
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
|
import de.dhbwstuttgart.syntaxtree.type.Type;
|
|
|
|
public class Unify_FC_TTO_Builder {
|
|
|
|
private Menge<Pair> fc = new Menge<Pair>();
|
|
private Menge<Class> classes = new Menge<Class>();
|
|
|
|
public void AddInheritance(Type t1, Type t2) {
|
|
if(t1 instanceof RefType)
|
|
classes.add(new Class(t1.get_Name(), t1.getOffset()));
|
|
|
|
if(t2 instanceof RefType)
|
|
classes.add(new Class(t2.get_Name(), t2.getOffset()));
|
|
|
|
fc.add(new Pair(t1, t2));
|
|
}
|
|
|
|
public FC_TTO Get_FC_TTO() {
|
|
return new FC_TTO(fc, (Menge<?>) fc.clone(), classes);
|
|
}
|
|
}
|