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

modified:   ../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify.java
	modified:   ../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify2Task.java
	modified:   ../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
This commit is contained in:
Martin Plümicke 2019-03-20 14:35:50 +01:00
parent 8a6646bd7c
commit 986ce8e6e0
4 changed files with 1 additions and 35 deletions

View File

@ -42,10 +42,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
<<<<<<< HEAD
=======
import java.io.OutputStreamWriter;
>>>>>>> 7cb2eed36edfe2d9f3ec4ce5c0ca40702dcff7f2
import java.io.Writer;
import java.util.*;
import java.util.function.Function;
@ -430,13 +427,8 @@ public class JavaTXCompiler {
final ConstraintSet<Pair> cons = getConstraints();
Set<Set<UnifyPair>> results = new HashSet<>();
try {
<<<<<<< HEAD
Writer logFile = new FileWriter(new File(System.getProperty("user.dir")+"/src/test/java/logFiles/"+"log_"+sourceFiles.keySet().iterator().next().getName()));
=======
Writer logFile = new OutputStreamWriter(new NullOutputStream());
//new FileWriter(new File("log_"+sourceFiles.keySet().iterator().next().getName()));
>>>>>>> 7cb2eed36edfe2d9f3ec4ce5c0ca40702dcff7f2
IFiniteClosure finiteClosure = UnifyTypeFactory.generateFC(allClasses,logFile);
System.out.println(finiteClosure);
ConstraintSet<UnifyPair> unifyCons = UnifyTypeFactory.convert(cons);

View File

@ -14,7 +14,6 @@ import de.dhbwstuttgart.typeinference.unify.model.FiniteClosure;
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
public class TypeUnify {
<<<<<<< HEAD
/**
* unify parallel ohne result modell
@ -28,17 +27,12 @@ public class TypeUnify {
*/
public Set<Set<UnifyPair>> unify(Set<UnifyPair> undConstrains, List<Set<Set<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret) {
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, true, logFile, log, 0, ret);
=======
public Set<Set<UnifyPair>> unify(Set<UnifyPair> undConstrains, List<Set<Set<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, ConstraintSet<Pair> cons) {
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, true, logFile, log, 0, new UnifyResultModel(), cons);
>>>>>>> 7cb2eed36edfe2d9f3ec4ce5c0ca40702dcff7f2
ForkJoinPool pool = new ForkJoinPool();
pool.invoke(unifyTask);
Set<Set<UnifyPair>> res = unifyTask.join();
return res;
}
<<<<<<< HEAD
/**
* unify asynchron mit Rückgabe UnifyResultModel ohne dass alle results gesammelt sind
* @param undConstrains
@ -52,16 +46,11 @@ public class TypeUnify {
*/
public UnifyResultModel unifyAsync(Set<UnifyPair> undConstrains, List<Set<Set<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret) {
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, true, logFile, log, 0, ret);
=======
public UnifyResultModel unifyAsync(Set<UnifyPair> undConstrains, List<Set<Set<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, ConstraintSet<Pair> cons, UnifyResultModel ret) {
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, true, logFile, log, 0, ret, cons);
>>>>>>> 7cb2eed36edfe2d9f3ec4ce5c0ca40702dcff7f2
ForkJoinPool pool = new ForkJoinPool();
pool.invoke(unifyTask);
return ret;
}
<<<<<<< HEAD
/**
* unify parallel mit Rückgabe UnifyResultModel nachdem alle results gesammelt sind
* @param undConstrains
@ -75,10 +64,6 @@ public class TypeUnify {
*/
public UnifyResultModel unifyParallel(Set<UnifyPair> undConstrains, List<Set<Set<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret) {
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, true, logFile, log, 0, ret);
=======
public UnifyResultModel unifyParallel(Set<UnifyPair> undConstrains, List<Set<Set<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, ConstraintSet<Pair> cons, UnifyResultModel ret) {
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, true, logFile, log, 0, ret, cons);
>>>>>>> 7cb2eed36edfe2d9f3ec4ce5c0ca40702dcff7f2
ForkJoinPool pool = new ForkJoinPool();
pool.invoke(unifyTask);
Set<Set<UnifyPair>> res = unifyTask.join();

View File

@ -1,10 +1,7 @@
package de.dhbwstuttgart.typeinference.unify;
import java.io.FileWriter;
<<<<<<< HEAD
import java.io.IOException;
=======
>>>>>>> 7cb2eed36edfe2d9f3ec4ce5c0ca40702dcff7f2
import java.io.Writer;
import java.util.HashSet;
import java.util.List;
@ -20,13 +17,8 @@ public class TypeUnify2Task extends TypeUnifyTask {
Set<Set<UnifyPair>> setToFlatten;
<<<<<<< HEAD
public TypeUnify2Task(Set<Set<UnifyPair>> setToFlatten, Set<UnifyPair> eq, List<Set<Set<UnifyPair>>> oderConstraints, Set<UnifyPair> nextSetElement, IFiniteClosure fc, boolean parallel, Writer logFile, Boolean log, int rekTiefe, UnifyResultModel urm) {
super(eq, oderConstraints, fc, parallel, logFile, log, rekTiefe, urm);
=======
public TypeUnify2Task(Set<Set<UnifyPair>> setToFlatten, Set<UnifyPair> eq, List<Set<Set<UnifyPair>>> oderConstraints, IFiniteClosure fc, boolean parallel, Writer logFile, Boolean log, int rekTiefe, UnifyResultModel urm, ConstraintSet<Pair> cons) {
super(eq, oderConstraints, fc, parallel, logFile, log, rekTiefe, urm, cons);
>>>>>>> 7cb2eed36edfe2d9f3ec4ce5c0ca40702dcff7f2
this.setToFlatten = setToFlatten;
this.nextSetElement = nextSetElement;
}

View File

@ -133,11 +133,8 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
}
*/
<<<<<<< HEAD
public TypeUnifyTask(Set<UnifyPair> eq, List<Set<Set<UnifyPair>>> oderConstraints, IFiniteClosure fc, boolean parallel, Writer logFile, Boolean log, int rekTiefe, UnifyResultModel urm) {
=======
public TypeUnifyTask(Set<UnifyPair> eq, List<Set<Set<UnifyPair>>> oderConstraints, IFiniteClosure fc, boolean parallel, Writer logFile, Boolean log, int rekTiefe, UnifyResultModel urm, ConstraintSet<de.dhbwstuttgart.typeinference.constraints.Pair> cons2) {
>>>>>>> 7cb2eed36edfe2d9f3ec4ce5c0ca40702dcff7f2
synchronized (this) {
this.eq = eq;
//this.oderConstraints = oderConstraints.stream().map(x -> x.stream().map(y -> new HashSet<>(y)).collect(Collectors.toSet(HashSet::new))).collect(Collectors.toList(ArrayList::new));