From b99c022b5048a84283cae50620b70dd775ba714e Mon Sep 17 00:00:00 2001 From: AluAli Date: Fri, 5 Mar 2021 09:12:19 +0100 Subject: [PATCH] modified: src/main/java/de/dhbwstuttgart/bytecode/TPHExtractor.java modified: src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java --- .../dhbwstuttgart/bytecode/TPHExtractor.java | 1 + .../FamilyOfGeneratedGenerics.java | 41 +++++++++++-------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/bytecode/TPHExtractor.java b/src/main/java/de/dhbwstuttgart/bytecode/TPHExtractor.java index b908afa6..2923da74 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/TPHExtractor.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/TPHExtractor.java @@ -55,6 +55,7 @@ public class TPHExtractor extends AbstractASTWalker { boolean inLocalOrParamOrReturn = false; public final ArrayList ListOfMethodsAndTph = new ArrayList<>(); + public Set oldConstraints = new HashSet<>(); // Alle Constraints in einer Menge (und- & Oder-Constraints) final ArrayList> allPairs = new ArrayList<>(); public final ArrayList allCons = new ArrayList<>(); private ResultSet resultSet; diff --git a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java index 544d43be..6b3cd99b 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java @@ -136,7 +136,7 @@ public class FamilyOfGeneratedGenerics { listOfThisMethod = getMethodConstraints(cs,cs_cl,posOfTPHsForThisMethod,listOfMethodsAndTph); tempMethodConstraintsWithPosition.put(currentMethod, listOfThisMethod); - List newMCList = firstLineMethodDefinition(cs, posOfTphs, resSet); + List newMCList = firstLineMethodDefinition(cs, posOfTphs, method, resSet); } } @@ -477,29 +477,36 @@ public class FamilyOfGeneratedGenerics { } */ - public static List firstLineMethodDefinition(List allConstraints, HashMap>> posOfTphs, ResultSet resSet) { + public static List firstLineMethodDefinition(List allConstraints, HashMap>> posOfTphs, MethodAndTPH methodAndTPH, ResultSet resSet) { List tempMC= new ArrayList<>(); -// MethodAndTPH methAndTphs = methodAndTPH; -// Set undCons = methAndTphs.constraints.getUndConstraints(); -// Iterator it = undCons.iterator(); + MethodAndTPH methAndTphs = methodAndTPH; + Set undCons = methAndTphs.constraints.getUndConstraints(); + List> orCons = methAndTphs.constraints.getOderConstraints(); + Iterator it = undCons.iterator(); + while(it.hasNext()) { + Pair p = it.next(); + String ta1 = ((TypePlaceholder) p.TA1).getName(); + String ta2 = ((TypePlaceholder) p.TA2).getName(); + + System.out.println(p); + + } + +// Set res = resSet.results; +// Iterator it = res.iterator(); +// System.out.println("res: " + res.size() + res); +// System.out.println("booooooooo"); // while(it.hasNext()) { // System.out.println(it.next()); // } - Set res = resSet.results; - Iterator it = res.iterator(); - System.out.println("res: " + res.size() + res); - System.out.println("booooooooo"); - while(it.hasNext()) { - System.out.println(it.next()); - } - System.out.println("booooooooo2"); +// System.out.println("booooooooo2"); // for(TPHConstraint tphC: allConstraints) { // } - Predicate filterUndConstraints = ab -> resSet.resolveType((TypePlaceholder)(ab.TA1)).resolvedType instanceof TypePlaceholder; - System.out.println(filterUndConstraints); - Predicate the = x -> resSet.resolveType((TypePlaceholder)(x.TA1)).resolvedType instanceof TypePlaceholder; - ResultPair rp = y -> resSet.resolveType((TypePlaceholder)(y.TA1)).getResultPair(); +// Predicate filterUndConstraints = ab -> resSet.resolveType((TypePlaceholder)(ab.TA1)).resolvedType instanceof TypePlaceholder; +// System.out.println(filterUndConstraints); +// Predicate the = x -> resSet.resolveType((TypePlaceholder)(x.TA1)).resolvedType instanceof TypePlaceholder; +// ResultPair rp = y -> resSet.resolveType((TypePlaceholder)(y.TA1)).getResultPair(); // (resultSet.resolveType((TypePlaceholder)(cs.TA1)).resolvedType instanceof TypePlaceholder)