modified: src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java
This commit is contained in:
parent
af9943be28
commit
55ee8ab61a
@ -35,7 +35,7 @@ public class FamilyOfGeneratedGenerics {
|
||||
this.posOfTPHs = positionConverter(tphExtractor.allTPHS, tphExtractor.ListOfMethodsAndTph);
|
||||
this.classConstraints = getClassConstraints(allConstraints,posOfTPHs);
|
||||
this.methodConstraints = getMethodConstraints(allConstraints,classConstraints,posOfTPHs, tphExtractor.ListOfMethodsAndTph);
|
||||
this.methodConstraintsWithPosition = getMethodConstraintsWithPosition(allConstraints,classConstraints,posOfTPHs, tphExtractor.ListOfMethodsAndTph, resSet, oldCons);
|
||||
this.methodConstraintsWithPosition = getMethodConstraintsWithPositionNew(allConstraints,classConstraints,posOfTPHs, tphExtractor.ListOfMethodsAndTph, resSet, oldCons);
|
||||
}
|
||||
|
||||
public static List<ClassConstraint> getClassConstraints(List<TPHConstraint> cs, HashMap<String, List<PairTphMethod<PositionFinder.Position, String>>> posOfTphs) { //Inputparameter List<TPHConstraint> constraintsSet weg
|
||||
@ -137,6 +137,8 @@ public class FamilyOfGeneratedGenerics {
|
||||
|
||||
List<MethodConstraint> newMCList = firstLineMethodDefinition(cs, posOfTphs, method, resSet);
|
||||
List<MethodConstraint> newMCList2 = secondLineMethodDefinition(cs, posOfTphs, method, resSet, oldCons);
|
||||
System.out.println(newMCList);
|
||||
System.out.println(newMCList2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -561,5 +563,47 @@ public class FamilyOfGeneratedGenerics {
|
||||
return tempMC;
|
||||
}
|
||||
|
||||
public static HashMap<String, List<MethodConstraint>> getMethodConstraintsWithPositionNew(List<TPHConstraint> cs, List<ClassConstraint> cs_cl, HashMap<String, List<PairTphMethod<PositionFinder.Position, String>>> posOfTphs, List<MethodAndTPH> listOfMethodsAndTph, ResultSet resSet, Set<Pair> oldCons) {
|
||||
HashMap<String, List<MethodConstraint>> tempMethodConstraintsWithPosition = new HashMap<>();
|
||||
List<MethodConstraint> newMCList = new ArrayList<>();
|
||||
List<MethodConstraint> newMCList2 = new ArrayList<>();
|
||||
List<String> methodsAddedToHashMap = new ArrayList<>();
|
||||
for(MethodAndTPH method: listOfMethodsAndTph){
|
||||
String currentMethod = method.getId();
|
||||
boolean containsCurrentMethod = false;
|
||||
if(!containsCurrentMethod) {
|
||||
methodsAddedToHashMap.add(currentMethod);
|
||||
containsCurrentMethod = true;
|
||||
List<MethodConstraint> listToAdd = new ArrayList<>();
|
||||
HashMap<String, List<PairTphMethod<PositionFinder.Position, String>>> posOfTPHsForThisMethod = new HashMap<>();
|
||||
for(String s: posOfTphs.keySet()) {
|
||||
for(PairTphMethod pair: posOfTphs.get(s)) {
|
||||
if(pair.snd == currentMethod && pair.snd != null) {
|
||||
posOfTPHsForThisMethod.put(s,posOfTphs.get(s));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
newMCList = firstLineMethodDefinition(cs, posOfTphs, method, resSet);
|
||||
for(int i=0; i<newMCList.size(); i++) {
|
||||
listToAdd.add(newMCList.get(i));
|
||||
}
|
||||
newMCList2 = secondLineMethodDefinition(cs, posOfTphs, method, resSet, oldCons);
|
||||
for(int i=0; i<newMCList2.size(); i++) {
|
||||
listToAdd.add(newMCList2.get(i));
|
||||
}
|
||||
|
||||
/*if(!methodsAddedToHashMap.contains(currentMethod)) {
|
||||
tempMethodConstraintsWithPosition.put(currentMethod, newMCList);
|
||||
tempMethodConstraintsWithPosition.put(currentMethod, newMCList2);
|
||||
}*/
|
||||
|
||||
tempMethodConstraintsWithPosition.put(currentMethod, listToAdd);
|
||||
}
|
||||
}
|
||||
|
||||
return tempMethodConstraintsWithPosition;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user