nicht lauffaehig

This commit is contained in:
Martin Plümicke 2018-02-07 16:53:24 +01:00
parent 2d5c863008
commit 1f269918fb
5 changed files with 41 additions and 20 deletions

View File

@ -103,7 +103,7 @@ public class JavaTXCompiler {
System.out.println(xConsSet);
Set<Set<UnifyPair>> result = unify.unify(xConsSet, finiteClosure);
System.out.println("RESULT: " + result.size());
//results.addAll(result);
results.addAll(result);
}
return results.stream().map((unifyPairs ->
new ResultSet(UnifyTypeFactory.convert(unifyPairs, generateTPHMap(cons))))).collect(Collectors.toList());

View File

@ -156,15 +156,17 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
topLevelSets.add(flat);
}
Set<Set<UnifyPair>> setToFlatten = topLevelSets.stream().map(x -> x.iterator().next()).collect(Collectors.toCollection(HashSet::new));
// Cartesian product over all (up to 10) top level sets
Set<Set<Set<UnifyPair>>> eqPrimeSet = setOps.cartesianProduct(topLevelSets)
.stream().map(x -> new HashSet<>(x))
.collect(Collectors.toCollection(HashSet::new));
//Set<Set<Set<UnifyPair>>> eqPrimeSet = setOps.cartesianProduct(topLevelSets)
//.stream().map(x -> new HashSet<>(x))
//.collect(Collectors.toCollection(HashSet::new));
Set<Set<UnifyPair>> eqPrimePrimeSet = new HashSet<>();
Set<TypeUnifyTask> forks = new HashSet<>();
for(Set<Set<UnifyPair>> setToFlatten : eqPrimeSet) {
//for(Set<Set<UnifyPair>> setToFlatten : eqPrimeSet) {
// Flatten the cartesian product
Set<UnifyPair> eqPrime = new HashSet<>();
setToFlatten.stream().forEach(x -> eqPrime.addAll(x));
@ -208,7 +210,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
else
eqPrimePrimeSet.addAll(unify(eqPrime, fc, false));
}
}
//}
/*
* Step 6 b) Build the union over everything.

View File

@ -0,0 +1,10 @@
import java.util.Vector;
class Matrix extends Vector<Vector<Integer>> {
methode(m) {
m.add(1);
Matrix i;
methode(i);
}
}

View File

@ -6,21 +6,21 @@ class Matrix extends Vector<Vector<Integer>> {
mul(m) {
var ret = new Matrix();
var i = 0;
//while(i < size()) {
while(i < size()) {
var v1 = this.elementAt(i);
//var v2 = new Vector<Integer>();
//var j = 0;
//while(j < v1.size()) {
//var erg = 0;
//var k = 0;
//while(k < v1.size()) {
//erg = erg + v1.elementAt(k)
// * m.elementAt(k).elementAt(j);
//k++; }
//v2.addElement(new Integer(erg));
//j++; }
//ret.addElement(v2);
//i++; }
var v2 = new Vector<Integer>();
var j = 0;
while(j < v1.size()) {
var erg = 0;
var k = 0;
while(k < v1.size()) {
erg = erg + v1.elementAt(k)
* m.elementAt(k).elementAt(j);
k++; }
v2.addElement(new Integer(erg));
j++; }
ret.addElement(v2);
i++; }
return ret;
}
}

View File

@ -0,0 +1,9 @@
package typeinference;
import java.io.File;
public class FiniteClosureTest_Matrix extends JavaTXCompilerTest{
public FiniteClosureTest_Matrix() {
this.fileToTest = new File(rootDirectory+"FC_Matrix.jav");
}
}