forked from JavaTX/JavaCompilerCore
36 lines
825 B
Java
36 lines
825 B
Java
package unify;
|
|
|
|
import de.dhbwstuttgart.syntaxtree.type.Type;
|
|
import de.dhbwstuttgart.typeinference.Menge;
|
|
import de.dhbwstuttgart.typeinference.Pair;
|
|
import de.dhbwstuttgart.typeinference.Pair.PairOperator;
|
|
|
|
public class UnifyPairMengenBuilder {
|
|
|
|
private Menge<Pair> assumptions = new Menge<Pair>();
|
|
|
|
public void addPair(Type t1, Type t2) {
|
|
assumptions.add(new Pair(t1, t2));
|
|
}
|
|
|
|
public void addPair(Type t1, Type t2, PairOperator pairOp) {
|
|
assumptions.add(new Pair(t1, t2, pairOp));
|
|
}
|
|
|
|
public Menge<Pair> getPairMenge() {
|
|
return assumptions;
|
|
}
|
|
|
|
public Menge<Menge<Pair>> getNestedPairMenge() {
|
|
Menge<Menge<Pair>> nested = new Menge<>();
|
|
|
|
for(Pair p : assumptions) {
|
|
Menge<Pair> m = new Menge<Pair>();
|
|
m.add(p);
|
|
nested.add(m);
|
|
}
|
|
|
|
return nested;
|
|
}
|
|
}
|