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