From 3cd608a4acf00122afca90edca332afdc327292c Mon Sep 17 00:00:00 2001 From: "pl@gohorb.ba-horb.de" Date: Mon, 15 May 2023 16:56:04 +0200 Subject: [PATCH] modified: src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify.java modified: src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java --- .../typeinference/unify/TypeUnify.java | 2 ++ .../typeinference/unify/TypeUnifyTask.java | 34 +++++++++---------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify.java b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify.java index 46eec8db..3745521b 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify.java @@ -82,6 +82,8 @@ public class TypeUnify { try { logFile.write("\nnoShortendElements: " + unifyTask.noShortendElements +"\n"); logFile.flush(); + unifyTask.statistics.write("Backtracking: " + unifyTask.noBacktracking); + unifyTask.statistics.write("\nLoops: " + unifyTask.noLoop); } catch (IOException e) { System.err.println("no log-File"); diff --git a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java index 9145be97..6703dfa5 100644 --- a/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java +++ b/src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java @@ -258,7 +258,7 @@ public class TypeUnifyTask extends RecursiveTask>> { protected Set> compute() { if (one) { - System.out.println("two"); + //System.out.println("two"); } one = true; Set neweq = new HashSet<>(eq); @@ -659,7 +659,7 @@ public class TypeUnifyTask extends RecursiveTask>> { //a <. theta, theta <. a oder a =. theta enthalten //statistics - writeStatistics("\nNumber of Constraints (" + rekTiefe + "): " + topLevelSets.size()); + //writeStatistics("\nNumber of Constraints (" + rekTiefe + "): " + topLevelSets.size()); Set> oneElems = new HashSet<>(); oneElems.addAll(topLevelSets.stream() @@ -679,7 +679,7 @@ public class TypeUnifyTask extends RecursiveTask>> { //writeLog("nextSet: " + nextSet.toString()); List> nextSetasList =new ArrayList<>(nextSet); - writeStatistics(" Start Number of elements ( " /* + nextSetasList.get(0).stream().findFirst().get().getBasePair()*/ +"): (" + rekTiefe + "): " + nextSetasList.size()); + //writeStatistics(" Start Number of elements ( " /* + nextSetasList.get(0).stream().findFirst().get().getBasePair()*/ +"): (" + rekTiefe + "): " + nextSetasList.size()); /* try { @@ -797,7 +797,7 @@ public class TypeUnifyTask extends RecursiveTask>> { while (nextSetasList.size() > 0) { //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 a_last = a; /* Liste der Faelle für die parallele Verarbeitung @@ -892,7 +892,7 @@ public class TypeUnifyTask extends RecursiveTask>> { Nextvar an Hand Varianzbestimmung auskommentieren Ende */ a = nextSetasList.remove(0); //statisticsList - writeStatistics(a.toString()); + //writeStatistics(a.toString()); if (oderConstraint) {//Methodconstraints werden abgespeichert für die Bytecodegenerierung von Methodenaufrufen methodSignatureConstraint.addAll(((Constraint)a).getmethodSignatureConstraint()); //System.out.println("ERSTELLUNG: " +methodSignatureConstraint); @@ -1213,9 +1213,9 @@ public class TypeUnifyTask extends RecursiveTask>> { }}} //Ab hier alle parallele Berechnungen wieder zusammengeführt. - if (hilf == 1) - System.out.println(); - writeStatistics("Zusammengeführt(" + rekTiefe + "): " + nextSetasList.size()); + //if (hilf == 1) + //System.out.println(); + //writeStatistics("Zusammengeführt(" + rekTiefe + "): " + nextSetasList.size()); if (oderConstraint) {//Wenn weiteres Element nextSetasList genommen wird, muss die vorherige methodsignatur geloescht werden methodSignatureConstraint.removeAll(((Constraint)a).getmethodSignatureConstraint()); //System.out.println("REMOVE: " +methodSignatureConstraint); @@ -1327,7 +1327,7 @@ public class TypeUnifyTask extends RecursiveTask>> { //wenn korrektes Ergebnis gefunden alle Fehlerfaelle loeschen result = par_res; if (!par_res.isEmpty() && par_res.iterator().next() instanceof WildcardType) { - System.out.println(""); + //System.out.println(""); } } else { @@ -1513,7 +1513,7 @@ public class TypeUnifyTask extends RecursiveTask>> { return new Pair<>(su, x.getGroundBasePair());}) .collect(Collectors.toCollection(HashSet::new)); if (res.size() > 1) { - System.out.println(); + //System.out.println(); } /* statistics no erase writeLog("nextSetasList vor filter-Aufruf: " + nextSetasList); @@ -1546,11 +1546,11 @@ public class TypeUnifyTask extends RecursiveTask>> { writeLog("Number of all erased Elements (undef): " + noAllErasedElements.toString()); noBacktracking++; writeLog("Number of Backtracking: " + noBacktracking); - writeStatistics("Number of erased elements: " + (len - nextSetasList.size())); - writeStatistics("Number of Backtracking: " + noBacktracking); - System.out.println(""); + //writeStatistics("Number of erased elements: " + (len - nextSetasList.size())); + //writeStatistics("Number of Backtracking: " + noBacktracking); + //System.out.println(""); } - else writeStatistics("res: " + res.toString()); + else //writeStatistics("res: " + res.toString()); //if (nextSetasList.size() == 0 && isUndefinedPairSetSet(result) && nextSet.size() > 1) { // return result; //} @@ -1559,9 +1559,9 @@ public class TypeUnifyTask extends RecursiveTask>> { //} //else result.stream().filter(y -> !isUndefinedPairSet(y)); writeLog("res: " + res.toString()); - writeStatistics(" End Number of Elements (" + rekTiefe + "): " + nextSetasList.size()); + //writeStatistics(" End Number of Elements (" + rekTiefe + "): " + nextSetasList.size()); noLoop++; - writeStatistics("Number of Loops: " + noLoop); + //writeStatistics("Number of Loops: " + noLoop); } //2020-02-02: if (variance ==2) Hier Aufruf von filterOverriding einfuegen writeLog("Return computeCR: " + result.toString()); @@ -2057,7 +2057,7 @@ public class TypeUnifyTask extends RecursiveTask>> { //System.out.println(pair); if (first) { //writeLog(pair.toString()+"\n"); if (((PlaceholderType)(pair.getLhsType())).getName().equals("AR")) { - System.out.println("AR"); + //System.out.println("AR"); } Set> x1 = unifyCase1(pair, fc); if (pairOp == PairOperator.SMALLERNEQDOT) {