From 3f5f51df5b95d6e963a06ed4a92098bbb182bbaa Mon Sep 17 00:00:00 2001 From: AluAli Date: Fri, 8 Jan 2021 22:05:09 +0100 Subject: [PATCH] modified: src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java --- .../FamilyOfGeneratedGenerics.java | 46 +++++++++++-------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java index d59ece82..03ea3f41 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java @@ -24,26 +24,7 @@ public class FamilyOfGeneratedGenerics { this.posOfTPHs = positionConverter(tphExtractor.allTPHS, tphExtractor.ListOfMethodsAndTph); this.classConstraints = getClassConstraints(allConstraints,posOfTPHs); this.methodConstraints = getMethodConstraints(allConstraints,classConstraints,posOfTPHs); - for(MethodAndTPH method: tphExtractor.ListOfMethodsAndTph){ - List methodsAddedToHashMap = new ArrayList<>(); - String currentMethod = method.getId(); - boolean containsCurrentMethod = false; - if(!containsCurrentMethod) { - methodsAddedToHashMap.add(currentMethod); - containsCurrentMethod = true; - List listOfThisMethod = new ArrayList<>(); - HashMap> posOfTPHsForThisMethod = new HashMap<>(); - for(String s: posOfTPHs.keySet()) { - if(posOfTPHs.get(s).snd == currentMethod && posOfTPHs.get(s).snd != null) { - posOfTPHsForThisMethod.put(s,posOfTPHs.get(s)); - System.out.println(posOfTPHsForThisMethod); - } - } - listOfThisMethod = getMethodConstraints(allConstraints,classConstraints,posOfTPHsForThisMethod); - methodConstraintsWithPosition.put(currentMethod, listOfThisMethod); - System.out.println(methodConstraintsWithPosition); - } - } + this.methodConstraintsWithPosition = getMethodConstraintsWithPosition(allConstraints,classConstraints,posOfTPHs, tphExtractor.ListOfMethodsAndTph); } public static List getClassConstraints(List cs, HashMap> posOfTphs) { //Inputparameter List constraintsSet weg @@ -101,6 +82,31 @@ public class FamilyOfGeneratedGenerics { return cs_m; } + public static HashMap> getMethodConstraintsWithPosition(List cs, List cs_cl, HashMap> posOfTphs, List listOfMethodsAndTph) { + HashMap> tempMethodConstraintsWithPosition = new HashMap<>(); + for(MethodAndTPH method: listOfMethodsAndTph){ + List methodsAddedToHashMap = new ArrayList<>(); + String currentMethod = method.getId(); + boolean containsCurrentMethod = false; + if(!containsCurrentMethod) { + methodsAddedToHashMap.add(currentMethod); + containsCurrentMethod = true; + List listOfThisMethod = new ArrayList<>(); + HashMap> posOfTPHsForThisMethod = new HashMap<>(); + for(String s: posOfTphs.keySet()) { + if(posOfTphs.get(s).snd == currentMethod && posOfTphs.get(s).snd != null) { + posOfTPHsForThisMethod.put(s,posOfTphs.get(s)); + System.out.println(posOfTPHsForThisMethod); + } + } + listOfThisMethod = getMethodConstraints(cs,cs_cl,posOfTPHsForThisMethod); + tempMethodConstraintsWithPosition.put(currentMethod, listOfThisMethod); + System.out.println(tempMethodConstraintsWithPosition); + } + } + return tempMethodConstraintsWithPosition; + } + /** * Def. FGG: erste Zeile von cs_cl * {T < .T' | T is a type variable in a type of a node of a field}