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

modified:   src/test/java/insertGenerics/FamilyOfGeneratedGenericsTest.java
This commit is contained in:
AluAli 2020-12-29 01:03:55 +01:00
parent a04316f629
commit 2f37bb7313
2 changed files with 22 additions and 23 deletions

View File

@ -76,7 +76,7 @@ public class FamilyOfGeneratedGenerics {
}
}
List<MethodConstraint> methodConstraints5 = methodTypesWithoutClassTypes(cs_cl, cs_m);
// cs_m = methodConstraints5;
cs_m = methodConstraints5;
return cs_m;
}
@ -253,33 +253,32 @@ public class FamilyOfGeneratedGenerics {
*/
public static List<MethodConstraint> methodTypesWithoutClassTypes(List<ClassConstraint> cs_cl, List<MethodConstraint> cs_m) {
//TODO:
/*List<MethodConstraint> tempMCToReturn = new ArrayList<>();
List<TPHConstraint> tempMC = new ArrayList<TPHConstraint>();
for (int i=0; i < cs_m.size(); i++) {
TPHConstraint tphC = (TPHConstraint) cs_m.get(i);
tempMC.add((TPHConstraint) tphC);
}
List<TPHConstraint> tempCC = new ArrayList<TPHConstraint>(cs_cl);
for (TPHConstraint cc: cs_cl) {
TPHConstraint tphC = TPHConstraint.class.cast(cc);
List<TPHConstraint> tempCC = new ArrayList<>();
for(ClassConstraint cc: cs_cl) {
TPHConstraint tphC = new TPHConstraint(cc.getLeft(), cc.getRight(), cc.getRel());
tempCC.add(tphC);
}
List<TPHConstraint> tempMC = new ArrayList<>();
for(MethodConstraint mc: cs_m) {
TPHConstraint tphC = new TPHConstraint(mc.getLeft(), mc.getRight(), mc.getRel());
tempMC.add(tphC);
}
List<TPHConstraint> tempMC2 = new ArrayList<>();
tempMC2.addAll(tempMC);
List<MethodConstraint> tempMCToReturn = new ArrayList<>();
for (TPHConstraint cc: tempCC) {
if(tempMC.contains(cc)) {
tempMC.remove(cc);
for(TPHConstraint cc: tempCC) {
for(TPHConstraint mc: tempMC) {
if(cc.getLeft().equals(mc.getLeft()) && cc.getRight().equals(mc.getRight())) {
tempMC2.remove(mc);
}
}
tempMCToReturn = List.class.cast(tempMC);
return tempMCToReturn;*/
List<MethodConstraint> tempMC = new ArrayList<>();
List<TPHConstraint> tempTphC = new ArrayList<>();
for(int i=0; i<cs_cl.size(); i++) {
TPHConstraint tphC = (TPHConstraint) cs_cl.get(i);
tempTphC.add(tphC);
}
return null;
for(TPHConstraint tphC: tempMC2) {
MethodConstraint mCons = new MethodConstraint(tphC.getLeft(), tphC.getRight(), tphC.getRel());
tempMCToReturn.add(mCons);
}
return tempMCToReturn;
}
public static boolean checkForDuplicates(TPHConstraint constraint, List list) {

View File

@ -175,7 +175,7 @@ public class FamilyOfGeneratedGenericsTest extends TestCase {
assertFalse(classConstraints.isEmpty());
assertTrue(classConstraints.size() == 3);
assertFalse(methodConstraints.isEmpty());
assertTrue(methodConstraints.size()==11);
assertTrue(methodConstraints.size()==9);
}