modified: ../src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java

modified:   ../src/main/java/de/dhbwstuttgart/typeinference/unify/model/FiniteClosure.java
weitere Logausgaben bei a <. theta'
This commit is contained in:
pl@gohorb.ba-horb.de 2020-03-13 14:04:57 +01:00
parent aa94ce8ad9
commit 44368f2a2a
2 changed files with 11 additions and 5 deletions

View File

@ -731,6 +731,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
} }
else if (variance == -1) { else if (variance == -1) {
a = oup.min(nextSetasList.iterator()); a = oup.min(nextSetasList.iterator());
writeLog("Min: a in " + variance + " "+ a);
nextSetasList.remove(a); nextSetasList.remove(a);
nextSetasListRest = new ArrayList<>(nextSetasList); nextSetasListRest = new ArrayList<>(nextSetasList);
Iterator<Set<UnifyPair>> nextSetasListItRest = new ArrayList<Set<UnifyPair>>(nextSetasListRest).iterator(); Iterator<Set<UnifyPair>> nextSetasListItRest = new ArrayList<Set<UnifyPair>>(nextSetasListRest).iterator();
@ -2059,7 +2060,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
//} //}
Set<UnifyType> cs = fc.getAllTypesByName(thetaPrime.getName());//cs= [java.util.Vector<NP>, java.util.Vector<java.util.Vector<java.lang.Integer>>, ????java.util.Vector<gen_hv>???] Set<UnifyType> cs = fc.getAllTypesByName(thetaPrime.getName());//cs= [java.util.Vector<NP>, java.util.Vector<java.util.Vector<java.lang.Integer>>, ????java.util.Vector<gen_hv>???]
writeLog("cs: " + cs.toString());
//PL 18-02-06 entfernt, kommt durch unify wieder rein //PL 18-02-06 entfernt, kommt durch unify wieder rein
//cs.add(thetaPrime); //cs.add(thetaPrime);
//PL 18-02-06 entfernt //PL 18-02-06 entfernt
@ -2085,6 +2086,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
if (!(match.match(ml)).isPresent()) { if (!(match.match(ml)).isPresent()) {
thetaQs.remove(c); thetaQs.remove(c);
} }
writeLog("thetaQs von " + c + ": " + thetaQs.toString());
//Set<UnifyType> thetaQs = fc.getChildren(c).stream().collect(Collectors.toCollection(HashSet::new)); //Set<UnifyType> thetaQs = fc.getChildren(c).stream().collect(Collectors.toCollection(HashSet::new));
//thetaQs.add(thetaPrime); //PL 18-02-05 wieder geloescht //thetaQs.add(thetaPrime); //PL 18-02-05 wieder geloescht
//PL 2017-10-03: War auskommentiert habe ich wieder einkommentiert, //PL 2017-10-03: War auskommentiert habe ich wieder einkommentiert,
@ -2108,7 +2110,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
for(TypeParams tp : permuteParams(candidateParams)) for(TypeParams tp : permuteParams(candidateParams))
thetaQPrimes.add(c.setTypeParams(tp)); thetaQPrimes.add(c.setTypeParams(tp));
} }
writeLog("thetaQPrimes von " + c + ": " + thetaQPrimes.toString());
for(UnifyType tqp : thetaQPrimes) {//PL 2020-03-08 umbauen in der Schleife wird nur unifizierbarer Typ gesucht break am Ende for(UnifyType tqp : thetaQPrimes) {//PL 2020-03-08 umbauen in der Schleife wird nur unifizierbarer Typ gesucht break am Ende
Collection<PlaceholderType> tphs = tqp.getInvolvedPlaceholderTypes(); Collection<PlaceholderType> tphs = tqp.getInvolvedPlaceholderTypes();
Optional<Unifier> opt = stdUnify.unify(tqp, thetaPrime); Optional<Unifier> opt = stdUnify.unify(tqp, thetaPrime);
@ -2180,7 +2182,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
} }
} }
} }
writeLog("result von " + pair + ": " + result.toString());
return result; return result;
} }

View File

@ -711,13 +711,15 @@ implements IFiniteClosure {
HashSet<UnifyPair> hs = new HashSet<>(); HashSet<UnifyPair> hs = new HashSet<>();
hs.add(up); hs.add(up);
Set<UnifyPair> smallerRes = unifyTask.applyTypeUnificationRules(hs, this); Set<UnifyPair> smallerRes = unifyTask.applyTypeUnificationRules(hs, this);
if (left.getName().equals("Matrix") || right.getName().equals("Matrix")) /*
//if (left.getName().equals("Matrix") || right.getName().equals("Matrix"))
{try { {try {
logFile.write("\nsmallerRes: " + smallerRes);//"smallerHash: " + greaterHash.toString()); logFile.write("\nsmallerRes: " + smallerRes);//"smallerHash: " + greaterHash.toString());
logFile.flush(); logFile.flush();
} }
catch (IOException e) { catch (IOException e) {
System.err.println("no LogFile");}} System.err.println("no LogFile");}}
*/
//Gleichungen der Form a <./=. Theta oder Theta <./=. a oder a <./=. b sind ok. //Gleichungen der Form a <./=. Theta oder Theta <./=. a oder a <./=. b sind ok.
Predicate<UnifyPair> delFun = x -> !((x.getLhsType() instanceof PlaceholderType || Predicate<UnifyPair> delFun = x -> !((x.getLhsType() instanceof PlaceholderType ||
x.getRhsType() instanceof PlaceholderType) x.getRhsType() instanceof PlaceholderType)
@ -732,13 +734,15 @@ implements IFiniteClosure {
hs = new HashSet<>(); hs = new HashSet<>();
hs.add(up); hs.add(up);
Set<UnifyPair> greaterRes = unifyTask.applyTypeUnificationRules(hs, this); Set<UnifyPair> greaterRes = unifyTask.applyTypeUnificationRules(hs, this);
if (left.getName().equals("Matrix") || right.getName().equals("Matrix")) /*
//if (left.getName().equals("Matrix") || right.getName().equals("Matrix"))
{try { {try {
logFile.write("\ngreaterRes: " + greaterRes);//"smallerHash: " + greaterHash.toString()); logFile.write("\ngreaterRes: " + greaterRes);//"smallerHash: " + greaterHash.toString());
logFile.flush(); logFile.flush();
} }
catch (IOException e) { catch (IOException e) {
System.err.println("no LogFile");}} System.err.println("no LogFile");}}
*/
//Gleichungen der Form a <./=. Theta oder Theta <./=. a oder a <./=. b sind ok. //Gleichungen der Form a <./=. Theta oder Theta <./=. a oder a <./=. b sind ok.
long greaterLen = greaterRes.stream().filter(delFun).count(); long greaterLen = greaterRes.stream().filter(delFun).count();
if (greaterLen == 0) return 1; if (greaterLen == 0) return 1;