From 21bc2a67a1b3eee6b9a1cf4a7c015947b2b6ef50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pl=C3=BCmicke?= Date: Wed, 11 Apr 2018 16:58:38 +0200 Subject: [PATCH] modified: src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java --- .../typeinference/unify/TypeUnifyTask.java | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index c0fc93ac..a66c4626 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -418,8 +418,11 @@ public class TypeUnifyTask extends RecursiveTask>> { Set> elems = new HashSet>(fstElems); elems.add(a); if (remainingSets.isEmpty()) { - result.addAll(unify2(elems, eq, fc, parallel)); - System.out.println(""); + Set> 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>> { 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>> { } protected boolean isUndefinedPairSetSet(Set> 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;