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

nextSetasListRest = oup.minElements(nextSetasListRest);
	nextSetasListRest = oup.maxElements(nextSetasListRest);

eingefuegt
	modified:   ../../../../main/java/de/dhbwstuttgart/typeinference/unify/model/FiniteClosure.java
This commit is contained in:
pl@gohorb.ba-horb.de 2020-05-12 17:25:04 +02:00
parent c8ece0a010
commit 670e3ed99f
2 changed files with 11 additions and 40 deletions

View File

@ -724,24 +724,8 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
}
}
List<Set<UnifyPair>> maxElementsTest = oup.maxElements(nextSetasListRest);
//Alle maximale Elemente in nextSetasListRest bestimmen
List<Set<UnifyPair>> nextSetasListRestTest;
do {
nextSetasListRestTest = new ArrayList<Set<UnifyPair>>(nextSetasListRest);
if (!nextSetasListRest.isEmpty()) {
Set<UnifyPair> max = oup.max(nextSetasListRest.iterator());
Iterator<Set<UnifyPair>> nextSetasListItRest2 = new ArrayList<Set<UnifyPair>>(nextSetasListRest).iterator();
while (nextSetasListItRest2.hasNext()) {
Set<UnifyPair> a_nextRest = nextSetasListItRest2.next();
if (//a.equals(a_next) ||
(oup.compare(max, a_nextRest) == 1)) {
nextSetasListRest.remove(a_nextRest);
}
}}
} while(!nextSetasListRestTest.equals(nextSetasListRest));
writeLog("maxElementsTest: " + maxElementsTest.equals(nextSetasListRest));
nextSetasListRest = oup.maxElements(nextSetasListRest);
}
else if (variance == -1) {
a = oup.min(nextSetasList.iterator());
@ -761,26 +745,8 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
}
}
//Alle minimalen Elemente in nextSetasListRest bestimmen
writeLog("nextSetasListRest davor: " + nextSetasListRest);
List<Set<UnifyPair>> minElementsTest = oup.minElements(nextSetasListRest);
List<Set<UnifyPair>> nextSetasListRestTest;
do {
nextSetasListRestTest = new ArrayList<Set<UnifyPair>>(nextSetasListRest);
if (!nextSetasListRest.isEmpty()) {
Set<UnifyPair> min = oup.min(nextSetasListRest.iterator());
Iterator<Set<UnifyPair>> nextSetasListItRest2 = new ArrayList<Set<UnifyPair>>(nextSetasListRest).iterator();
while (nextSetasListItRest2.hasNext()) {
Set<UnifyPair> a_nextRest = nextSetasListItRest2.next();
if (//a.equals(a_next) ||
(oup.compare(min, a_nextRest) == -1)) {
nextSetasListRest.remove(a_nextRest);
}
}}
} while(!nextSetasListRestTest.equals(nextSetasListRest));
writeLog("minElementsTest Vergleich: " + minElementsTest.equals(nextSetasListRest));
writeLog("minElementsTest danach: " + minElementsTest);
writeLog("nextSetasListRest danach: " + nextSetasListRest);
//writeLog("nextSetasListRest davor: " + nextSetasListRest);
nextSetasListRest = oup.minElements(nextSetasListRest);
}
else if (variance == 2) {
a = nextSetasList.remove(0);
@ -1435,9 +1401,12 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
//das kleineste Element ist das Element von dem a_new geerbt hat
//muss deshalb geloescht werden
Set<UnifyPair> min = oup.min(notErased.iterator());
notErased.remove(min);
notErased.remove(((Constraint<UnifyPair>)min).getExtendConstraint());
Iterator<Set<UnifyPair>> notErasedIt = notErased.iterator();
if (notErasedIt.hasNext()) {
Set<UnifyPair> min = oup.min(notErasedIt);
notErased.remove(min);
notErased.remove(((Constraint<UnifyPair>)min).getExtendConstraint());
}
List<Set<UnifyPair>> erased = new ArrayList<>(greaterSetasList);
erased.removeAll(notErased);

View File

@ -76,6 +76,7 @@ implements IFiniteClosure {
// Build the transitive closure of the inheritance tree
for(UnifyPair pair : pairs) {
/*
try {
logFile.write("Pair: " + pair + "\n");
logFile.flush();
@ -83,6 +84,7 @@ implements IFiniteClosure {
catch (IOException e) {
System.err.println("no LogFile");
}
*/
if(pair.getPairOp() != PairOperator.SMALLER)
continue;