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

This commit is contained in:
AluAli 2020-11-06 11:24:21 +01:00
parent 486d7d9011
commit 7cf46b02b7

View File

@ -87,13 +87,16 @@ public class FamilyOfGeneratedGenerics {
for(TPHConstraint allCons: allConstraints) { for(TPHConstraint allCons: allConstraints) {
for(ClassConstraint cCons: cs_cl) { for(ClassConstraint cCons: cs_cl) {
for(String tph: posOfTphs.keySet()) { for(String tph: posOfTphs.keySet()) {
System.out.println("cCons: " + cCons);
if( (posOfTphs.get(tph) == PositionFinder.Position.FIELD) || if( (posOfTphs.get(tph) == PositionFinder.Position.FIELD) ||
(posOfTphs.containsKey(cCons.getLeft()) && cCons.getRight() != null) && (posOfTphs.containsKey(cCons.getRight()) && cCons.getLeft() != null) &&
allCons.getRight() == null && (allCons.getLeft() == tph && allCons.getRight() == null) &&
allCons.getRel()==Relation.EXTENDS && cCons.getRel()==Relation.EXTENDS) { allCons.getRel()==Relation.EXTENDS && cCons.getRel()==Relation.EXTENDS &&
cCons.getRight() == tph && allCons.getLeft() == tph) {
System.out.println("C3: " + allCons); System.out.println("C3: " + allCons);
tempCC.add(new ClassConstraint(allCons.getLeft(), "Object", Relation.EXTENDS)); ClassConstraint consToAdd = new ClassConstraint(cCons.getRight(), "Object", Relation.EXTENDS);
if (!checkForDuplicates(consToAdd, tempCC)){
tempCC.add(consToAdd);
}
} }
} }
} }
@ -109,7 +112,7 @@ public class FamilyOfGeneratedGenerics {
* {T < .T' | T is a type variable in a type of the method/constructor m in cl_\sigma, (T <. T') \in cs} * {T < .T' | T is a type variable in a type of the method/constructor m in cl_\sigma, (T <. T') \in cs}
*//* *//*
public List<MethodConstraint> typeOfTheMethodInClSigma() { // cl_\sigma?? public static List<MethodConstraint> typeOfTheMethodInClSigma() { // cl_\sigma??
//TODO: //TODO:
return cs_m; return cs_m;
} }
@ -120,7 +123,7 @@ public class FamilyOfGeneratedGenerics {
* {R' <. S | (R <. R'), (S <. S') \in cs_m and (R',S) is in the transitive closure of cs} * {R' <. S | (R <. R'), (S <. S') \in cs_m and (R',S) is in the transitive closure of cs}
*//* *//*
public List<MethodConstraint> firstTransitiveSubtypeForMethodTypes() { //transitive closure of cs public static List<MethodConstraint> firstTransitiveSubtypeForMethodTypes() { //transitive closure of cs
//TODO: //TODO:
return cs_m; return cs_m;
} }
@ -131,7 +134,7 @@ public class FamilyOfGeneratedGenerics {
* {R' <. S | (R <. R') \in cs_m, (S <. S') \in cs_cl and (R',S) is in the transitive closure of cs} * {R' <. S | (R <. R') \in cs_m, (S <. S') \in cs_cl and (R',S) is in the transitive closure of cs}
*//* *//*
public List<MethodConstraint> secondTransitiveSubtypeForMethodTypes() { public static List<MethodConstraint> secondTransitiveSubtypeForMethodTypes() {
//TODO: //TODO:
return cs_m; return cs_m;
} }
@ -143,7 +146,7 @@ public class FamilyOfGeneratedGenerics {
* (\existsnot T': T <. T') \in cs)} * (\existsnot T': T <. T') \in cs)}
*//* *//*
public List<MethodConstraint> hasNoSupertypeForMethodTypes() { public static List<MethodConstraint> hasNoSupertypeForMethodTypes() {
//TODO: //TODO:
return cs_m; return cs_m;
} }
@ -151,14 +154,24 @@ public class FamilyOfGeneratedGenerics {
*/ */
/** /**
* nimm die Menge cs_cl aus cs_m raus * nimm die Menge cs_cl aus cs_m raus
*//* */
/*
public List<MethodConstraint> methodTypesWithoutClassTypes() { public static List<MethodConstraint> methodTypesWithoutClassTypes() {
//TODO: //TODO:
return cs_m; return cs_m;
} }
*/ */
public static boolean checkForDuplicates(TPHConstraint constraint, List list) {
List<TPHConstraint> tempList = list;
for (TPHConstraint tphC: tempList) {
return (constraint.getLeft() == tphC.getLeft() &&
constraint.getRight() == tphC.getRight() &&
constraint.getRel() == tphC.getRel()); //constraint already in ArrayList if true
}
return false;
}