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

This commit is contained in:
AluAli 2021-03-12 18:35:29 +01:00
parent f69554c6a1
commit bb5692da8e

View File

@ -578,9 +578,9 @@ public class FamilyOfGeneratedGenerics {
while (itRunSet.hasNext()) {
Pair pairRunSet = itRunSet.next();
// if(cons.getRight() == cons2.getLeft()) {
if(pairIterSet.TA2 == pairRunSet.TA1) {
if(pairIterSet.TA2 == pairRunSet.TA1 && pairIterSet.OperatorSmallerDot() && pairRunSet.OperatorSmallerDot()) {
// TPHConstraint consToAdd = new TPHConstraint(cons.getLeft(), cons2.getRight(), Relation.EXTENDS);
Pair p = new Pair(pairIterSet.TA1, pairRunSet.TA2);
Pair p = new Pair(pairIterSet.TA1, pairRunSet.TA2, PairOperator.SMALLERDOT);
// if (!checkForDuplicates(consToAdd,tcList)) {
if(!tcSet.contains(p)) {
// tcList.add(consToAdd);
@ -593,9 +593,29 @@ public class FamilyOfGeneratedGenerics {
}
}
}
System.out.println("tcSet: " + tcSet);
return tcSet;
}
public static boolean checkForDuplicatesForSets(Pair pair, Set set) {
Set<Pair> tempSet = set;
boolean hasSame = false;
// for (TPHConstraint tphC: tempList) {
Iterator<Pair> it = set.iterator();
while (it.hasNext()) {
Pair p = it.next();
// hasSame = constraint.getLeft() == tphC.getLeft() &&
// constraint.getRight() == tphC.getRight() &&
// constraint.getRel() == tphC.getRel(); //constraint already in ArrayList if true
hasSame = pair.TA1 == pair.TA1 &&
pair.TA2 == p.TA2 &&
pair.OperatorSmallerDot() && p.OperatorSmallerDot(); //constraint already in Set if true
if (hasSame)
return true;
}
return false;
}
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<>();