modified: src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java

This commit is contained in:
Martin Plümicke 2018-04-11 16:58:38 +02:00
parent fef4d27d21
commit 21bc2a67a1

View File

@ -418,8 +418,11 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
Set<Set<UnifyPair>> elems = new HashSet<Set<UnifyPair>>(fstElems);
elems.add(a);
if (remainingSets.isEmpty()) {
result.addAll(unify2(elems, eq, fc, parallel));
System.out.println("");
Set<Set<UnifyPair>> res = unify2(elems, eq, fc, parallel);
if (!isUndefinedPairSetSet(res)) {// && isUndefinedPairSetSet(result)) {//wenn korektes Ergebnis gefunden alle Fehlerfaelle loeschen
result = new HashSet<>();
}
result.addAll(res);
}
else {//duerfte gar nicht mehr vorkommen PL 2018-04-03
result.addAll(computeCartesianRecursive(elems, remainingSets, eq, fc, parallel));
@ -477,12 +480,12 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
writeLog("Durchschnitt: " + durchschnitt.toString());
System.out.println("");
}
if (nextSetasList.size() == 0 && isUndefinedPairSetSet(result) && nextSet.size() > 1) {
return result;
}
else {
result.removeIf(y -> isUndefinedPairSet(y));
}
//if (nextSetasList.size() == 0 && isUndefinedPairSetSet(result) && nextSet.size() > 1) {
// return result;
//}
//else {
// result.removeIf(y -> isUndefinedPairSet(y));
//}
//else result.stream().filter(y -> !isUndefinedPairSet(y));
}
return result;
@ -495,8 +498,8 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
}
protected boolean isUndefinedPairSetSet(Set<Set<UnifyPair>> s) {
if (s.size() ==1) {
Boolean ret = isUndefinedPairSet(s.stream().findFirst().get());
if (s.size() >= 1) {
Boolean ret = s.stream(). map(x -> isUndefinedPairSet(x)).reduce(true, (x,y)-> (x && y));
return ret;
}
return false;