diff --git a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java index 39f1b3cc4..1d3921dc4 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java @@ -519,6 +519,7 @@ public class FamilyOfGeneratedGenerics { List>> orCons = methAndTphs.constraints.getOderConstraints(); List>> orConsList = new ArrayList<>(); List>> orConsListConverted = new ArrayList<>(); + //gehe die OrConstraints der aktuellen Methode durch und teile nach Operator auf ( for(int i=0; i> orConsInternal = new HashMap<>(); List orConsWithEQUAL = new ArrayList(); @@ -550,6 +551,8 @@ public class FamilyOfGeneratedGenerics { orConsListConverted.add(orConsInternal); } + // oldCons sind alle Und- und Oder-Constraints + // zunächst in meine Datenstruktur(Ali) konvertieren List oldConsList = new ArrayList<>(oldCons); List oldConsListConverted = new ArrayList<>(); for(Pair pair: oldConsList) { @@ -561,10 +564,8 @@ public class FamilyOfGeneratedGenerics { } oldConsListConverted.add(new TPHConstraint(((TypePlaceholder) pair.TA1).getName(), ((TypePlaceholder) pair.TA2).getName(), r)); } -// List tcOfoldCons = buildTransitiveClosure(oldConsListConverted); -// Set tcOfoldConsSet = buildTransitiveClosureForCP(oldCons); -// for(int i=0; i extendsSet = new Constraint(); Constraint equalSet = new Constraint(); @@ -572,31 +573,23 @@ public class FamilyOfGeneratedGenerics { Iterator it = con.iterator(); while (it.hasNext()) { Pair p = it.next(); -// List extendsList = orConsListConverted.get(i).get(Relation.EXTENDS); -// List equalList = orConsListConverted.get(i).get(Relation.EQUAL); if (p.OperatorSmallerDot()) { extendsSet.add(p); } else if (p.OperatorEqual()) { equalSet.add(p); } } -// for (TPHConstraint ex : extendsList) { Iterator itExtends = extendsSet.iterator(); while(itExtends.hasNext()) { Pair pairExtends = itExtends.next(); -// for (TPHConstraint eq : equalList) { Iterator itEqual = equalSet.iterator(); while(itEqual.hasNext()) { Pair pairEqual = itEqual.next(); -// MethodConstraint mc = new MethodConstraint(ex.getRight(), eq.getLeft(), Relation.EXTENDS); Pair newPair = new Pair(resSet.resolveType((TypePlaceholder)(pairExtends.TA2)).resolvedType, resSet.resolveType((TypePlaceholder)(pairEqual.TA1)).resolvedType, PairOperator.SMALLERDOT); -// for (TPHConstraint tc : tcOfoldCons) { Iterator itTC = tcOfoldConsSet.iterator(); while(itTC.hasNext()) { Pair pairTC = itTC.next(); -// if (tc.getLeft() == mc.getLeft() && tc.getRight() == mc.getRight() && tc.getRel() == mc.getRel()) { if(resSet.resolveType((TypePlaceholder)(pairTC.TA1)).resolvedType == newPair.TA1 && resSet.resolveType((TypePlaceholder)(pairTC.TA2)).resolvedType == newPair.TA2 && pairTC.OperatorSmallerDot() && newPair.OperatorSmallerDot()) { //hier bei pairTC resolvedType, damit Pairs aus oldCons in der Methode zur Berechnung von der transitiven Hülle nicht in eine Endlosschleife kommen (Cycles!) -// if (!checkForDuplicates(mc, tempMC)) { if(newPair.TA1 != newPair.TA2) { if (!checkForDuplicatesForSets(newPair, tempSet)) { tempSet.add(newPair); @@ -609,6 +602,7 @@ public class FamilyOfGeneratedGenerics { } } + // aus der alten Datenstruktur in die neue Datenstruktur (von Ali) Iterator itTemp = tempSet.iterator(); while(itTemp.hasNext()) { Pair p = itTemp.next();