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

This commit is contained in:
AluAli 2020-11-06 00:58:04 +01:00
parent 8402d18f83
commit 486d7d9011

View File

@ -15,16 +15,16 @@ public class FamilyOfGeneratedGenerics {
public static List<ClassConstraint> getClassConstraints(List<TPHConstraint> cs, HashMap<String, PositionFinder.Position> posOfTphs) { //Inputparameter List<TPHConstraint> constraintsSet weg
List<ClassConstraint> cs_cl = new ArrayList<>();
System.out.println("1: " + cs_cl);
System.out.println("0: " + cs_cl);
List<ClassConstraint> classConstraints1 = typeOfANodeOfAField(cs, cs_cl, posOfTphs);
cs_cl.addAll(classConstraints1);
System.out.println("2: " + cs_cl);
System.out.println("1: " + cs_cl);
List<ClassConstraint> 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<ClassConstraint> 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<ClassConstraint> typeOfANodeOfAField(List<TPHConstraint> allConstraints, List<ClassConstraint> cs_cl, HashMap<String, PositionFinder.Position> posOfTphs) {
//TODO:
List<ClassConstraint> 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,12 +86,18 @@ public class FamilyOfGeneratedGenerics {
List<ClassConstraint> 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) {
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));
}
}
}
}
return tempCC;
}
/*