forked from JavaTX/JavaCompilerCore
40 lines
886 B
Java
40 lines
886 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> buildMenge = new Menge<Pair>();
|
|
|
|
public void addPair(Type t1, Type t2) {
|
|
buildMenge.add(new Pair(t1, t2));
|
|
}
|
|
|
|
public void addPair(Type t1, Type t2, PairOperator pairOp) {
|
|
buildMenge.add(new Pair(t1, t2, pairOp));
|
|
}
|
|
|
|
public Menge<Pair> getPairMenge() {
|
|
return buildMenge;
|
|
}
|
|
|
|
public Menge<Menge<Pair>> getNestedPairMenge() {
|
|
Menge<Menge<Pair>> nested = new Menge<>();
|
|
|
|
for(Pair p : buildMenge) {
|
|
Menge<Pair> m = new Menge<Pair>();
|
|
m.add(p);
|
|
nested.add(m);
|
|
}
|
|
|
|
return nested;
|
|
}
|
|
|
|
public void clear() {
|
|
buildMenge = new Menge<Pair>();
|
|
}
|
|
}
|