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}