forked from JavaTX/JavaCompilerCore
code cleanup
This commit is contained in:
parent
e91a9370df
commit
701962b0e7
@ -27,7 +27,6 @@ import de.dhbwstuttgart.typeinference.constraints.Constraint;
|
|||||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
|
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
|
||||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IMatch;
|
import de.dhbwstuttgart.typeinference.unify.interfaces.IMatch;
|
||||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IRuleSet;
|
import de.dhbwstuttgart.typeinference.unify.interfaces.IRuleSet;
|
||||||
import de.dhbwstuttgart.typeinference.unify.interfaces.ISetOperations;
|
|
||||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IUnify;
|
import de.dhbwstuttgart.typeinference.unify.interfaces.IUnify;
|
||||||
import de.dhbwstuttgart.typeinference.unify.model.ExtendsType;
|
import de.dhbwstuttgart.typeinference.unify.model.ExtendsType;
|
||||||
import de.dhbwstuttgart.typeinference.unify.model.FunNType;
|
import de.dhbwstuttgart.typeinference.unify.model.FunNType;
|
||||||
@ -45,7 +44,6 @@ import de.dhbwstuttgart.util.Pair;
|
|||||||
import de.dhbwstuttgart.typeinference.unify.model.OrderingUnifyPair;
|
import de.dhbwstuttgart.typeinference.unify.model.OrderingUnifyPair;
|
||||||
import org.apache.commons.io.output.NullWriter;
|
import org.apache.commons.io.output.NullWriter;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
@ -58,9 +56,6 @@ import java.io.Writer;
|
|||||||
*/
|
*/
|
||||||
public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private static int i = 0;
|
|
||||||
private boolean printtag = false;
|
|
||||||
Boolean log = true; //gibt an ob ein Log-File nach System.getProperty("user.dir")+"/test/logFiles/log" geschrieben werden soll?
|
Boolean log = true; //gibt an ob ein Log-File nach System.getProperty("user.dir")+"/test/logFiles/log" geschrieben werden soll?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,10 +74,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
public static final String rootDirectory = System.getProperty("user.dir")+"/test/logFiles/";
|
public static final String rootDirectory = System.getProperty("user.dir")+"/test/logFiles/";
|
||||||
protected WriterActiveObject logFile;
|
protected WriterActiveObject logFile;
|
||||||
protected ForkJoinPool pool;
|
protected ForkJoinPool pool;
|
||||||
/**
|
|
||||||
* The implementation of setOps that will be used during the unification
|
|
||||||
*/
|
|
||||||
protected ISetOperations setOps = new GuavaSetOperations();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The implementation of the standard unify that will be used during the unification
|
* The implementation of the standard unify that will be used during the unification
|
||||||
@ -104,9 +95,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
protected boolean parallel;
|
protected boolean parallel;
|
||||||
|
|
||||||
//Gives if unify is not called from checkA
|
|
||||||
private boolean finalresult = true;
|
|
||||||
|
|
||||||
int rekTiefeField;
|
int rekTiefeField;
|
||||||
|
|
||||||
Integer nOfUnify = 0;
|
Integer nOfUnify = 0;
|
||||||
@ -115,8 +103,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
Integer noAllErasedElements = 0;
|
Integer noAllErasedElements = 0;
|
||||||
|
|
||||||
static Integer noou = 0;
|
|
||||||
|
|
||||||
static int noBacktracking;
|
static int noBacktracking;
|
||||||
|
|
||||||
static int noLoop;
|
static int noLoop;
|
||||||
@ -161,7 +147,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//x.stream().map(y -> new HashSet<>(y)).collect(Collectors.toSet(HashSet::new))).collect(Collectors.toList(ArrayList::new));
|
//x.stream().map(y -> new HashSet<>(y)).collect(Collectors.toSet(HashSet::new))).collect(Collectors.toList(ArrayList::new));
|
||||||
this.nextSetElement = nextSetElement;
|
|
||||||
this.fc = fc;
|
this.fc = fc;
|
||||||
this.oup = new OrderingUnifyPair(fc);
|
this.oup = new OrderingUnifyPair(fc);
|
||||||
this.parallel = parallel;
|
this.parallel = parallel;
|
||||||
@ -175,7 +160,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
writeLog("thNo2 " + thNo);
|
writeLog("thNo2 " + thNo);
|
||||||
try {
|
try {
|
||||||
if(log){
|
if(log){
|
||||||
this.logFile = new WriterActiveObject(new FileWriter(new File(System.getProperty("user.dir") + "/logFiles/" + "Thread_"+thNo)), pool);
|
this.logFile = new WriterActiveObject(new FileWriter(System.getProperty("user.dir") + "/logFiles/" + "Thread_"+thNo), pool);
|
||||||
}else{
|
}else{
|
||||||
this.logFile = new WriterActiveObject(new OutputStreamWriter(new NullOutputStream()), pool);
|
this.logFile = new WriterActiveObject(new OutputStreamWriter(new NullOutputStream()), pool);
|
||||||
}
|
}
|
||||||
@ -204,7 +189,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Vererbt alle Variancen
|
* Vererbt alle Variancen
|
||||||
* @param eq The set of constraints
|
|
||||||
*/
|
*/
|
||||||
/* PL 2018-05- 17 verschoben nach JavaTXCompiler
|
/* PL 2018-05- 17 verschoben nach JavaTXCompiler
|
||||||
private void varianceInheritance(Set<UnifyPair> eq) {
|
private void varianceInheritance(Set<UnifyPair> eq) {
|
||||||
@ -236,15 +220,11 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
protected Set<Set<UnifyPair>> compute() {
|
protected Set<Set<UnifyPair>> compute() {
|
||||||
if (one) {
|
|
||||||
//System.out.println("two");
|
|
||||||
}
|
|
||||||
one = true;
|
|
||||||
Set<UnifyPair> neweq = new HashSet<>(eq);
|
Set<UnifyPair> neweq = new HashSet<>(eq);
|
||||||
/* 1-elementige Oder-Constraints werden in und-Constraints umgewandelt */
|
/* 1-elementige Oder-Constraints werden in und-Constraints umgewandelt */
|
||||||
oderConstraintsField.stream()
|
oderConstraintsField.stream()
|
||||||
.filter(x -> x.size()==1)
|
.filter(x -> x.size()==1)
|
||||||
.map(y -> y.stream().findFirst().get()).forEach(x -> neweq.addAll(x));
|
.map(y -> y.stream().findFirst().get()).forEach(neweq::addAll);
|
||||||
ArrayList<Set<Constraint<UnifyPair>>> remainingOderconstraints = oderConstraintsField.stream()
|
ArrayList<Set<Constraint<UnifyPair>>> remainingOderconstraints = oderConstraintsField.stream()
|
||||||
.filter(x -> x.size()>1)
|
.filter(x -> x.size()>1)
|
||||||
.collect(Collectors.toCollection(ArrayList::new));
|
.collect(Collectors.toCollection(ArrayList::new));
|
||||||
@ -258,9 +238,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
if (isUndefinedPairSetSet(res)) {
|
if (isUndefinedPairSetSet(res)) {
|
||||||
//fuer debug-Zwecke
|
//fuer debug-Zwecke
|
||||||
ArrayList al = res.stream().map(x -> x.stream().collect(Collectors.toCollection(ArrayList::new)))
|
throw new TypeinferenceException("Unresolved constraints: " + res, new NullToken()); //return new HashSet<>();
|
||||||
.collect(Collectors.toCollection(ArrayList::new));
|
|
||||||
throw new TypeinferenceException("Unresolved constraints: " + res.toString(), new NullToken()); //return new HashSet<>();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return res;
|
return res;
|
||||||
@ -298,7 +276,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
rekTiefe++;
|
rekTiefe++;
|
||||||
nOfUnify++;
|
nOfUnify++;
|
||||||
writeLog(nOfUnify.toString() + " Unifikation: " + eq.toString());
|
writeLog(nOfUnify + " Unifikation: " + eq.toString());
|
||||||
writeLog(nOfUnify.toString() + " Oderconstraints: " + oderConstraints.toString());
|
writeLog(nOfUnify.toString() + " Oderconstraints: " + oderConstraints.toString());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -310,9 +288,9 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
/*
|
/*
|
||||||
* ? extends ? extends Theta rausfiltern
|
* ? extends ? extends Theta rausfiltern
|
||||||
*/
|
*/
|
||||||
Set<UnifyPair> doubleExt = eq.stream().filter(x -> (x.wrongWildcard())).map(x -> { x.setUndefinedPair(); return x;})
|
Set<UnifyPair> doubleExt = eq.stream().filter(UnifyPair::wrongWildcard).peek(UnifyPair::setUndefinedPair)
|
||||||
.collect(Collectors.toCollection(HashSet::new));
|
.collect(Collectors.toCollection(HashSet::new));
|
||||||
if (doubleExt.size() > 0) {
|
if (!doubleExt.isEmpty()) {
|
||||||
Set<Set<UnifyPair>> ret = new HashSet<>();
|
Set<Set<UnifyPair>> ret = new HashSet<>();
|
||||||
ret.add(doubleExt);
|
ret.add(doubleExt);
|
||||||
return ret;
|
return ret;
|
||||||
@ -327,10 +305,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
return (lhs = x.getLhsType()) instanceof PlaceholderType
|
return (lhs = x.getLhsType()) instanceof PlaceholderType
|
||||||
&& !((rhs = x.getRhsType()) instanceof PlaceholderType)
|
&& !((rhs = x.getRhsType()) instanceof PlaceholderType)
|
||||||
&& rhs.getTypeParams().occurs((PlaceholderType)lhs);})
|
&& rhs.getTypeParams().occurs((PlaceholderType)lhs);})
|
||||||
.map(x -> { x.setUndefinedPair(); return x;})
|
.peek(UnifyPair::setUndefinedPair)
|
||||||
.collect(Collectors.toCollection(HashSet::new));
|
.collect(Collectors.toCollection(HashSet::new));
|
||||||
writeLog("ocurrPairs: " + ocurrPairs);
|
writeLog("ocurrPairs: " + ocurrPairs);
|
||||||
if (ocurrPairs.size() > 0) {
|
if (!ocurrPairs.isEmpty()) {
|
||||||
Set<Set<UnifyPair>> ret = new HashSet<>();
|
Set<Set<UnifyPair>> ret = new HashSet<>();
|
||||||
ret.add(ocurrPairs);
|
ret.add(ocurrPairs);
|
||||||
return ret;
|
return ret;
|
||||||
@ -350,10 +328,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
eqSubst = rules.subst(eq0, oderConstraints);
|
eqSubst = rules.subst(eq0, oderConstraints);
|
||||||
} while (eqSubst.isPresent());
|
} while (eqSubst.isPresent());
|
||||||
|
|
||||||
eq0.forEach(x -> x.disableCondWildcards());
|
eq0.forEach(UnifyPair::disableCondWildcards);
|
||||||
|
|
||||||
writeLog(nOfUnify.toString() + " Unifikation nach applyTypeUnificationRules: " + eq.toString() + "\n"
|
writeLog(nOfUnify.toString() + " Unifikation nach applyTypeUnificationRules: " + eq + "\n"
|
||||||
+ nOfUnify.toString() + " Oderconstraints nach applyTypeUnificationRules: " + oderConstraints.toString());
|
+ nOfUnify + " Oderconstraints nach applyTypeUnificationRules: " + oderConstraints);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Step 2 and 3: Create a subset eq1s of pairs where both sides are TPH and eq2s of the other pairs
|
* Step 2 and 3: Create a subset eq1s of pairs where both sides are TPH and eq2s of the other pairs
|
||||||
@ -375,7 +353,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
//System.out.println(eq2s);
|
//System.out.println(eq2s);
|
||||||
|
|
||||||
if(eq1s.size() != 0) { // Do not add empty sets or the cartesian product will always be empty.
|
if(!eq1s.isEmpty()) { // Do not add empty sets or the cartesian product will always be empty.
|
||||||
Set<Set<UnifyPair>> wrap = new HashSet<>();
|
Set<Set<UnifyPair>> wrap = new HashSet<>();
|
||||||
wrap.add(eq1s);
|
wrap.add(eq1s);
|
||||||
topLevelSets.add(wrap); // Add Eq1'
|
topLevelSets.add(wrap); // Add Eq1'
|
||||||
@ -387,7 +365,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
.filter(x -> x.getPairOp() == PairOperator.EQUALSDOT && x.getLhsType() instanceof PlaceholderType)
|
.filter(x -> x.getPairOp() == PairOperator.EQUALSDOT && x.getLhsType() instanceof PlaceholderType)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
if(bufferSet.size() != 0) { // Do not add empty sets or the cartesian product will always be empty.
|
if(!bufferSet.isEmpty()) { // Do not add empty sets or the cartesian product will always be empty.
|
||||||
Set<Set<UnifyPair>> wrap = new HashSet<>();
|
Set<Set<UnifyPair>> wrap = new HashSet<>();
|
||||||
wrap.add(bufferSet);
|
wrap.add(bufferSet);
|
||||||
topLevelSets.add(wrap);
|
topLevelSets.add(wrap);
|
||||||
@ -397,7 +375,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
// Sets that originate from pair pattern matching
|
// Sets that originate from pair pattern matching
|
||||||
// Sets of the "second level"
|
// Sets of the "second level"
|
||||||
Set<UnifyPair> undefinedPairs = new HashSet<>();
|
Set<UnifyPair> undefinedPairs = new HashSet<>();
|
||||||
if (printtag) System.out.println("eq2s " + eq2s);
|
|
||||||
//writeLog("BufferSet: " + bufferSet.toString()+"\n");
|
//writeLog("BufferSet: " + bufferSet.toString()+"\n");
|
||||||
List<Set<Constraint<UnifyPair>>> oderConstraintsOutput = new ArrayList<>();//new ArrayList<>(oderConstraints);
|
List<Set<Constraint<UnifyPair>>> oderConstraintsOutput = new ArrayList<>();//new ArrayList<>(oderConstraints);
|
||||||
Set<Set<Set<? extends Set<UnifyPair>>>> secondLevelSets = calculatePairSets(eq2s, oderConstraints, fc, undefinedPairs, oderConstraintsOutput);
|
Set<Set<Set<? extends Set<UnifyPair>>>> secondLevelSets = calculatePairSets(eq2s, oderConstraints, fc, undefinedPairs, oderConstraintsOutput);
|
||||||
@ -405,8 +382,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
//nicht ausgewertet Faculty Beispiel im 1. Schritt
|
//nicht ausgewertet Faculty Beispiel im 1. Schritt
|
||||||
//PL 2017-10-03 geloest, muesste noch mit FCs mit kleineren
|
//PL 2017-10-03 geloest, muesste noch mit FCs mit kleineren
|
||||||
//Typen getestet werden.
|
//Typen getestet werden.
|
||||||
writeLog(nOfUnify.toString() + " Oderconstraints2: " + oderConstraintsOutput.toString());
|
writeLog(nOfUnify.toString() + " Oderconstraints2: " + oderConstraintsOutput);
|
||||||
if (printtag) System.out.println("secondLevelSets:" +secondLevelSets);
|
|
||||||
// If pairs occured that did not match one of the cartesian product cases,
|
// If pairs occured that did not match one of the cartesian product cases,
|
||||||
// those pairs are contradictory and the unification is impossible.
|
// those pairs are contradictory and the unification is impossible.
|
||||||
if(!undefinedPairs.isEmpty()) {
|
if(!undefinedPairs.isEmpty()) {
|
||||||
@ -416,7 +392,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
+ "BasePair; " + up.getBasePair());
|
+ "BasePair; " + up.getBasePair());
|
||||||
}
|
}
|
||||||
Set<Set<UnifyPair>> error = new HashSet<>();
|
Set<Set<UnifyPair>> error = new HashSet<>();
|
||||||
undefinedPairs = undefinedPairs.stream().map(x -> { x.setUndefinedPair(); return x;}).collect(Collectors.toCollection(HashSet::new));
|
undefinedPairs = undefinedPairs.stream().peek(UnifyPair::setUndefinedPair).collect(Collectors.toCollection(HashSet::new));
|
||||||
error.add(undefinedPairs);
|
error.add(undefinedPairs);
|
||||||
undefinedPairs.forEach(x -> writeLog("AllSubst: " +x.getAllSubstitutions().toString()));
|
undefinedPairs.forEach(x -> writeLog("AllSubst: " +x.getAllSubstitutions().toString()));
|
||||||
return error;
|
return error;
|
||||||
@ -449,9 +425,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
//Alternative KEIN KARTESISCHES PRODUKT der secondlevel Ebene bilden
|
//Alternative KEIN KARTESISCHES PRODUKT der secondlevel Ebene bilden
|
||||||
for(Set<Set<? extends Set<UnifyPair>>> secondLevelSet : secondLevelSets) {
|
for(Set<Set<? extends Set<UnifyPair>>> secondLevelSet : secondLevelSets) {
|
||||||
for (Set<? extends Set<UnifyPair>> secondlevelelem : secondLevelSet) {
|
topLevelSets.addAll(secondLevelSet);
|
||||||
topLevelSets.add(secondlevelelem);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//System.out.println(topLevelSets);
|
//System.out.println(topLevelSets);
|
||||||
//System.out.println();
|
//System.out.println();
|
||||||
@ -479,14 +453,12 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
Set<Set<UnifyPair>> eqPrimePrimeSet = new HashSet<>();
|
Set<Set<UnifyPair>> eqPrimePrimeSet = new HashSet<>();
|
||||||
|
|
||||||
Set<TypeUnifyTask> forks = new HashSet<>();
|
|
||||||
|
|
||||||
//Muss auskommentiert werden, wenn computeCartesianRecursive ANFANG
|
//Muss auskommentiert werden, wenn computeCartesianRecursive ANFANG
|
||||||
//for(Set<Set<UnifyPair>> setToFlatten : eqPrimeSet) {
|
//for(Set<Set<UnifyPair>> setToFlatten : eqPrimeSet) {
|
||||||
// Flatten the cartesian product
|
// Flatten the cartesian product
|
||||||
//Muss auskommentiert werden, wenn computeCartesianRecursive ENDE
|
//Muss auskommentiert werden, wenn computeCartesianRecursive ENDE
|
||||||
Set<UnifyPair> eqPrime = new HashSet<>();
|
Set<UnifyPair> eqPrime = new HashSet<>();
|
||||||
setToFlatten.stream().forEach(x -> eqPrime.addAll(x));
|
setToFlatten.stream().forEach(eqPrime::addAll);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Step 5: Substitution
|
* Step 5: Substitution
|
||||||
@ -496,8 +468,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
String ocString = oderConstraints.toString();
|
String ocString = oderConstraints.toString();
|
||||||
List<Set<Constraint<UnifyPair>>> newOderConstraints = new ArrayList<>(oderConstraints);
|
List<Set<Constraint<UnifyPair>>> newOderConstraints = new ArrayList<>(oderConstraints);
|
||||||
Optional<Set<UnifyPair>> eqPrimePrime = rules.subst(eqPrime, newOderConstraints);
|
Optional<Set<UnifyPair>> eqPrimePrime = rules.subst(eqPrime, newOderConstraints);
|
||||||
Set<Set<UnifyPair>> unifyres1 = null;
|
|
||||||
Set<Set<UnifyPair>> unifyres2 = null;
|
|
||||||
if (!ocString.equals(newOderConstraints.toString())) writeLog("nach Subst: " + newOderConstraints);
|
if (!ocString.equals(newOderConstraints.toString())) writeLog("nach Subst: " + newOderConstraints);
|
||||||
//writeLog("nach Subst: " + eqPrimePrime);
|
//writeLog("nach Subst: " + eqPrimePrime);
|
||||||
/*
|
/*
|
||||||
@ -526,8 +496,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
}
|
}
|
||||||
else */
|
else */
|
||||||
{// sequentiell (Step 6b is included)
|
{// sequentiell (Step 6b is included)
|
||||||
if (printtag) System.out.println("nextStep: " + eqPrimePrime);
|
if (eqPrime.equals(eq) && eqPrimePrime.isEmpty()
|
||||||
if (eqPrime.equals(eq) && !eqPrimePrime.isPresent()
|
|
||||||
&& oderConstraints.isEmpty()) { //PL 2017-09-29 //(!eqPrimePrime.isPresent()) auskommentiert und durch
|
&& oderConstraints.isEmpty()) { //PL 2017-09-29 //(!eqPrimePrime.isPresent()) auskommentiert und durch
|
||||||
//PL 2017-09-29 dies ersetzt //(!eqPrimePrime.isPresent())
|
//PL 2017-09-29 dies ersetzt //(!eqPrimePrime.isPresent())
|
||||||
//PL 2018-05-18 beide Bedingungen muessen gelten, da eqPrime Veränderungen in allem ausser subst
|
//PL 2018-05-18 beide Bedingungen muessen gelten, da eqPrime Veränderungen in allem ausser subst
|
||||||
@ -541,8 +510,8 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
// System.err.println("log-File nicht vorhanden");
|
// System.err.println("log-File nicht vorhanden");
|
||||||
//}
|
//}
|
||||||
eqPrimePrimeSet.add(eqPrime);
|
eqPrimePrimeSet.add(eqPrime);
|
||||||
if (finalresult && isSolvedForm(eqPrime)) {
|
if (isSolvedForm(eqPrime)) {
|
||||||
writeLog("eqPrime:" + eqPrime.toString()+"\n");
|
writeLog("eqPrime:" + eqPrime +"\n");
|
||||||
|
|
||||||
/* methodconstraintsets werden zum Ergebnis hinzugefuegt
|
/* methodconstraintsets werden zum Ergebnis hinzugefuegt
|
||||||
* Anfang
|
* Anfang
|
||||||
@ -562,16 +531,16 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
|
|
||||||
urm.notify(eqPrimePrimeSet);
|
urm.notify(eqPrimePrimeSet);
|
||||||
writeStatistics("Result: " + eqPrimePrimeSet.toString());
|
writeStatistics("Result: " + eqPrimePrimeSet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(eqPrimePrime.isPresent()) {
|
else if(eqPrimePrime.isPresent()) {
|
||||||
Set<Set<UnifyPair>> unifyres = unifyres1 = unify(eqPrimePrime.get(), newOderConstraints, fc, parallel, rekTiefe, methodSignatureConstraint);
|
Set<Set<UnifyPair>> unifyres = unify(eqPrimePrime.get(), newOderConstraints, fc, parallel, rekTiefe, methodSignatureConstraint);
|
||||||
|
|
||||||
eqPrimePrimeSet.addAll(unifyres);
|
eqPrimePrimeSet.addAll(unifyres);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Set<Set<UnifyPair>> unifyres = unifyres2 = unify(eqPrime, newOderConstraints, fc, parallel, rekTiefe, methodSignatureConstraint);
|
Set<Set<UnifyPair>> unifyres = unify(eqPrime, newOderConstraints, fc, parallel, rekTiefe, methodSignatureConstraint);
|
||||||
|
|
||||||
|
|
||||||
eqPrimePrimeSet.addAll(unifyres);
|
eqPrimePrimeSet.addAll(unifyres);
|
||||||
@ -596,7 +565,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("Result1 " + eqPrimePrimeSet.toString());
|
writeLog("Result1 " + eqPrimePrimeSet);
|
||||||
}
|
}
|
||||||
return eqPrimePrimeSet;
|
return eqPrimePrimeSet;
|
||||||
}
|
}
|
||||||
@ -621,18 +590,15 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
//statistics
|
//statistics
|
||||||
//writeStatistics("\nNumber of Constraints (" + rekTiefe + "): " + topLevelSets.size());
|
//writeStatistics("\nNumber of Constraints (" + rekTiefe + "): " + topLevelSets.size());
|
||||||
|
|
||||||
Set<Set<UnifyPair>> oneElems = new HashSet<>();
|
Set<Set<UnifyPair>> oneElems = topLevelSets.stream()
|
||||||
oneElems.addAll(topLevelSets.stream()
|
.filter(x -> x.size() == 1)
|
||||||
.filter(x -> x.size()==1)
|
.map(y -> y.stream().findFirst().get()).collect(Collectors.toSet());
|
||||||
.map(y -> y.stream().findFirst().get())
|
|
||||||
.collect(Collectors.toCollection(HashSet::new)));
|
|
||||||
|
|
||||||
//optNextSet: Eine mehrelementige Menge, wenn vorhanden
|
//optNextSet: Eine mehrelementige Menge, wenn vorhanden
|
||||||
Optional<Set<? extends Set<UnifyPair>>> optNextSet = topLevelSets.stream().filter(x -> x.size()>1).findAny();
|
Optional<Set<? extends Set<UnifyPair>>> optNextSet = topLevelSets.stream().filter(x -> x.size()>1).findAny();
|
||||||
|
|
||||||
if (!optNextSet.isPresent()) {//Alle Elemente sind 1-elementig
|
if (optNextSet.isEmpty()) {//Alle Elemente sind 1-elementig
|
||||||
Set<Set<UnifyPair>> result = unify2(oneElems, eq, oderConstraints, fc, parallel, rekTiefe, methodSignatureConstraint);
|
return unify2(oneElems, eq, oderConstraints, fc, parallel, rekTiefe, methodSignatureConstraint);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<? extends Set<UnifyPair>> nextSet = optNextSet.get();
|
Set<? extends Set<UnifyPair>> nextSet = optNextSet.get();
|
||||||
@ -659,13 +625,13 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
* Varianz = -1 => Rückgabevariable
|
* Varianz = -1 => Rückgabevariable
|
||||||
* Varianz = 0 => unklar
|
* Varianz = 0 => unklar
|
||||||
* Varianz = 2 => Operatoren oderConstraints */
|
* Varianz = 2 => Operatoren oderConstraints */
|
||||||
ArrayList<UnifyPair> zeroNextElem = new ArrayList<>(nextSetasList.get(0));
|
ArrayList<UnifyPair> zeroNextElem = new ArrayList<>(nextSetasList.getFirst());
|
||||||
UnifyPair fstBasePair = zeroNextElem.remove(0).getBasePair();
|
UnifyPair fstBasePair = zeroNextElem.removeFirst().getBasePair();
|
||||||
Boolean oderConstraint = false;
|
boolean oderConstraint = false;
|
||||||
|
|
||||||
if (fstBasePair != null) {
|
if (fstBasePair != null) {
|
||||||
Boolean sameBase = true;
|
boolean sameBase = true;
|
||||||
for (UnifyPair ele : nextSetasList.get(0)) {//check ob a <. ty base oder ob Ueberladung
|
for (UnifyPair ele : nextSetasList.getFirst()) {//check ob a <. ty base oder ob Ueberladung
|
||||||
sameBase = sameBase && ele.getBasePair() != null && ele.getBasePair().equals(fstBasePair);
|
sameBase = sameBase && ele.getBasePair() != null && ele.getBasePair().equals(fstBasePair);
|
||||||
}
|
}
|
||||||
if (sameBase) { //angefuegt PL 2020-02-30
|
if (sameBase) { //angefuegt PL 2020-02-30
|
||||||
@ -690,10 +656,9 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
//Varianz-Bestimmung Oder-Constraints
|
//Varianz-Bestimmung Oder-Constraints
|
||||||
if (oderConstraint) {
|
if (oderConstraint) {
|
||||||
if (printtag) System.out.println("nextSetasList " + nextSetasList);
|
|
||||||
Optional<Integer> optVariance =
|
Optional<Integer> optVariance =
|
||||||
nextSetasList.iterator()
|
nextSetasList
|
||||||
.next()
|
.getFirst()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(x -> x.getGroundBasePair().getLhsType() instanceof PlaceholderType &&
|
.filter(x -> x.getGroundBasePair().getLhsType() instanceof PlaceholderType &&
|
||||||
! (x.getRhsType() instanceof PlaceholderType) &&
|
! (x.getRhsType() instanceof PlaceholderType) &&
|
||||||
@ -712,53 +677,13 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
/* Varianzbestimmung Ende */
|
/* Varianzbestimmung Ende */
|
||||||
|
|
||||||
//writeLog("nextSetasList: " + nextSetasList.toString());
|
//writeLog("nextSetasList: " + nextSetasList.toString());
|
||||||
Set<UnifyPair> nextSetElem = nextSetasList.get(0);
|
|
||||||
//writeLog("BasePair1: " + nextSetElem + " " + nextSetElem.iterator().next().getBasePair());
|
//writeLog("BasePair1: " + nextSetElem + " " + nextSetElem.iterator().next().getBasePair());
|
||||||
|
|
||||||
/* sameEqSet-Bestimmung: Wenn a = ty \in nextSet dann enthaelt sameEqSet
|
Set<UnifyPair> a;
|
||||||
* alle Paare a < ty1 oder ty2 < a aus oneElems */
|
while (!nextSetasList.isEmpty()) {
|
||||||
Set<UnifyPair> sameEqSet = new HashSet<>();
|
|
||||||
|
|
||||||
//optOrigPair enthaelt ggf. das Paar a = ty \in nextSet
|
|
||||||
Optional<UnifyPair> optOrigPair = null;
|
|
||||||
if (!oderConstraint) {
|
|
||||||
optOrigPair = nextSetElem.stream().filter(x -> (
|
|
||||||
//x.getBasePair() != null && ist gegeben wenn variance != 2
|
|
||||||
//x.getBasePair().getPairOp().equals(PairOperator.SMALLERDOT) &&
|
|
||||||
(x.getPairOp().equals(PairOperator.EQUALSDOT)
|
|
||||||
/*
|
|
||||||
(x.getBasePair().getLhsType() instanceof PlaceholderType
|
|
||||||
&& x.getLhsType().equals(x.getBasePair().getLhsType()))
|
|
||||||
|| (x.getBasePair().getRhsType() instanceof PlaceholderType
|
|
||||||
&& x.getLhsType().equals(x.getBasePair().getRhsType())
|
|
||||||
*/
|
|
||||||
))).filter(x -> //Sicherstellen, dass bei a = ty a auch wirklich die gesuchte Typvariable ist
|
|
||||||
x.getLhsType().equals(x.getBasePair().getLhsType()) ||
|
|
||||||
x.getLhsType().equals(x.getBasePair().getRhsType())
|
|
||||||
).findFirst();
|
|
||||||
writeLog("optOrigPair: " + optOrigPair);
|
|
||||||
if (optOrigPair.isPresent()) {
|
|
||||||
UnifyPair origPair = optOrigPair.get();
|
|
||||||
UnifyType tyVar;
|
|
||||||
if (!((tyVar = origPair.getLhsType()) instanceof PlaceholderType)) {
|
|
||||||
tyVar = origPair.getRhsType();
|
|
||||||
}
|
|
||||||
UnifyType tyVarEF = tyVar;
|
|
||||||
sameEqSet = oneElems.stream().map(xx -> xx.iterator().next())
|
|
||||||
.filter(x -> (((x.getLhsType().equals(tyVarEF) && !(x.getRhsType() instanceof PlaceholderType))
|
|
||||||
|| (x.getRhsType().equals(tyVarEF) && !(x.getLhsType() instanceof PlaceholderType)))))
|
|
||||||
.collect(Collectors.toCollection(HashSet::new));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* sameEqSet-Bestimmung Ende */
|
|
||||||
|
|
||||||
int hilf = 0;
|
|
||||||
Set<UnifyPair> a = null;
|
|
||||||
while (nextSetasList.size() > 0) {
|
|
||||||
|
|
||||||
//statistics
|
//statistics
|
||||||
//writeStatistics(" Actual Number of elements( " + nextSetasList.get(0).stream().findFirst().get().getBasePair() +"): (" + rekTiefe + "): " + nextSetasList.size());
|
//writeStatistics(" Actual Number of elements( " + nextSetasList.get(0).stream().findFirst().get().getBasePair() +"): (" + rekTiefe + "): " + nextSetasList.size());
|
||||||
Set<UnifyPair> a_last = a;
|
|
||||||
|
|
||||||
/* Liste der Faelle für die parallele Verarbeitung
|
/* Liste der Faelle für die parallele Verarbeitung
|
||||||
* Enthaelt Elemente, die nicht in Relation zu aktuellem Fall in der
|
* Enthaelt Elemente, die nicht in Relation zu aktuellem Fall in der
|
||||||
@ -850,7 +775,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Nextvar an Hand Varianzbestimmung auskommentieren Ende */
|
Nextvar an Hand Varianzbestimmung auskommentieren Ende */
|
||||||
a = nextSetasList.remove(0); //statisticsList
|
a = nextSetasList.removeFirst(); //statisticsList
|
||||||
|
|
||||||
//writeStatistics(a.toString());
|
//writeStatistics(a.toString());
|
||||||
if (oderConstraint) {//Methodconstraints werden abgespeichert für die Bytecodegenerierung von Methodenaufrufen
|
if (oderConstraint) {//Methodconstraints werden abgespeichert für die Bytecodegenerierung von Methodenaufrufen
|
||||||
@ -858,12 +783,11 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
//System.out.println("ERSTELLUNG: " +methodSignatureConstraint);
|
//System.out.println("ERSTELLUNG: " +methodSignatureConstraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
Set<Set<UnifyPair>> elems = new HashSet<>(oneElems);
|
||||||
Set<Set<UnifyPair>> elems = new HashSet<Set<UnifyPair>>(oneElems);
|
|
||||||
writeLog("a1: " + rekTiefe + " "+ "variance: "+ variance + " " + a.toString()+ "\n");
|
writeLog("a1: " + rekTiefe + " "+ "variance: "+ variance + " " + a.toString()+ "\n");
|
||||||
|
|
||||||
//Ergebnisvariable für den aktuelle Thread
|
//Ergebnisvariable für den aktuelle Thread
|
||||||
Set<Set<UnifyPair>> res = new HashSet<>();
|
Set<Set<UnifyPair>> res;
|
||||||
|
|
||||||
//Menge der Ergebnisse der geforkten Threads
|
//Menge der Ergebnisse der geforkten Threads
|
||||||
Set<Set<Set<UnifyPair>>> add_res = new HashSet<>();
|
Set<Set<Set<UnifyPair>>> add_res = new HashSet<>();
|
||||||
@ -903,25 +827,15 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
"nextSetasListRest: " + nextSetasListRest.toString());
|
"nextSetasListRest: " + nextSetasListRest.toString());
|
||||||
|
|
||||||
while (!nextSetasList.isEmpty()) {
|
while (!nextSetasList.isEmpty()) {
|
||||||
Set<UnifyPair> nSaL = nextSetasList.remove(0);
|
Set<UnifyPair> nSaL = nextSetasList.removeFirst();
|
||||||
//nextSetasList.remove(nSaL);
|
//nextSetasList.remove(nSaL);
|
||||||
writeLog("1 RM" + nSaL.toString());
|
writeLog("1 RM" + nSaL.toString());
|
||||||
|
|
||||||
|
|
||||||
if (!oderConstraint) {
|
if (oderConstraint) {
|
||||||
|
|
||||||
/* statistics sameEq wird nicht betrachtet ANGFANG
|
|
||||||
//ueberpruefung ob zu a =. ty \in nSaL in sameEqSet ein Widerspruch besteht
|
|
||||||
if (!sameEqSet.isEmpty() && !checkNoContradiction(nSaL, sameEqSet, result)) {
|
|
||||||
nSaL = null;
|
|
||||||
noShortendElements++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
statistics sameEq wird nicht betrachtet ENDE */
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
nextSetasListOderConstraints.add(((Constraint<UnifyPair>)nSaL).getExtendConstraint());
|
nextSetasListOderConstraints.add(((Constraint<UnifyPair>)nSaL).getExtendConstraint());
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<UnifyPair> newEq = new HashSet<>(eq);
|
Set<UnifyPair> newEq = new HashSet<>(eq);
|
||||||
Set<Set<UnifyPair>> newElems = new HashSet<>(elems);
|
Set<Set<UnifyPair>> newElems = new HashSet<>(elems);
|
||||||
List<Set<Constraint<UnifyPair>>> newOderConstraints = new ArrayList<>(oderConstraints);
|
List<Set<Constraint<UnifyPair>>> newOderConstraints = new ArrayList<>(oderConstraints);
|
||||||
@ -941,7 +855,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
forkOrig.writeLog("final Orig 1");
|
forkOrig.writeLog("final Orig 1");
|
||||||
forkOrig.closeLogFile();
|
forkOrig.closeLogFile();
|
||||||
//Set<Set<UnifyPair>> fork_res = forkOrig.join();
|
//Set<Set<UnifyPair>> fork_res = forkOrig.join();
|
||||||
writeLog("JoinOrig " + new Integer(forkOrig.thNo).toString());
|
writeLog("JoinOrig " + Integer.valueOf(forkOrig.thNo).toString());
|
||||||
//noOfThread--; an das Ende von compute verschoben
|
//noOfThread--; an das Ende von compute verschoben
|
||||||
//add_res.add(fork_res);
|
//add_res.add(fork_res);
|
||||||
/* FORK ENDE */
|
/* FORK ENDE */
|
||||||
@ -952,9 +866,9 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
//noOfThread++;
|
//noOfThread++;
|
||||||
//noOfThread--; an das Ende von compute verschoben
|
//noOfThread--; an das Ende von compute verschoben
|
||||||
writeLog("Join " + new Integer(fork.thNo).toString() + "\n" +
|
writeLog("Join " + Integer.valueOf(fork.thNo).toString() + "\n" +
|
||||||
"fork_res: " + fork_res.toString() + "\n" +
|
"fork_res: " + fork_res.toString() + "\n" +
|
||||||
new Boolean((isUndefinedPairSetSet(fork_res))).toString());
|
Boolean.valueOf((isUndefinedPairSetSet(fork_res))).toString());
|
||||||
add_res.add(fork_res);
|
add_res.add(fork_res);
|
||||||
if (!isUndefinedPairSetSet(fork_res)) {
|
if (!isUndefinedPairSetSet(fork_res)) {
|
||||||
aParDef.add(fork.getNextSetElement());
|
aParDef.add(fork.getNextSetElement());
|
||||||
@ -983,21 +897,11 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
"nextSetasListRest: " + nextSetasListRest.toString());
|
"nextSetasListRest: " + nextSetasListRest.toString());
|
||||||
|
|
||||||
while (!nextSetasList.isEmpty()) {
|
while (!nextSetasList.isEmpty()) {
|
||||||
Set<UnifyPair> nSaL = nextSetasList.remove(0);
|
Set<UnifyPair> nSaL = nextSetasList.removeFirst();
|
||||||
//nextSetasList.remove(nSaL);
|
//nextSetasList.remove(nSaL);
|
||||||
writeLog("-1 RM" + nSaL.toString());
|
writeLog("-1 RM" + nSaL.toString());
|
||||||
|
|
||||||
if (!oderConstraint) {
|
if(oderConstraint){
|
||||||
/* statistics sameEq wird nicht betrachtet ANGFANG
|
|
||||||
//ueberpruefung ob zu a =. ty \in nSaL in sameEqSet ein Widerspruch besteht
|
|
||||||
if (!sameEqSet.isEmpty() && !checkNoContradiction(nSaL, sameEqSet, result)) {
|
|
||||||
nSaL = null;
|
|
||||||
noShortendElements++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
statistics sameEq wird nicht betrachtet ENDE */
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
nextSetasListOderConstraints.add(((Constraint<UnifyPair>)nSaL).getExtendConstraint());
|
nextSetasListOderConstraints.add(((Constraint<UnifyPair>)nSaL).getExtendConstraint());
|
||||||
}
|
}
|
||||||
Set<UnifyPair> newEq = new HashSet<>(eq);
|
Set<UnifyPair> newEq = new HashSet<>(eq);
|
||||||
@ -1018,7 +922,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
forkOrig.writeLog("final Orig -1");
|
forkOrig.writeLog("final Orig -1");
|
||||||
forkOrig.closeLogFile();
|
forkOrig.closeLogFile();
|
||||||
//Set<Set<UnifyPair>> fork_res = forkOrig.join();
|
//Set<Set<UnifyPair>> fork_res = forkOrig.join();
|
||||||
writeLog("JoinOrig " + new Integer(forkOrig.thNo).toString());
|
writeLog("JoinOrig " + Integer.valueOf(forkOrig.thNo).toString());
|
||||||
//noOfThread--; an das Ende von compute verschoben
|
//noOfThread--; an das Ende von compute verschoben
|
||||||
//add_res.add(fork_res);
|
//add_res.add(fork_res);
|
||||||
/* FORK ENDE */
|
/* FORK ENDE */
|
||||||
@ -1028,17 +932,17 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
Set<Set<UnifyPair>> fork_res = fork.join();
|
Set<Set<UnifyPair>> fork_res = fork.join();
|
||||||
|
|
||||||
//noOfThread++;
|
//noOfThread++;
|
||||||
writeLog("Join " + new Integer(fork.thNo).toString());
|
writeLog("Join " + Integer.valueOf(fork.thNo).toString());
|
||||||
//noOfThread--; an das Ende von compute verschoben
|
//noOfThread--; an das Ende von compute verschoben
|
||||||
writeLog("fork_res: " + fork_res.toString());
|
writeLog("fork_res: " + fork_res.toString());
|
||||||
writeLog(new Boolean((isUndefinedPairSetSet(fork_res))).toString());
|
writeLog(Boolean.valueOf((isUndefinedPairSetSet(fork_res))).toString());
|
||||||
add_res.add(fork_res);
|
add_res.add(fork_res);
|
||||||
if (!isUndefinedPairSetSet(fork_res)) {
|
if (!isUndefinedPairSetSet(fork_res)) {
|
||||||
aParDef.add(fork.getNextSetElement());
|
aParDef.add(fork.getNextSetElement());
|
||||||
}
|
}
|
||||||
fork.writeLog("final -1");
|
fork.writeLog("final -1");
|
||||||
fork.closeLogFile();
|
fork.closeLogFile();
|
||||||
};
|
}
|
||||||
|
|
||||||
//noOfThread++;
|
//noOfThread++;
|
||||||
} else {
|
} else {
|
||||||
@ -1060,7 +964,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
"nextSetasListRest: " + nextSetasListRest.toString());
|
"nextSetasListRest: " + nextSetasListRest.toString());
|
||||||
|
|
||||||
while (!nextSetasList.isEmpty()) {
|
while (!nextSetasList.isEmpty()) {
|
||||||
Set<UnifyPair> nSaL = nextSetasList.remove(0);
|
Set<UnifyPair> nSaL = nextSetasList.removeFirst();
|
||||||
//nextSetasList.remove(nSaL); //PL einkommentiert 20-02-03
|
//nextSetasList.remove(nSaL); //PL einkommentiert 20-02-03
|
||||||
Set<UnifyPair> newEq = new HashSet<>(eq);
|
Set<UnifyPair> newEq = new HashSet<>(eq);
|
||||||
Set<Set<UnifyPair>> newElems = new HashSet<>(elems);
|
Set<Set<UnifyPair>> newElems = new HashSet<>(elems);
|
||||||
@ -1081,7 +985,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
forkOrig.writeLog("final Orig 2");
|
forkOrig.writeLog("final Orig 2");
|
||||||
forkOrig.closeLogFile();
|
forkOrig.closeLogFile();
|
||||||
//Set<Set<UnifyPair>> fork_res = forkOrig.join();
|
//Set<Set<UnifyPair>> fork_res = forkOrig.join();
|
||||||
writeLog("JoinOrig " + new Integer(forkOrig.thNo).toString());
|
writeLog("JoinOrig " + Integer.valueOf(forkOrig.thNo).toString());
|
||||||
//noOfThread--; an das Ende von compute verschoben
|
//noOfThread--; an das Ende von compute verschoben
|
||||||
//add_res.add(fork_res); //vermutlich falsch
|
//add_res.add(fork_res); //vermutlich falsch
|
||||||
|
|
||||||
@ -1091,7 +995,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
Set<Set<UnifyPair>> fork_res = fork.join();
|
Set<Set<UnifyPair>> fork_res = fork.join();
|
||||||
|
|
||||||
//noOfThread++;
|
//noOfThread++;
|
||||||
writeLog("Join " + new Integer(fork.thNo).toString());
|
writeLog("Join " + Integer.valueOf(fork.thNo).toString());
|
||||||
//noOfThread--; an das Ende von compute verschoben
|
//noOfThread--; an das Ende von compute verschoben
|
||||||
add_res.add(fork_res);
|
add_res.add(fork_res);
|
||||||
fork.writeLog("final 2");
|
fork.writeLog("final 2");
|
||||||
@ -1217,9 +1121,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
if (!isUndefinedPairSetSet(par_res) && isUndefinedPairSetSet(result)) {
|
if (!isUndefinedPairSetSet(par_res) && isUndefinedPairSetSet(result)) {
|
||||||
//wenn korrektes Ergebnis gefunden alle Fehlerfaelle loeschen
|
//wenn korrektes Ergebnis gefunden alle Fehlerfaelle loeschen
|
||||||
result = par_res;
|
result = par_res;
|
||||||
if (!par_res.isEmpty() && par_res.iterator().next() instanceof WildcardType) {
|
|
||||||
//System.out.println("");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ((isUndefinedPairSetSet(par_res) && isUndefinedPairSetSet(result))
|
if ((isUndefinedPairSetSet(par_res) && isUndefinedPairSetSet(result))
|
||||||
@ -1374,7 +1275,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
auskommentiert um alle Max und min Betrachtung auszuschalten ENDE */
|
auskommentiert um alle Max und min Betrachtung auszuschalten ENDE */
|
||||||
|
|
||||||
if (isUndefinedPairSetSet(res) && aParDef.isEmpty()) {
|
if (isUndefinedPairSetSet(res) && aParDef.isEmpty()) {
|
||||||
int nofstred= 0;
|
int nofstred;
|
||||||
Set<UnifyPair> abhSubst = res.stream()
|
Set<UnifyPair> abhSubst = res.stream()
|
||||||
.map(b ->
|
.map(b ->
|
||||||
b.stream()
|
b.stream()
|
||||||
@ -1396,16 +1297,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
.collect(Collectors.toCollection(HashSet::new));
|
.collect(Collectors.toCollection(HashSet::new));
|
||||||
//Set<PlaceholderType> vars = durchschnitt.stream().map(x -> (PlaceholderType)x.getLhsType()).collect(Collectors.toCollection(HashSet::new));
|
//Set<PlaceholderType> vars = durchschnitt.stream().map(x -> (PlaceholderType)x.getLhsType()).collect(Collectors.toCollection(HashSet::new));
|
||||||
int len = nextSetasList.size();
|
int len = nextSetasList.size();
|
||||||
Set<UnifyPair> undefRes = res.stream().reduce((y,z) -> { y.addAll(z); return y;}).get(); //flatten aller undef results
|
|
||||||
Set<Pair<Set<UnifyPair>, UnifyPair>> reducedUndefResSubstGroundedBasePair = undefRes.stream()
|
|
||||||
.map(x -> { Set<UnifyPair> su = x.getAllSubstitutions(); //alle benutzten Substitutionen
|
|
||||||
su.add(x.getGroundBasePair()); // urspruengliches Paar
|
|
||||||
su.removeAll(durchschnitt); //alle aktuell genänderten Paare entfernen
|
|
||||||
return new Pair<>(su, x.getGroundBasePair());})
|
|
||||||
.collect(Collectors.toCollection(HashSet::new));
|
|
||||||
if (res.size() > 1) {
|
|
||||||
//System.out.println();
|
|
||||||
}
|
|
||||||
/* statistics no erase
|
/* statistics no erase
|
||||||
writeLog("nextSetasList vor filter-Aufruf: " + nextSetasList);
|
writeLog("nextSetasList vor filter-Aufruf: " + nextSetasList);
|
||||||
if (!oderConstraint) {//PL 2023-02-08 eingefuegt: Bei oderconstraints sind Subststitutionen nicht als Substitutionen in idesem Sinne zu sehen
|
if (!oderConstraint) {//PL 2023-02-08 eingefuegt: Bei oderconstraints sind Subststitutionen nicht als Substitutionen in idesem Sinne zu sehen
|
||||||
@ -1459,168 +1350,9 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* checks if there is for (a = ty) \in a in sameEqSet a constradiction
|
|
||||||
* @param a Set of actual element of constraints with a =. ty \in a
|
|
||||||
* @param sameEqSet Set of constraints where a <. ty' and ty' <. a
|
|
||||||
* @param result set of results which contains correct solution s and the
|
|
||||||
* the error constraints. Error constraints are added
|
|
||||||
* @result contradiction of (a = ty) in sameEqSet
|
|
||||||
*/
|
|
||||||
protected Boolean checkNoContradiction(Set<UnifyPair> a, Set<UnifyPair> sameEqSet, Set<Set<UnifyPair>> result) {
|
|
||||||
|
|
||||||
//optAPair enthaelt ggf. das Paar a = ty' \in a
|
|
||||||
//unterscheidet sich von optOrigPair, da dort a = ty
|
|
||||||
Optional<UnifyPair> optAPair =
|
|
||||||
a.stream().filter(x -> (x.getPairOp().equals(PairOperator.EQUALSDOT)))
|
|
||||||
.filter(x -> //Sicherstellen, dass bei a = ty a auch wirklich die gesuchte Typvariable ist
|
|
||||||
x.getLhsType().equals(x.getBasePair().getLhsType()) ||
|
|
||||||
x.getLhsType().equals(x.getBasePair().getRhsType()))
|
|
||||||
.findFirst();
|
|
||||||
|
|
||||||
if (optAPair.isPresent()) {//basepair ist entweder a <. Ty oder ty <. a
|
|
||||||
UnifyPair aPair = optAPair.get();
|
|
||||||
//writeLog("optOrigPair: " + optOrigPair + " " + "aPair: " + aPair+ " " + "aPair.basePair(): " + aPair.getBasePair());
|
|
||||||
|
|
||||||
writeLog("checkA: " + aPair + "sameEqSet: " + sameEqSet);
|
|
||||||
for (UnifyPair sameEq : sameEqSet) {
|
|
||||||
if (sameEq.getLhsType() instanceof PlaceholderType) {
|
|
||||||
Set<UnifyPair> localEq = new HashSet<>();
|
|
||||||
Set<UnifyPair> unitedSubst = new HashSet<>(aPair.getAllSubstitutions());
|
|
||||||
unitedSubst.addAll(aPair.getAllBases());
|
|
||||||
unitedSubst.addAll(sameEq.getAllSubstitutions());
|
|
||||||
unitedSubst.addAll(sameEq.getAllBases());
|
|
||||||
localEq.add(new UnifyPair(aPair.getRhsType(), sameEq.getRhsType(), sameEq.getPairOp(), unitedSubst, null));
|
|
||||||
finalresult = false;
|
|
||||||
Set<Set<UnifyPair>> localRes = unify(localEq, new ArrayList<>(), fc, false, 0, new HashSet<>());
|
|
||||||
finalresult = true;
|
|
||||||
if (isUndefinedPairSetSet(localRes)) {
|
|
||||||
if (result.isEmpty() || isUndefinedPairSetSet(result)) {
|
|
||||||
result.addAll(localRes);
|
|
||||||
}
|
|
||||||
writeLog("FALSE: " + aPair + "sameEqSet: " + sameEqSet);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Set<UnifyPair> localEq = new HashSet<>();
|
|
||||||
Set<UnifyPair> unitedSubst = new HashSet<>(aPair.getAllSubstitutions());
|
|
||||||
unitedSubst.addAll(aPair.getAllBases());
|
|
||||||
unitedSubst.addAll(sameEq.getAllSubstitutions());
|
|
||||||
unitedSubst.addAll(sameEq.getAllBases());
|
|
||||||
localEq.add(new UnifyPair(sameEq.getLhsType(), aPair.getRhsType(), sameEq.getPairOp(), unitedSubst, null));
|
|
||||||
finalresult = false;
|
|
||||||
Set<Set<UnifyPair>> localRes = unify(localEq, new ArrayList<>(), fc, false, 0, new HashSet<>());
|
|
||||||
finalresult = true;
|
|
||||||
if (isUndefinedPairSetSet(localRes)) {
|
|
||||||
if (result.isEmpty() || isUndefinedPairSetSet(result)) {
|
|
||||||
result.addAll(localRes);
|
|
||||||
}
|
|
||||||
writeLog("FALSE: " + aPair + "sameEqSet: " + sameEqSet);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
writeLog("TRUE: " + aPair + "sameEqSet: " + sameEqSet);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected boolean couldBecorrect(Set<Pair<Set<UnifyPair>, UnifyPair>> reducedUndefResSubstGroundedBasePair, Set<UnifyPair> nextElem) {
|
|
||||||
return reducedUndefResSubstGroundedBasePair.stream()
|
|
||||||
.map(pair -> {
|
|
||||||
Set<UnifyPair> reducedAbhSubst = pair.getKey();
|
|
||||||
reducedAbhSubst.addAll(nextElem);
|
|
||||||
Optional<Set<UnifyPair>> substRes = rules.subst(reducedAbhSubst);
|
|
||||||
if (!substRes.isPresent()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
//PL 2018-10-12
|
|
||||||
//Evtl. zurest applyTypeUnification aufrufen
|
|
||||||
//evtl auch unify aufrufen
|
|
||||||
else {
|
|
||||||
UnifyPair checkPair = substRes.get().stream()
|
|
||||||
.filter(x -> x.getGroundBasePair().equals(pair.getValue().get())).findFirst().get();
|
|
||||||
if (((checkPair.getLhsType() instanceof PlaceholderType) || (checkPair.getRhsType() instanceof PlaceholderType))
|
|
||||||
&& (checkPair.getPairOp() == PairOperator.SMALLERDOT || checkPair.getPairOp() == PairOperator.SMALLERDOTWC))
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Set<UnifyPair> setCheckPair = new HashSet<>();
|
|
||||||
setCheckPair.add(checkPair);
|
|
||||||
Set<UnifyPair> setReturnCheckPair = applyTypeUnificationRules(setCheckPair, fc);
|
|
||||||
UnifyPair checkPair1 = setReturnCheckPair.iterator().next();
|
|
||||||
Set<UnifyPair> up = new HashSet<>();
|
|
||||||
up.add(checkPair1);
|
|
||||||
Set<UnifyPair> undef = new HashSet<>();
|
|
||||||
*/
|
|
||||||
PairOperator pairOp = checkPair.getPairOp();
|
|
||||||
UnifyType lhsType = checkPair.getLhsType();
|
|
||||||
UnifyType rhsType = checkPair.getRhsType();
|
|
||||||
///* Case 1: (a <. Theta')
|
|
||||||
if ((((pairOp == PairOperator.SMALLERDOT) || (pairOp == PairOperator.SMALLERNEQDOT)) && lhsType instanceof PlaceholderType)
|
|
||||||
// Case 2: (a <.? ? ext Theta')
|
|
||||||
|| (pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof PlaceholderType && rhsType instanceof ExtendsType)
|
|
||||||
// Case 3: (a <.? ? sup Theta')
|
|
||||||
|| (pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof PlaceholderType && rhsType instanceof SuperType)
|
|
||||||
|
|
||||||
// Case 4 was replaced by an inference rule
|
|
||||||
// Case 4: (a <.? Theta')
|
|
||||||
|| (pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof PlaceholderType)
|
|
||||||
// Case 5: (Theta <. a)
|
|
||||||
|| ((pairOp == PairOperator.SMALLERDOT) && rhsType instanceof PlaceholderType)
|
|
||||||
// Case 6 was replaced by an inference rule.
|
|
||||||
// Case 6: (? ext Theta <.? a)
|
|
||||||
|| (pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof ExtendsType && rhsType instanceof PlaceholderType)
|
|
||||||
// Case 7 was replaced by an inference rule
|
|
||||||
// Case 7: (? sup Theta <.? a)
|
|
||||||
|| (pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof SuperType && rhsType instanceof PlaceholderType)
|
|
||||||
// Case 8: (Theta <.? a)
|
|
||||||
|| (pairOp == PairOperator.SMALLERDOTWC && rhsType instanceof PlaceholderType)
|
|
||||||
//reduceWildcardLow
|
|
||||||
|| (pairOp == PairOperator.SMALLERDOTWC && (lhsType instanceof ExtendsType) && (rhsType instanceof ExtendsType))
|
|
||||||
//reduceWildcardLowRight
|
|
||||||
|| ((pairOp == PairOperator.SMALLERDOTWC) && (lhsType instanceof ReferenceType) && (rhsType instanceof ExtendsType))
|
|
||||||
//reduceWildcardUp
|
|
||||||
|| ((pairOp == PairOperator.SMALLERDOTWC) && (lhsType instanceof SuperType) && (rhsType instanceof SuperType))
|
|
||||||
//reduceWildcardUpRight
|
|
||||||
|| ((pairOp == PairOperator.SMALLERDOTWC) && (lhsType instanceof ReferenceType) && (rhsType instanceof SuperType))
|
|
||||||
//reduceFunN
|
|
||||||
|| (((pairOp == PairOperator.SMALLERDOT) || (pairOp == PairOperator.EQUALSDOT))
|
|
||||||
//PL 2017-10-03 hinzugefuegt
|
|
||||||
//da Regel auch fuer EQUALSDOT anwendbar
|
|
||||||
&& (lhsType instanceof FunNType) && (rhsType instanceof FunNType))
|
|
||||||
//greaterFunN
|
|
||||||
|| ((pairOp== PairOperator.SMALLERDOT) && (lhsType instanceof FunNType) && (rhsType instanceof PlaceholderType))
|
|
||||||
//smallerFunN
|
|
||||||
|| ((pairOp == PairOperator.SMALLERDOT) && (lhsType instanceof PlaceholderType && rhsType instanceof FunNType))
|
|
||||||
//reduceTph
|
|
||||||
|| ((pairOp == PairOperator.SMALLERDOTWC) && (lhsType instanceof PlaceholderType && rhsType instanceof ReferenceType))
|
|
||||||
//reduceTphExt
|
|
||||||
|| ((pairOp == PairOperator.SMALLERDOTWC) && (lhsType instanceof ExtendsType) && rhsType instanceof PlaceholderType)
|
|
||||||
//reduceTphSup
|
|
||||||
|| ((pairOp == PairOperator.SMALLERDOTWC) && (lhsType instanceof SuperType) && rhsType instanceof PlaceholderType)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// Case unknown: If a pair fits no other case, then the type unification has failed.
|
|
||||||
// Through application of the rules, every pair should have one of the above forms.
|
|
||||||
// Pairs that do not have one of the aboves form are contradictory.
|
|
||||||
else {
|
|
||||||
writeLog("Second erase:" +checkPair.toString());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//*/
|
|
||||||
} else {
|
|
||||||
//Pair type <. ? extends ? extends type betrachten TODO PL 2018-10-09
|
|
||||||
}}
|
|
||||||
return true;}).reduce((xx, yy) -> xx || yy).get();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean isUndefinedPairSet(Set<UnifyPair> s) {
|
protected boolean isUndefinedPairSet(Set<UnifyPair> s) {
|
||||||
if (s.size() >= 1 ) {
|
if (!s.isEmpty()) {
|
||||||
Boolean ret = s.stream().map(x -> x.isUndefinedPair()).reduce(true, (x,y)-> (x && y));
|
return s.stream().map(x -> x.isUndefinedPair()).reduce(true, (x, y)-> (x && y));
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
@ -1628,9 +1360,8 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isUndefinedPairSetSet(Set<Set<UnifyPair>> s) {
|
protected boolean isUndefinedPairSetSet(Set<Set<UnifyPair>> s) {
|
||||||
if (s.size() >= 1) {
|
if (!s.isEmpty()) {
|
||||||
Boolean ret = s.stream(). map(x -> isUndefinedPairSet(x)).reduce(true, (x,y)-> (x && y));
|
return s.stream(). map(x -> isUndefinedPairSet(x)).reduce(true, (x, y)-> (x && y));
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1675,7 +1406,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
LinkedHashSet<UnifyPair> targetSet = new LinkedHashSet<UnifyPair>();
|
LinkedHashSet<UnifyPair> targetSet = new LinkedHashSet<>();
|
||||||
LinkedList<UnifyPair> eqQueue = new LinkedList<>();
|
LinkedList<UnifyPair> eqQueue = new LinkedList<>();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1818,7 +1549,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
ArrayList<UnifyPair> eq2sAsListFourth = new ArrayList<>();
|
ArrayList<UnifyPair> eq2sAsListFourth = new ArrayList<>();
|
||||||
ArrayList<UnifyPair> eq2sAsListBack = new ArrayList<>();
|
ArrayList<UnifyPair> eq2sAsListBack = new ArrayList<>();
|
||||||
ArrayList<UnifyPair> eq2sAsList = new ArrayList<>();
|
ArrayList<UnifyPair> eq2sAsList = new ArrayList<>();
|
||||||
Boolean first = true;
|
boolean first = true;
|
||||||
while(eq2sprimeit.hasNext()) {// alle mit Variance != 0 nach vorne schieben
|
while(eq2sprimeit.hasNext()) {// alle mit Variance != 0 nach vorne schieben
|
||||||
UnifyPair up = eq2sprimeit.next();
|
UnifyPair up = eq2sprimeit.next();
|
||||||
if ((up.getLhsType() instanceof PlaceholderType &&
|
if ((up.getLhsType() instanceof PlaceholderType &&
|
||||||
@ -1861,13 +1592,13 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
{
|
{
|
||||||
List<Set<Constraint<UnifyPair>>> oderConstraintsVariance = oderConstraintsOutput.stream() //Alle Elemente rauswerfen, die Variance 0 haben oder keine TPH in LHS oder RHS sind
|
List<Set<Constraint<UnifyPair>>> oderConstraintsVariance = oderConstraintsOutput.stream() //Alle Elemente rauswerfen, die Variance 0 haben oder keine TPH in LHS oder RHS sind
|
||||||
.filter(x -> x.stream()
|
.filter(x -> x.stream()
|
||||||
.filter(y ->
|
.anyMatch(y ->
|
||||||
y.stream().filter(z -> ((z.getLhsType() instanceof PlaceholderType)
|
y.stream().anyMatch(z -> ((z.getLhsType() instanceof PlaceholderType)
|
||||||
&& (((PlaceholderType)(z.getLhsType())).getVariance() != 0))
|
&& (((PlaceholderType)(z.getLhsType())).getVariance() != 0))
|
||||||
|| ((z.getRhsType() instanceof PlaceholderType)
|
|| ((z.getRhsType() instanceof PlaceholderType)
|
||||||
&& (((PlaceholderType)(z.getRhsType())).getVariance() != 0))
|
&& (((PlaceholderType)(z.getRhsType())).getVariance() != 0))
|
||||||
).findFirst().isPresent()
|
)
|
||||||
).findFirst().isPresent()).collect(Collectors.toList());
|
)).collect(Collectors.toList());
|
||||||
if (!oderConstraintsVariance.isEmpty()) {
|
if (!oderConstraintsVariance.isEmpty()) {
|
||||||
Set<Constraint<UnifyPair>> ret = oderConstraintsVariance.get(0);
|
Set<Constraint<UnifyPair>> ret = oderConstraintsVariance.get(0);
|
||||||
oderConstraintsOutput.remove(ret);
|
oderConstraintsOutput.remove(ret);
|
||||||
@ -1906,7 +1637,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
if (eq2sAsList.isEmpty() && first) {//Alle eq2s sind empty und alle oderConstraints mit Variance != 0 sind bearbeitet
|
if (eq2sAsList.isEmpty() && first) {//Alle eq2s sind empty und alle oderConstraints mit Variance != 0 sind bearbeitet
|
||||||
if (!oderConstraintsOutput.isEmpty()) {
|
if (!oderConstraintsOutput.isEmpty()) {
|
||||||
Set<Constraint<UnifyPair>> ret = oderConstraintsOutput.remove(0);
|
Set<Constraint<UnifyPair>> ret = oderConstraintsOutput.removeFirst();
|
||||||
//if (ret.iterator().next().iterator().next().getLhsType().getName().equals("M"))
|
//if (ret.iterator().next().iterator().next().getLhsType().getName().equals("M"))
|
||||||
// System.out.println("M");
|
// System.out.println("M");
|
||||||
//Set<UnifyPair> retFlat = new HashSet<>();
|
//Set<UnifyPair> retFlat = new HashSet<>();
|
||||||
@ -1934,11 +1665,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
Bei allen die Abhaengigkeit der Elemente aus eq2sAsList als evtl. als Substitution
|
Bei allen die Abhaengigkeit der Elemente aus eq2sAsList als evtl. als Substitution
|
||||||
hinzufuegen
|
hinzufuegen
|
||||||
*/
|
*/
|
||||||
Set<UnifyPair> consideredElements = new HashSet<>();
|
|
||||||
for(UnifyPair pair : eq2sAsList) {
|
for(UnifyPair pair : eq2sAsList) {
|
||||||
if (consideredElements.contains(pair)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
PairOperator pairOp = pair.getPairOp();
|
PairOperator pairOp = pair.getPairOp();
|
||||||
UnifyType lhsType = pair.getLhsType();
|
UnifyType lhsType = pair.getLhsType();
|
||||||
UnifyType rhsType = pair.getRhsType();
|
UnifyType rhsType = pair.getRhsType();
|
||||||
@ -1947,9 +1674,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
if (((pairOp == PairOperator.SMALLERDOT) || (pairOp == PairOperator.SMALLERNEQDOT)) && lhsType instanceof PlaceholderType) {
|
if (((pairOp == PairOperator.SMALLERDOT) || (pairOp == PairOperator.SMALLERNEQDOT)) && lhsType instanceof PlaceholderType) {
|
||||||
//System.out.println(pair);
|
//System.out.println(pair);
|
||||||
if (first) { //writeLog(pair.toString()+"\n");
|
if (first) { //writeLog(pair.toString()+"\n");
|
||||||
if (((PlaceholderType)(pair.getLhsType())).getName().equals("AR")) {
|
|
||||||
//System.out.println("AR");
|
|
||||||
}
|
|
||||||
Set<Set<UnifyPair>> x1 = unifyCase1(pair, fc);
|
Set<Set<UnifyPair>> x1 = unifyCase1(pair, fc);
|
||||||
if (pairOp == PairOperator.SMALLERNEQDOT) {
|
if (pairOp == PairOperator.SMALLERNEQDOT) {
|
||||||
Set<UnifyPair> remElem = new HashSet<>();
|
Set<UnifyPair> remElem = new HashSet<>();
|
||||||
@ -2026,7 +1750,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
}
|
}
|
||||||
result.get(0).add(x1ResPrime);
|
result.get(0).add(x1ResPrime);
|
||||||
ZU LOESCHEN ENDE */
|
ZU LOESCHEN ENDE */
|
||||||
result.get(0).add(x1);
|
result.getFirst().add(x1);
|
||||||
if (x1.isEmpty()) {
|
if (x1.isEmpty()) {
|
||||||
undefined.add(pair); //Theta ist nicht im FC => Abbruch
|
undefined.add(pair); //Theta ist nicht im FC => Abbruch
|
||||||
}
|
}
|
||||||
@ -2036,14 +1760,14 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
s1.add(pair);
|
s1.add(pair);
|
||||||
Set<Set<UnifyPair>> s2 = new HashSet<>();
|
Set<Set<UnifyPair>> s2 = new HashSet<>();
|
||||||
s2.add(s1);
|
s2.add(s1);
|
||||||
result.get(0).add(s2);
|
result.getFirst().add(s2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// Case 2: (a <.? ? ext Theta')
|
// Case 2: (a <.? ? ext Theta')
|
||||||
else if(pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof PlaceholderType && rhsType instanceof ExtendsType)
|
else if(pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof PlaceholderType && rhsType instanceof ExtendsType)
|
||||||
if (first) { //writeLog(pair.toString()+"\n");
|
if (first) { //writeLog(pair.toString()+"\n");
|
||||||
Set<Set<UnifyPair>> x1 = unifyCase2(pair, fc);
|
Set<Set<UnifyPair>> x1 = unifyCase2(pair);
|
||||||
result.get(1).add(x1);
|
result.get(1).add(x1);
|
||||||
if (x1.isEmpty()) {
|
if (x1.isEmpty()) {
|
||||||
undefined.add(pair); //Theta ist nicht im FC
|
undefined.add(pair); //Theta ist nicht im FC
|
||||||
@ -2060,7 +1784,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
// Case 3: (a <.? ? sup Theta')
|
// Case 3: (a <.? ? sup Theta')
|
||||||
else if(pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof PlaceholderType && rhsType instanceof SuperType)
|
else if(pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof PlaceholderType && rhsType instanceof SuperType)
|
||||||
if (first) { //writeLog(pair.toString()+"\n");
|
if (first) { //writeLog(pair.toString()+"\n");
|
||||||
Set<Set<UnifyPair>> x1 = unifyCase3(pair, fc);
|
Set<Set<UnifyPair>> x1 = unifyCase3(pair);
|
||||||
result.get(2).add(x1);
|
result.get(2).add(x1);
|
||||||
if (x1.isEmpty()) {
|
if (x1.isEmpty()) {
|
||||||
undefined.add(pair); //Theta ist nicht im FC
|
undefined.add(pair); //Theta ist nicht im FC
|
||||||
@ -2109,7 +1833,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
// Case 8: (Theta <.? a)
|
// Case 8: (Theta <.? a)
|
||||||
else if(pairOp == PairOperator.SMALLERDOTWC && rhsType instanceof PlaceholderType)
|
else if(pairOp == PairOperator.SMALLERDOTWC && rhsType instanceof PlaceholderType)
|
||||||
if (first) { //writeLog(pair.toString()+"\n");
|
if (first) { //writeLog(pair.toString()+"\n");
|
||||||
Set<Set<UnifyPair>> x1 = unifyCase8(pair, fc);
|
Set<Set<UnifyPair>> x1 = unifyCase8(pair);
|
||||||
result.get(7).add(x1);
|
result.get(7).add(x1);
|
||||||
if (x1.isEmpty()) {
|
if (x1.isEmpty()) {
|
||||||
undefined.add(pair); //Theta ist nicht im FC
|
undefined.add(pair); //Theta ist nicht im FC
|
||||||
@ -2134,8 +1858,8 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Filter empty sets or sets that only contain an empty set.
|
// Filter empty sets or sets that only contain an empty set.
|
||||||
return result.stream().map(x -> x.stream().filter(y -> y.size() > 0).collect(Collectors.toCollection(HashSet::new)))
|
return result.stream().map(x -> x.stream().filter(y -> !y.isEmpty()).collect(Collectors.toCollection(HashSet::new)))
|
||||||
.filter(x -> x.size() > 0).collect(Collectors.toCollection(HashSet::new));
|
.filter(x -> !x.isEmpty()).collect(Collectors.toCollection(HashSet::new));
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Wenn Theta' nicht im FC muss ein Fehler produziert werden PL 18-04-20
|
//TODO: Wenn Theta' nicht im FC muss ein Fehler produziert werden PL 18-04-20
|
||||||
@ -2150,10 +1874,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
thetaPrime = ((ExtendsType)thetaPrime).getExtendedType();
|
thetaPrime = ((ExtendsType)thetaPrime).getExtendedType();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thetaPrime instanceof SuperType) {
|
|
||||||
//HIER MUSS NOCH WAS UEBERLEGT WERDEN
|
|
||||||
}
|
|
||||||
|
|
||||||
Set<Set<UnifyPair>> result = new HashSet<>();
|
Set<Set<UnifyPair>> result = new HashSet<>();
|
||||||
|
|
||||||
if (thetaPrime instanceof ReferenceType && ((ReferenceType)thetaPrime).isGenTypeVar()) {
|
if (thetaPrime instanceof ReferenceType && ((ReferenceType)thetaPrime).isGenTypeVar()) {
|
||||||
@ -2186,7 +1906,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
Set<UnifyType> csPHRenamed = cs.stream().map(x -> {
|
Set<UnifyType> csPHRenamed = cs.stream().map(x -> {
|
||||||
BinaryOperator<HashMap<PlaceholderType,PlaceholderType>> combiner = (aa,b) -> { aa.putAll(b); return aa;};
|
BinaryOperator<HashMap<PlaceholderType,PlaceholderType>> combiner = (aa,b) -> { aa.putAll(b); return aa;};
|
||||||
HashMap<PlaceholderType,PlaceholderType> hm = x.getInvolvedPlaceholderTypes().stream()
|
HashMap<PlaceholderType,PlaceholderType> hm = x.getInvolvedPlaceholderTypes().stream()
|
||||||
.reduce(new HashMap<PlaceholderType,PlaceholderType>(),
|
.reduce(new HashMap<>(),
|
||||||
(aa, b)-> { aa.put(b,PlaceholderType.freshPlaceholder()); return aa; }, combiner);
|
(aa, b)-> { aa.put(b,PlaceholderType.freshPlaceholder()); return aa; }, combiner);
|
||||||
return x.accept(new freshPlaceholder(), hm);
|
return x.accept(new freshPlaceholder(), hm);
|
||||||
}).collect(Collectors.toCollection(HashSet::new));
|
}).collect(Collectors.toCollection(HashSet::new));
|
||||||
@ -2194,13 +1914,13 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
IMatch match = new Match();
|
IMatch match = new Match();
|
||||||
for(UnifyType c : csPHRenamed) {
|
for(UnifyType c : csPHRenamed) {
|
||||||
//PL 18-02-05 getChildren durch smaller ersetzt in getChildren werden die Varianlen nicht ersetzt.
|
//PL 18-02-05 getChildren durch smaller ersetzt in getChildren werden die Varianlen nicht ersetzt.
|
||||||
Set<UnifyType> thetaQs = new HashSet<>();
|
Set<UnifyType> thetaQs;
|
||||||
//TODO smaller wieder reinnehmen?
|
//TODO smaller wieder reinnehmen?
|
||||||
//thetaQs.add(c);//
|
//thetaQs.add(c);//
|
||||||
thetaQs = fc.smaller(c, new HashSet<>()).stream().collect(Collectors.toCollection(HashSet::new));
|
thetaQs = new HashSet<>(fc.smaller(c, new HashSet<>()));
|
||||||
ArrayList<UnifyPair> ml = new ArrayList<>();
|
ArrayList<UnifyPair> ml = new ArrayList<>();
|
||||||
ml.add(new UnifyPair(c, thetaPrime, PairOperator.EQUALSDOT));
|
ml.add(new UnifyPair(c, thetaPrime, PairOperator.EQUALSDOT));
|
||||||
if (!(match.match(ml)).isPresent()) {
|
if ((match.match(ml)).isEmpty()) {
|
||||||
thetaQs.remove(c);
|
thetaQs.remove(c);
|
||||||
}
|
}
|
||||||
writeLog("thetaQs von " + c + ": " + thetaQs.toString());
|
writeLog("thetaQs von " + c + ": " + thetaQs.toString());
|
||||||
@ -2231,7 +1951,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
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);
|
||||||
if (!opt.isPresent()) {
|
if (opt.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Unifier unifier = opt.get();
|
Unifier unifier = opt.get();
|
||||||
@ -2277,17 +1997,16 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
if(allGen) {
|
if(allGen) {
|
||||||
UnifyPair up = new UnifyPair(a, theta, PairOperator.EQUALSDOT, pair.getSubstitution(), pair);
|
UnifyPair up = new UnifyPair(a, theta, PairOperator.EQUALSDOT, pair.getSubstitution(), pair);
|
||||||
Iterator<UnifyType> upit = up.getRhsType().getTypeParams().iterator();
|
//TODO PL 2019-01-24: upit.next() ist nicht unbedingt ein PlaceholderType -> Visitor erledigt
|
||||||
//TODO PL 2019-01-24: upit.next() ist nicht unbedingt ein PlaceholderType -> Visitor erledigt
|
for (UnifyType unifyType : up.getRhsType().getTypeParams())
|
||||||
while (upit.hasNext()) upit.next().accept(new distributeVariance(), a.getVariance());//((PlaceholderType)upit.next()).setVariance(a.getVariance());
|
unifyType.accept(new distributeVariance(), a.getVariance());//((PlaceholderType)upit.next()).setVariance(a.getVariance());
|
||||||
resultPrime.add(up);
|
resultPrime.add(up);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
UnifyPair up = new UnifyPair(a, theta.setTypeParams(new TypeParams(freshTphs.toArray(new UnifyType[0]))), PairOperator.EQUALSDOT, pair.getSubstitution(), pair);
|
UnifyPair up = new UnifyPair(a, theta.setTypeParams(new TypeParams(freshTphs.toArray(new UnifyType[0]))), PairOperator.EQUALSDOT, pair.getSubstitution(), pair);
|
||||||
Iterator<UnifyType> upit = up.getRhsType().getTypeParams().iterator();
|
//TODO PL 2019-01-24: upit.next() ist nicht unbedingt ein PlaceholderType -> Visitor erledigt
|
||||||
distributeVariance dv = new distributeVariance();
|
for (UnifyType unifyType : up.getRhsType().getTypeParams())
|
||||||
//TODO PL 2019-01-24: upit.next() ist nicht unbedingt ein PlaceholderType -> Visitor erledigt
|
unifyType.accept(new distributeVariance(), a.getVariance()); //((PlaceholderType)upit.next()).setVariance(a.getVariance());
|
||||||
while (upit.hasNext()) upit.next().accept(new distributeVariance(), a.getVariance()); //((PlaceholderType)upit.next()).setVariance(a.getVariance());
|
|
||||||
resultPrime.add(up);
|
resultPrime.add(up);
|
||||||
}
|
}
|
||||||
resultPrime.addAll(substitutionSet);
|
resultPrime.addAll(substitutionSet);
|
||||||
@ -2306,14 +2025,14 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
/**
|
/**
|
||||||
* Cartesian Product Case 2: (a <.? ? ext Theta')
|
* Cartesian Product Case 2: (a <.? ? ext Theta')
|
||||||
*/
|
*/
|
||||||
private Set<Set<UnifyPair>> unifyCase2(UnifyPair pair, IFiniteClosure fc) {
|
private Set<Set<UnifyPair>> unifyCase2(UnifyPair pair) {
|
||||||
PlaceholderType a = (PlaceholderType) pair.getLhsType();
|
PlaceholderType a = (PlaceholderType) pair.getLhsType();
|
||||||
ExtendsType extThetaPrime = (ExtendsType) pair.getRhsType();
|
ExtendsType extThetaPrime = (ExtendsType) pair.getRhsType();
|
||||||
Set<Set<UnifyPair>> result = new HashSet<>();
|
Set<Set<UnifyPair>> result = new HashSet<>();
|
||||||
|
|
||||||
UnifyType aPrime = PlaceholderType.freshPlaceholder();
|
PlaceholderType aPrime = PlaceholderType.freshPlaceholder();
|
||||||
((PlaceholderType)aPrime).setVariance(((PlaceholderType)a).getVariance());
|
aPrime.setVariance(a.getVariance());
|
||||||
((PlaceholderType)aPrime).disableWildcardtable();
|
aPrime.disableWildcardtable();
|
||||||
UnifyType extAPrime = new ExtendsType(aPrime);
|
UnifyType extAPrime = new ExtendsType(aPrime);
|
||||||
UnifyType thetaPrime = extThetaPrime.getExtendedType();
|
UnifyType thetaPrime = extThetaPrime.getExtendedType();
|
||||||
Set<UnifyPair> resultPrime = new HashSet<>();
|
Set<UnifyPair> resultPrime = new HashSet<>();
|
||||||
@ -2331,15 +2050,15 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
/**
|
/**
|
||||||
* Cartesian Product Case 3: (a <.? ? sup Theta')
|
* Cartesian Product Case 3: (a <.? ? sup Theta')
|
||||||
*/
|
*/
|
||||||
private Set<Set<UnifyPair>> unifyCase3(UnifyPair pair, IFiniteClosure fc) {
|
private Set<Set<UnifyPair>> unifyCase3(UnifyPair pair) {
|
||||||
PlaceholderType a = (PlaceholderType) pair.getLhsType();
|
PlaceholderType a = (PlaceholderType) pair.getLhsType();
|
||||||
a.reversVariance();
|
a.reversVariance();
|
||||||
SuperType subThetaPrime = (SuperType) pair.getRhsType();
|
SuperType subThetaPrime = (SuperType) pair.getRhsType();
|
||||||
Set<Set<UnifyPair>> result = new HashSet<>();
|
Set<Set<UnifyPair>> result = new HashSet<>();
|
||||||
|
|
||||||
UnifyType aPrime = PlaceholderType.freshPlaceholder();
|
PlaceholderType aPrime = PlaceholderType.freshPlaceholder();
|
||||||
((PlaceholderType)aPrime).setVariance(((PlaceholderType)a).getVariance());
|
aPrime.setVariance(a.getVariance());
|
||||||
((PlaceholderType)aPrime).disableWildcardtable();
|
aPrime.disableWildcardtable();
|
||||||
UnifyType supAPrime = new SuperType(aPrime);
|
UnifyType supAPrime = new SuperType(aPrime);
|
||||||
UnifyType thetaPrime = subThetaPrime.getSuperedType();
|
UnifyType thetaPrime = subThetaPrime.getSuperedType();
|
||||||
Set<UnifyPair> resultPrime = new HashSet<>();
|
Set<UnifyPair> resultPrime = new HashSet<>();
|
||||||
@ -2398,13 +2117,13 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
UnifyType[] freshTphs = new UnifyType[thetaS.getTypeParams().size()];
|
UnifyType[] freshTphs = new UnifyType[thetaS.getTypeParams().size()];
|
||||||
for(int i = 0; !allGen && i < freshTphs.length; i++) {
|
for(int i = 0; !allGen && i < freshTphs.length; i++) {
|
||||||
freshTphs[i] = PlaceholderType.freshPlaceholder();
|
freshTphs[i] = PlaceholderType.freshPlaceholder();
|
||||||
((PlaceholderType)freshTphs[i]).setVariance(((PlaceholderType)a).getVariance());
|
((PlaceholderType)freshTphs[i]).setVariance(a.getVariance());
|
||||||
Set<UnifyType> fBounded = new HashSet<>(pair.getfBounded()); //PL 2019-01-09 new HashSet eingefuegt
|
Set<UnifyType> fBounded = new HashSet<>(pair.getfBounded()); //PL 2019-01-09 new HashSet eingefuegt
|
||||||
|
|
||||||
int i_ef = i;
|
int i_ef = i;
|
||||||
BiFunction<Boolean,UnifyType,Boolean> f = (x,y) ->
|
BiFunction<Boolean,UnifyType,Boolean> f = (x,y) ->
|
||||||
{
|
{
|
||||||
ArrayList<UnifyPair> termList = new ArrayList<UnifyPair>();
|
ArrayList<UnifyPair> termList = new ArrayList<>();
|
||||||
termList.add(new UnifyPair(y,thetaS.getTypeParams().get(i_ef), PairOperator.EQUALSDOT));
|
termList.add(new UnifyPair(y,thetaS.getTypeParams().get(i_ef), PairOperator.EQUALSDOT));
|
||||||
return ((match.match(termList).isPresent()) || x);
|
return ((match.match(termList).isPresent()) || x);
|
||||||
};
|
};
|
||||||
@ -2436,7 +2155,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
/**
|
/**
|
||||||
* Cartesian Product Case 8: (Theta <.? a)
|
* Cartesian Product Case 8: (Theta <.? a)
|
||||||
*/
|
*/
|
||||||
private Set<Set<UnifyPair>> unifyCase8(UnifyPair pair, IFiniteClosure fc) {
|
private Set<Set<UnifyPair>> unifyCase8(UnifyPair pair) {
|
||||||
UnifyType theta = pair.getLhsType();
|
UnifyType theta = pair.getLhsType();
|
||||||
PlaceholderType a = (PlaceholderType) pair.getRhsType();
|
PlaceholderType a = (PlaceholderType) pair.getRhsType();
|
||||||
Set<Set<UnifyPair>> result = new HashSet<>();
|
Set<Set<UnifyPair>> result = new HashSet<>();
|
||||||
@ -2446,10 +2165,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
result.add(resultPrime);
|
result.add(resultPrime);
|
||||||
//writeLog(resultPrime.toString());
|
//writeLog(resultPrime.toString());
|
||||||
|
|
||||||
UnifyType freshTph = PlaceholderType.freshPlaceholder();
|
PlaceholderType freshTph = PlaceholderType.freshPlaceholder();
|
||||||
|
|
||||||
((PlaceholderType)freshTph).setVariance(a.getVariance());
|
freshTph.setVariance(a.getVariance());
|
||||||
((PlaceholderType)freshTph).disableWildcardtable();
|
freshTph.disableWildcardtable();
|
||||||
resultPrime = new HashSet<>();
|
resultPrime = new HashSet<>();
|
||||||
resultPrime.add(new UnifyPair(a, new ExtendsType(freshTph), PairOperator.EQUALSDOT, pair.getSubstitution(), pair));
|
resultPrime.add(new UnifyPair(a, new ExtendsType(freshTph), PairOperator.EQUALSDOT, pair.getSubstitution(), pair));
|
||||||
resultPrime.add(new UnifyPair(theta, freshTph, PairOperator.SMALLERDOT, pair.getSubstitution(), pair, pair.getfBounded()));
|
resultPrime.add(new UnifyPair(theta, freshTph, PairOperator.SMALLERDOT, pair.getSubstitution(), pair, pair.getfBounded()));
|
||||||
@ -2500,7 +2219,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void writeLog(String str) {
|
void writeLog(String str) {
|
||||||
if (log && finalresult) {
|
if (log) {
|
||||||
if(parallel){
|
if(parallel){
|
||||||
logFile.write("Thread no.:" + thNo + "\n"
|
logFile.write("Thread no.:" + thNo + "\n"
|
||||||
+ "parallel:" + parallel + "\n"
|
+ "parallel:" + parallel + "\n"
|
||||||
@ -2516,7 +2235,6 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void writeStatistics(String str) {
|
void writeStatistics(String str) {
|
||||||
if (finalresult) {
|
|
||||||
try {
|
try {
|
||||||
statisticsFile.write("Thread No. " + thNo + ": " + str + "\n");
|
statisticsFile.write("Thread No. " + thNo + ": " + str + "\n");
|
||||||
statisticsFile.flush();
|
statisticsFile.flush();
|
||||||
@ -2526,5 +2244,4 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
System.err.println("kein StatisticsFile");
|
System.err.println("kein StatisticsFile");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user