modified: src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
resuat add in cartesion angepasst modified: src/de/dhbwstuttgart/typeinference/unify/model/Unifier.java modified: src/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java equals in UnfyPair auf UndefinedPairs angepasst
This commit is contained in:
parent
21bc2a67a1
commit
615983bf37
@ -318,7 +318,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
*/
|
*/
|
||||||
eqPrimePrimeSet = eqPrimePrimeSet.stream().filter(x -> isSolvedForm(x) || this.isUndefinedPairSet(x)).collect(Collectors.toCollection(HashSet::new));
|
eqPrimePrimeSet = eqPrimePrimeSet.stream().filter(x -> isSolvedForm(x) || this.isUndefinedPairSet(x)).collect(Collectors.toCollection(HashSet::new));
|
||||||
if (!eqPrimePrimeSet.isEmpty() && !isUndefinedPairSetSet(eqPrimePrimeSet))
|
if (!eqPrimePrimeSet.isEmpty() && !isUndefinedPairSetSet(eqPrimePrimeSet))
|
||||||
writeLog("Result " + eqPrimePrimeSet.toString());
|
writeLog("Result1 " + eqPrimePrimeSet.toString());
|
||||||
return eqPrimePrimeSet;
|
return eqPrimePrimeSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,10 +419,25 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
elems.add(a);
|
elems.add(a);
|
||||||
if (remainingSets.isEmpty()) {
|
if (remainingSets.isEmpty()) {
|
||||||
Set<Set<UnifyPair>> res = unify2(elems, eq, fc, parallel);
|
Set<Set<UnifyPair>> res = unify2(elems, eq, fc, parallel);
|
||||||
if (!isUndefinedPairSetSet(res)) {// && isUndefinedPairSetSet(result)) {//wenn korektes Ergebnis gefunden alle Fehlerfaelle loeschen
|
if (!isUndefinedPairSetSet(res) && isUndefinedPairSetSet(result)) {
|
||||||
result = new HashSet<>();
|
//wenn korrektes Ergebnis gefunden alle Fehlerfaelle loeschen
|
||||||
|
result = res;
|
||||||
}
|
}
|
||||||
result.addAll(res);
|
else {
|
||||||
|
if ((isUndefinedPairSetSet(res) && isUndefinedPairSetSet(result))
|
||||||
|
|| (!isUndefinedPairSetSet(res) && !isUndefinedPairSetSet(result))
|
||||||
|
|| result.isEmpty()) {
|
||||||
|
//alle Fehlerfaelle und alle korrekten Ergebnis jeweils adden
|
||||||
|
result.addAll(res);
|
||||||
|
}
|
||||||
|
//else {
|
||||||
|
//wenn Korrekte Ergebnisse da und Feherfälle dazukommen Fehlerfälle ignorieren
|
||||||
|
// if (isUndefinedPairSetSet(res) && !isUndefinedPairSetSet(result)) {
|
||||||
|
// result = result;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
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));
|
||||||
@ -475,9 +490,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
return (!x.containsAll(durchschnitt));
|
return (!x.containsAll(durchschnitt));
|
||||||
}).collect(Collectors.toCollection(ArrayList::new));
|
}).collect(Collectors.toCollection(ArrayList::new));
|
||||||
writeLog("abhSubst: " + abhSubst.toString());
|
writeLog("abhSubst: " + abhSubst.toString());
|
||||||
|
writeLog("a: " + a.toString());
|
||||||
|
writeLog("Durchschnitt: " + durchschnitt.toString());
|
||||||
writeLog("nextSet: " + nextSet.toString());
|
writeLog("nextSet: " + nextSet.toString());
|
||||||
writeLog("nextSetasList: " + nextSetasList.toString());
|
writeLog("nextSetasList: " + nextSetasList.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) {
|
||||||
|
@ -81,7 +81,8 @@ public class Unifier implements Function<UnifyType, UnifyType>, Iterable<Entry<P
|
|||||||
Set<UnifyPair> suniUnifyPair = new HashSet<>();
|
Set<UnifyPair> suniUnifyPair = new HashSet<>();
|
||||||
suniUnifyPair.addAll(thisAsPair.getAllSubstitutions());
|
suniUnifyPair.addAll(thisAsPair.getAllSubstitutions());
|
||||||
suniUnifyPair.add(thisAsPair);
|
suniUnifyPair.add(thisAsPair);
|
||||||
if (p.getLhsType() instanceof PlaceholderType && newLhs instanceof PlaceholderType && p.getPairOp() == PairOperator.EQUALSDOT) {
|
if (p.getLhsType() instanceof PlaceholderType //&& newLhs instanceof PlaceholderType entfernt PL 2018-04-13
|
||||||
|
&& p.getPairOp() == PairOperator.EQUALSDOT) {
|
||||||
suniUnifyPair.add(p); //p koennte auch subsitution sein
|
suniUnifyPair.add(p); //p koennte auch subsitution sein
|
||||||
}
|
}
|
||||||
return new UnifyPair(newLhs, newRhs, p.getPairOp(), suniUnifyPair, p);
|
return new UnifyPair(newLhs, newRhs, p.getPairOp(), suniUnifyPair, p);
|
||||||
|
@ -148,6 +148,13 @@ public class UnifyPair {
|
|||||||
|
|
||||||
UnifyPair other = (UnifyPair) obj;
|
UnifyPair other = (UnifyPair) obj;
|
||||||
|
|
||||||
|
if (isUndefinedPair()) {
|
||||||
|
if (!other.getBasePair().equals(basePair) ||
|
||||||
|
!other.getAllSubstitutions().equals(getAllSubstitutions())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return other.getPairOp() == pairOp
|
return other.getPairOp() == pairOp
|
||||||
&& other.getLhsType().equals(lhs)
|
&& other.getLhsType().equals(lhs)
|
||||||
&& other.getRhsType().equals(rhs);
|
&& other.getRhsType().equals(rhs);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user