From bb5692da8eb13d7d8a667dd91ba144b5f75682cf Mon Sep 17 00:00:00 2001 From: AluAli Date: Fri, 12 Mar 2021 18:35:29 +0100 Subject: [PATCH] modified: src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java --- .../FamilyOfGeneratedGenerics.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java index ca6940be..c1b44353 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java @@ -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 tempSet = set; + boolean hasSame = false; +// for (TPHConstraint tphC: tempList) { + Iterator 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> getMethodConstraintsWithPositionNew(List cs, List cs_cl, HashMap>> posOfTphs, List listOfMethodsAndTph, ResultSet resSet, Set oldCons) { HashMap> tempMethodConstraintsWithPosition = new HashMap<>(); List newMCList = new ArrayList<>();