modified: src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java

This commit is contained in:
AluAli 2021-01-08 22:05:09 +01:00
parent dce7ac8262
commit 3f5f51df5b

View File

@ -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<String> methodsAddedToHashMap = new ArrayList<>();
String currentMethod = method.getId();
boolean containsCurrentMethod = false;
if(!containsCurrentMethod) {
methodsAddedToHashMap.add(currentMethod);
containsCurrentMethod = true;
List<MethodConstraint> listOfThisMethod = new ArrayList<>();
HashMap<String, PairTphMethod<PositionFinder.Position, String>> 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<ClassConstraint> getClassConstraints(List<TPHConstraint> cs, HashMap<String, PairTphMethod<PositionFinder.Position, String>> posOfTphs) { //Inputparameter List<TPHConstraint> constraintsSet weg
@ -101,6 +82,31 @@ public class FamilyOfGeneratedGenerics {
return cs_m;
}
public static HashMap<String, List<MethodConstraint>> getMethodConstraintsWithPosition(List<TPHConstraint> cs, List<ClassConstraint> cs_cl, HashMap<String, PairTphMethod<PositionFinder.Position, String>> posOfTphs, List<MethodAndTPH> listOfMethodsAndTph) {
HashMap<String, List<MethodConstraint>> tempMethodConstraintsWithPosition = new HashMap<>();
for(MethodAndTPH method: listOfMethodsAndTph){
List<String> methodsAddedToHashMap = new ArrayList<>();
String currentMethod = method.getId();
boolean containsCurrentMethod = false;
if(!containsCurrentMethod) {
methodsAddedToHashMap.add(currentMethod);
containsCurrentMethod = true;
List<MethodConstraint> listOfThisMethod = new ArrayList<>();
HashMap<String, PairTphMethod<PositionFinder.Position, String>> 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}