modified: src/de/dhbwstuttgart/core/JavaTXCompiler.java

LogAusgabe FC

	modified:   src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
fresh TV in unifyCase1 auf alle cs ausgedehnt
	modified:   test/javFiles/Matrix.jav
This commit is contained in:
Martin Plümicke 2018-03-19 15:25:40 +01:00
parent 78db0f0177
commit f4bc057aff
3 changed files with 16 additions and 17 deletions

View File

@ -98,6 +98,8 @@ public class JavaTXCompiler {
Set<Set<UnifyPair>> results = new HashSet<>();
try {
FileWriter logFile = new FileWriter(new File(System.getProperty("user.dir")+"/test/logFiles/"+"log"));
logFile.write("FC:\\" + finiteClosure.toString()+"\n");
logFile.flush();
for (List<Constraint<UnifyPair>> xCons : unifyCons.cartesianProduct()) {
Set<UnifyPair> xConsSet = new HashSet<>();
for (Constraint<UnifyPair> constraint : xCons) {

View File

@ -719,7 +719,17 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
//cs.add(thetaPrime);
//PL 18-02-06 entfernt
for(UnifyType c : cs) {
//cs muessen fresh Typvars gesetzt werden PL 2018-03-18
Set<UnifyType> csPHRenamed = cs.stream().map(x -> {
BinaryOperator<HashMap<PlaceholderType,PlaceholderType>> combiner = (aa,b) -> { aa.putAll(b); return aa;};
HashMap<PlaceholderType,PlaceholderType> hm = x.getInvolvedPlaceholderTypes().stream()
.reduce(new HashMap<PlaceholderType,PlaceholderType>(),
(aa, b)-> { aa.put(b,PlaceholderType.freshPlaceholder()); return aa; }, combiner);
return x.accept(new freshPlaceholder(), hm);
}).collect(Collectors.toCollection(HashSet::new));
for(UnifyType c : csPHRenamed) {
//PL 18-02-05 getChildren durch smaller ersetzt in getChildren werden die Varianlen nicht ersetzt.
Set<UnifyType> thetaQs = fc.smaller(c).stream().collect(Collectors.toCollection(HashSet::new));
//Set<UnifyType> thetaQs = fc.getChildren(c).stream().collect(Collectors.toCollection(HashSet::new));
@ -746,18 +756,8 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
}
for(UnifyType tqp : thetaQPrimes) {
//System.out.println(tqp.toString());
//i++;
//System.out.println(i);
//if (i == 62)
// System.out.println(tqp.toString());
BinaryOperator<HashMap<PlaceholderType,PlaceholderType>> combiner = (x,y) -> { x.putAll(y); return x;};
HashMap<PlaceholderType,PlaceholderType> hm = tqp.getInvolvedPlaceholderTypes().stream()
.reduce(new HashMap<PlaceholderType,PlaceholderType>(),
(x, y)-> { x.put(y,PlaceholderType.freshPlaceholder()); return x; }, combiner);
Optional<Unifier> opt = stdUnify.unify(
tqp.accept(new freshPlaceholder(), hm), thetaPrime);
if (!opt.isPresent()) { //tqp muesse fresh Typvars gesetzt werden PL 2018-03-16
Optional<Unifier> opt = stdUnify.unify(tqp, thetaPrime);
if (!opt.isPresent()) {
continue;
}
@ -765,9 +765,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
unifier.swapPlaceholderSubstitutions(thetaPrime.getTypeParams());
Set<UnifyPair> substitutionSet = new HashSet<>();
for (Entry<PlaceholderType, UnifyType> sigma : unifier) {
if (tqp.getInvolvedPlaceholderTypes().contains(sigma.getKey())) { //PL eingefuegt 2018-03-16
break; //TypePalceHolder aus dem FC nicht in das substitutionSet }
}
substitutionSet.add(new UnifyPair(sigma.getKey(), sigma.getValue(), PairOperator.EQUALSDOT));
}
//List<UnifyType> freshTphs = new ArrayList<>(); PL 18-02-06 in die For-Schleife verschoben

View File

@ -17,7 +17,7 @@ class Matrix extends Vector<Vector<Integer>> {
var k = 0;
while(k < v1.size()) {
//erg = erg + v1.elementAt(k) * m.elementAt(k).elementAt(j);
erg = add(erg, mul1(v1.elementAt(k),
erg = add1(erg, mul1(v1.elementAt(k),
m.elementAt(k).elementAt(j)));
k++; }
v2.addElement(new Integer(erg));