From 670e3ed99fe13f0909a0a2af9eb0690b03b40bea Mon Sep 17 00:00:00 2001 From: "pl@gohorb.ba-horb.de" Date: Tue, 12 May 2020 17:25:04 +0200 Subject: [PATCH] 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 --- .../typeinference/unify/TypeUnifyTask.java | 49 ++++--------------- .../unify/model/FiniteClosure.java | 2 + 2 files changed, 11 insertions(+), 40 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index d350077a..1acdeaa3 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -724,24 +724,8 @@ public class TypeUnifyTask extends RecursiveTask>> { } } - List> maxElementsTest = oup.maxElements(nextSetasListRest); //Alle maximale Elemente in nextSetasListRest bestimmen - List> nextSetasListRestTest; - do { - nextSetasListRestTest = new ArrayList>(nextSetasListRest); - if (!nextSetasListRest.isEmpty()) { - Set max = oup.max(nextSetasListRest.iterator()); - Iterator> nextSetasListItRest2 = new ArrayList>(nextSetasListRest).iterator(); - while (nextSetasListItRest2.hasNext()) { - Set 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>> { } } //Alle minimalen Elemente in nextSetasListRest bestimmen - writeLog("nextSetasListRest davor: " + nextSetasListRest); - List> minElementsTest = oup.minElements(nextSetasListRest); - List> nextSetasListRestTest; - do { - nextSetasListRestTest = new ArrayList>(nextSetasListRest); - if (!nextSetasListRest.isEmpty()) { - Set min = oup.min(nextSetasListRest.iterator()); - Iterator> nextSetasListItRest2 = new ArrayList>(nextSetasListRest).iterator(); - while (nextSetasListItRest2.hasNext()) { - Set 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>> { //das kleineste Element ist das Element von dem a_new geerbt hat //muss deshalb geloescht werden - Set min = oup.min(notErased.iterator()); - notErased.remove(min); - notErased.remove(((Constraint)min).getExtendConstraint()); + Iterator> notErasedIt = notErased.iterator(); + if (notErasedIt.hasNext()) { + Set min = oup.min(notErasedIt); + notErased.remove(min); + notErased.remove(((Constraint)min).getExtendConstraint()); + } List> erased = new ArrayList<>(greaterSetasList); erased.removeAll(notErased); diff --git a/src/main/java/de/dhbwstuttgart/typeinference/unify/model/FiniteClosure.java b/src/main/java/de/dhbwstuttgart/typeinference/unify/model/FiniteClosure.java index 038f308e..a48db2aa 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/unify/model/FiniteClosure.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/unify/model/FiniteClosure.java @@ -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;