forked from JavaTX/JavaCompilerCore
modified: src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/ClassConstraint.java
modified: src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java
This commit is contained in:
parent
7cf46b02b7
commit
e617a0911a
@ -3,7 +3,7 @@ package de.dhbwstuttgart.bytecode.gGenericsAli;
|
|||||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
||||||
|
|
||||||
public class ClassConstraint extends TPHConstraint {
|
public class ClassConstraint extends TPHConstraint {
|
||||||
private TPHConstraint constraint;
|
//private TPHConstraint constraint;
|
||||||
|
|
||||||
public ClassConstraint(String left, String right, Relation rel) {
|
public ClassConstraint(String left, String right, Relation rel) {
|
||||||
super(left, right, rel);
|
super(left, right, rel);
|
||||||
|
@ -15,17 +15,24 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
|
|
||||||
public static List<ClassConstraint> getClassConstraints(List<TPHConstraint> cs, HashMap<String, PositionFinder.Position> posOfTphs) { //Inputparameter List<TPHConstraint> constraintsSet weg
|
public static List<ClassConstraint> getClassConstraints(List<TPHConstraint> cs, HashMap<String, PositionFinder.Position> posOfTphs) { //Inputparameter List<TPHConstraint> constraintsSet weg
|
||||||
List<ClassConstraint> cs_cl = new ArrayList<>();
|
List<ClassConstraint> cs_cl = new ArrayList<>();
|
||||||
System.out.println("0: " + cs_cl);
|
|
||||||
List<ClassConstraint> classConstraints1 = typeOfANodeOfAField(cs, cs_cl, posOfTphs);
|
List<ClassConstraint> classConstraints1 = typeOfANodeOfAField(cs, cs_cl, posOfTphs);
|
||||||
cs_cl.addAll(classConstraints1);
|
for (ClassConstraint cons: classConstraints1) {
|
||||||
System.out.println("1: " + cs_cl);
|
if (!checkForDuplicates(cons, cs_cl)) {
|
||||||
|
cs_cl.add(cons);
|
||||||
|
}
|
||||||
|
}
|
||||||
List<ClassConstraint> classConstraints2 = transitiveSubtypeForClassTypes(cs, cs_cl); // in Klammer classConstraints1 oder constraintsSet? beides eher
|
List<ClassConstraint> classConstraints2 = transitiveSubtypeForClassTypes(cs, cs_cl); // in Klammer classConstraints1 oder constraintsSet? beides eher
|
||||||
cs_cl.addAll(classConstraints2);
|
for (ClassConstraint cons: classConstraints2) {
|
||||||
System.out.println("2: " + cs_cl);
|
if (!checkForDuplicates(cons, cs_cl)) {
|
||||||
|
cs_cl.add(cons);
|
||||||
|
}
|
||||||
|
}
|
||||||
List<ClassConstraint> classConstraints3 = hasNoSupertypeForClassTypes(cs, cs_cl, posOfTphs);
|
List<ClassConstraint> classConstraints3 = hasNoSupertypeForClassTypes(cs, cs_cl, posOfTphs);
|
||||||
cs_cl.addAll(classConstraints3);
|
for (ClassConstraint cons: classConstraints3) {
|
||||||
System.out.println("3: " + cs_cl);
|
if (!checkForDuplicates(cons, cs_cl)) {
|
||||||
|
cs_cl.add(cons);
|
||||||
|
}
|
||||||
|
}
|
||||||
return cs_cl;
|
return cs_cl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +56,10 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
if(posOfTphs.containsKey(allCons.getLeft()) && allCons.getRight()!=null && allCons.getRel()==Relation.EXTENDS) {
|
if(posOfTphs.containsKey(allCons.getLeft()) && allCons.getRight()!=null && allCons.getRel()==Relation.EXTENDS) {
|
||||||
for(String tph: posOfTphs.keySet()) {
|
for(String tph: posOfTphs.keySet()) {
|
||||||
if(tph == allCons.getLeft() && 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()));
|
ClassConstraint consToAdd = new ClassConstraint(allCons.getLeft(), allCons.getRight(), allCons.getRel());
|
||||||
|
if (!checkForDuplicates(consToAdd, tempCC)) {
|
||||||
|
tempCC.add(consToAdd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,7 +78,10 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
if(cCons.getLeft() != null && cCons.getRel()==Relation.EXTENDS) {
|
if(cCons.getLeft() != null && cCons.getRel()==Relation.EXTENDS) {
|
||||||
for(TPHConstraint allCons: allConstraints) {
|
for(TPHConstraint allCons: allConstraints) {
|
||||||
if(cCons.getRight() == allCons.getLeft() && allCons.getRight() != null && allCons.getRel()==Relation.EXTENDS){
|
if(cCons.getRight() == allCons.getLeft() && allCons.getRight() != null && allCons.getRel()==Relation.EXTENDS){
|
||||||
tempCC.add(new ClassConstraint(allCons.getLeft(), allCons.getRight(), allCons.getRel()));
|
ClassConstraint consToAdd = new ClassConstraint(allCons.getLeft(), allCons.getRight(), allCons.getRel());
|
||||||
|
if (!checkForDuplicates(consToAdd, tempCC)) {
|
||||||
|
tempCC.add(consToAdd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -92,7 +105,6 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
(allCons.getLeft() == tph && 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) {
|
cCons.getRight() == tph && allCons.getLeft() == tph) {
|
||||||
System.out.println("C3: " + allCons);
|
|
||||||
ClassConstraint consToAdd = new ClassConstraint(cCons.getRight(), "Object", Relation.EXTENDS);
|
ClassConstraint consToAdd = new ClassConstraint(cCons.getRight(), "Object", Relation.EXTENDS);
|
||||||
if (!checkForDuplicates(consToAdd, tempCC)){
|
if (!checkForDuplicates(consToAdd, tempCC)){
|
||||||
tempCC.add(consToAdd);
|
tempCC.add(consToAdd);
|
||||||
|
Loading…
Reference in New Issue
Block a user