From 486d7d901187ca02a7bc665f01e6898ec1edf410 Mon Sep 17 00:00:00 2001 From: AluAli Date: Fri, 6 Nov 2020 00:58:04 +0100 Subject: [PATCH] modified: src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java --- .../FamilyOfGeneratedGenerics.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java b/src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java index 57db475ed..fa626c48e 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java @@ -15,16 +15,16 @@ public class FamilyOfGeneratedGenerics { public static List getClassConstraints(List cs, HashMap posOfTphs) { //Inputparameter List constraintsSet weg List cs_cl = new ArrayList<>(); - System.out.println("1: " + cs_cl); + System.out.println("0: " + cs_cl); List classConstraints1 = typeOfANodeOfAField(cs, cs_cl, posOfTphs); cs_cl.addAll(classConstraints1); - System.out.println("2: " + cs_cl); + System.out.println("1: " + cs_cl); List classConstraints2 = transitiveSubtypeForClassTypes(cs, cs_cl); // in Klammer classConstraints1 oder constraintsSet? beides eher cs_cl.addAll(classConstraints2); - System.out.println("3: " + cs_cl); + System.out.println("2: " + cs_cl); List classConstraints3 = hasNoSupertypeForClassTypes(cs, cs_cl, posOfTphs); cs_cl.addAll(classConstraints3); - System.out.println("4: " + cs_cl); + System.out.println("3: " + cs_cl); return cs_cl; } @@ -44,12 +44,11 @@ public class FamilyOfGeneratedGenerics { * {T < .T' | T is a type variable in a type of a node of a field} */ public static List typeOfANodeOfAField(List allConstraints, List cs_cl, HashMap posOfTphs) { - //TODO: List tempCC= new ArrayList<>(); for(TPHConstraint allCons: allConstraints){ if(posOfTphs.containsKey(allCons.getLeft()) && allCons.getRight()!=null && allCons.getRel()==Relation.EXTENDS) { for(String tph: posOfTphs.keySet()) { - if(posOfTphs.get(tph) == PositionFinder.Position.FIELD) { + if(tph == allCons.getLeft() && posOfTphs.get(tph) == PositionFinder.Position.FIELD) { tempCC.add(new ClassConstraint(allCons.getLeft(), allCons.getRight(), allCons.getRel())); } } @@ -87,9 +86,15 @@ public class FamilyOfGeneratedGenerics { List tempCC= new ArrayList<>(); for(TPHConstraint allCons: allConstraints) { for(ClassConstraint cCons: cs_cl) { - if( (posOfTphs.containsKey(allCons.getLeft()) || cCons.getRight() != null) - && allCons.getRight()== null && allCons.getRel()==Relation.EXTENDS && cCons.getRel()==Relation.EXTENDS) { - tempCC.add(new ClassConstraint(allCons.getLeft(), "Object", Relation.EXTENDS)); + for(String tph: posOfTphs.keySet()) { + System.out.println("cCons: " + cCons); + if( (posOfTphs.get(tph) == PositionFinder.Position.FIELD) || + (posOfTphs.containsKey(cCons.getLeft()) && cCons.getRight() != null) && + allCons.getRight() == null && + allCons.getRel()==Relation.EXTENDS && cCons.getRel()==Relation.EXTENDS) { + System.out.println("C3: " + allCons); + tempCC.add(new ClassConstraint(allCons.getLeft(), "Object", Relation.EXTENDS)); + } } } }