modified: src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
Mehrfacher Aufruf von computeCartesianRecursive entfernt
This commit is contained in:
parent
c271c689de
commit
9717c54d53
@ -161,7 +161,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
writeLog("UndefinedPairs; " + undefinedPairs);
|
writeLog("UndefinedPairs; " + undefinedPairs);
|
||||||
Set<Set<UnifyPair>> error = new HashSet<>();
|
Set<Set<UnifyPair>> error = new HashSet<>();
|
||||||
undefinedPairs = undefinedPairs.stream().map(x -> { x.setUndefinedPair(); return x;}).collect(Collectors.toCollection(HashSet::new));
|
undefinedPairs = undefinedPairs.stream().map(x -> { x.setUndefinedPair(); return x;}).collect(Collectors.toCollection(HashSet::new));
|
||||||
//error.add(undefinedPairs);
|
error.add(undefinedPairs);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +309,14 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
|
|
||||||
Set<Set<UnifyPair>> computeCartesianRecursive(Set<Set<UnifyPair>> fstElems, ArrayList<Set<Set<UnifyPair>>> topLevelSets, Set<UnifyPair> eq, IFiniteClosure fc, boolean parallel) {
|
Set<Set<UnifyPair>> computeCartesianRecursive(Set<Set<UnifyPair>> fstElems, ArrayList<Set<Set<UnifyPair>>> topLevelSets, Set<UnifyPair> eq, IFiniteClosure fc, boolean parallel) {
|
||||||
ArrayList<Set<Set<UnifyPair>>> remainingSets = new ArrayList<>(topLevelSets);
|
//ArrayList<Set<Set<UnifyPair>>> 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<Set<Set<UnifyPair>>> remainingSets = topLevelSets.stream()
|
||||||
|
.filter(x -> x.size()>1)
|
||||||
|
.collect(Collectors.toCollection(ArrayList::new));
|
||||||
Set<Set<UnifyPair>> nextSet = remainingSets.remove(0);
|
Set<Set<UnifyPair>> nextSet = remainingSets.remove(0);
|
||||||
writeLog("nextSet: " + nextSet.toString());
|
writeLog("nextSet: " + nextSet.toString());
|
||||||
List<Set<UnifyPair>> nextSetasList =new ArrayList<>(nextSet);
|
List<Set<UnifyPair>> nextSetasList =new ArrayList<>(nextSet);
|
||||||
@ -394,7 +401,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
result.addAll(unify2(elems, eq, fc, parallel));
|
result.addAll(unify2(elems, eq, fc, parallel));
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
}
|
}
|
||||||
else {
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user