From 9717c54d538d2480152a104c23a8ed1c6ddbbb88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pl=C3=BCmicke?= Date: Tue, 3 Apr 2018 14:16:38 +0200 Subject: [PATCH] modified: src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java Mehrfacher Aufruf von computeCartesianRecursive entfernt --- .../typeinference/unify/TypeUnifyTask.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index e932de0d..8fe9e477 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -161,7 +161,7 @@ public class TypeUnifyTask extends RecursiveTask>> { writeLog("UndefinedPairs; " + undefinedPairs); Set> error = new HashSet<>(); undefinedPairs = undefinedPairs.stream().map(x -> { x.setUndefinedPair(); return x;}).collect(Collectors.toCollection(HashSet::new)); - //error.add(undefinedPairs); + error.add(undefinedPairs); return error; } @@ -309,7 +309,14 @@ public class TypeUnifyTask extends RecursiveTask>> { Set> computeCartesianRecursive(Set> fstElems, ArrayList>> topLevelSets, Set eq, IFiniteClosure fc, boolean parallel) { - ArrayList>> remainingSets = new ArrayList<>(topLevelSets); + //ArrayList>> remainingSets = new ArrayList<>(topLevelSets); + fstElems.addAll(topLevelSets.stream() + .filter(x -> x.size()==1) + .map(y -> y.stream().findFirst().get()) + .collect(Collectors.toCollection(HashSet::new))); + ArrayList>> remainingSets = topLevelSets.stream() + .filter(x -> x.size()>1) + .collect(Collectors.toCollection(ArrayList::new)); Set> nextSet = remainingSets.remove(0); writeLog("nextSet: " + nextSet.toString()); List> nextSetasList =new ArrayList<>(nextSet); @@ -394,7 +401,7 @@ public class TypeUnifyTask extends RecursiveTask>> { result.addAll(unify2(elems, eq, fc, parallel)); System.out.println(""); } - else { + else {//duerfte gar nicht mehr vorkommen PL 2018-04-03 result.addAll(computeCartesianRecursive(elems, remainingSets, eq, fc, parallel)); }