forked from JavaTX/JavaCompilerCore
modified: src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java
modified: src/test/java/insertGenerics/FamilyOfGeneratedGenericsTest.java
This commit is contained in:
parent
e9bcea4b9e
commit
7139a1709e
@ -3,6 +3,7 @@ package de.dhbwstuttgart.bytecode.insertGenerics;
|
|||||||
import de.dhbwstuttgart.bytecode.TPHExtractor;
|
import de.dhbwstuttgart.bytecode.TPHExtractor;
|
||||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
||||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint.Relation;
|
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint.Relation;
|
||||||
|
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericsGeneratorResult;
|
||||||
import de.dhbwstuttgart.bytecode.utilities.MethodAndTPH;
|
import de.dhbwstuttgart.bytecode.utilities.MethodAndTPH;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -14,11 +15,13 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
// HashMap speichert ob TPH in einer Methode oder in der Klasse ist; und wenn es in der Methode ist, in welcher Methode
|
// HashMap speichert ob TPH in einer Methode oder in der Klasse ist; und wenn es in der Methode ist, in welcher Methode
|
||||||
public HashMap<String, PairTphMethod<PositionFinder.Position, String>> posOfTPHs = new HashMap<>();
|
public HashMap<String, PairTphMethod<PositionFinder.Position, String>> posOfTPHs = new HashMap<>();
|
||||||
public List<ClassConstraint> classConstraints = new ArrayList<>();
|
public List<ClassConstraint> classConstraints = new ArrayList<>();
|
||||||
|
public List<MethodConstraint> methodConstraints = new ArrayList<>();
|
||||||
|
|
||||||
public FamilyOfGeneratedGenerics(TPHExtractor tphExtractor) {
|
public FamilyOfGeneratedGenerics(TPHExtractor tphExtractor) {
|
||||||
this.allConstraints = tphExtractor.allCons;
|
this.allConstraints = tphExtractor.allCons;
|
||||||
this.posOfTPHs = positionConverter(tphExtractor.allTPHS, tphExtractor.ListOfMethodsAndTph);
|
this.posOfTPHs = positionConverter(tphExtractor.allTPHS, tphExtractor.ListOfMethodsAndTph);
|
||||||
this.classConstraints = getClassConstraints(allConstraints,posOfTPHs);
|
this.classConstraints = getClassConstraints(allConstraints,posOfTPHs);
|
||||||
|
// this.methodConstraints =
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<ClassConstraint> getClassConstraints(List<TPHConstraint> cs, HashMap<String, PairTphMethod<PositionFinder.Position, String>> posOfTphs) { //Inputparameter List<TPHConstraint> constraintsSet weg
|
public static List<ClassConstraint> getClassConstraints(List<TPHConstraint> cs, HashMap<String, PairTphMethod<PositionFinder.Position, String>> posOfTphs) { //Inputparameter List<TPHConstraint> constraintsSet weg
|
||||||
@ -44,6 +47,11 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
return cs_cl;
|
return cs_cl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<MethodConstraint> getMethodConstraintsAlternative() {
|
||||||
|
List<GenericsGeneratorResult> ggRes = GenericsGeneratorResult.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static List<MethodConstraint> getMethodConstraints(List<TPHConstraint> cs, HashMap<String, PairTphMethod<PositionFinder.Position, String>> posOfTphs) {
|
public static List<MethodConstraint> getMethodConstraints(List<TPHConstraint> cs, HashMap<String, PairTphMethod<PositionFinder.Position, String>> posOfTphs) {
|
||||||
//TODO: Regeln
|
//TODO: Regeln
|
||||||
List<MethodConstraint> cs_m = new ArrayList<>();
|
List<MethodConstraint> cs_m = new ArrayList<>();
|
||||||
@ -166,9 +174,22 @@ 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 static List<MethodConstraint> firstTransitiveSubtypeForMethodTypes() { //transitive closure of cs
|
public static List<MethodConstraint> firstTransitiveSubtypeForMethodTypes(List<TPHConstraint> allConstraints, List<MethodConstraint> cs_m, HashMap<String, PairTphMethod<PositionFinder.Position, String>> posOfTphs) { //transitive closure of cs
|
||||||
//TODO:
|
//TODO:
|
||||||
return null;
|
List<MethodConstraint> tempCC= new ArrayList<>();
|
||||||
|
List<TPHConstraint> tcOfCs = buildTransitiveClosure(allConstraints);
|
||||||
|
for(MethodConstraint mC1 : cs_m) {
|
||||||
|
for(MethodConstraint mC2 : cs_m) {
|
||||||
|
String rightSide = mC1.getRight();
|
||||||
|
String leftSide = mC2.getLeft();
|
||||||
|
for(TPHConstraint tphC : tcOfCs) {
|
||||||
|
if(tphC.getLeft().equals(leftSide)&&tphC.getRight().equals(rightSide)) {
|
||||||
|
tempCC.add((MethodConstraint) tphC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tempCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -176,8 +197,20 @@ 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 static List<MethodConstraint> secondTransitiveSubtypeForMethodTypes() {
|
public static List<MethodConstraint> secondTransitiveSubtypeForMethodTypes(List<TPHConstraint> allConstraints, List<MethodConstraint> cs_m, HashMap<String, PairTphMethod<PositionFinder.Position, String>> posOfTphs) {
|
||||||
//TODO:
|
//TODO:
|
||||||
|
List<MethodConstraint> tempCC= new ArrayList<>();
|
||||||
|
List<TPHConstraint> tcOfCs = buildTransitiveClosure(allConstraints);
|
||||||
|
for(MethodConstraint mC1 : cs_m) {
|
||||||
|
for(MethodConstraint mC2 : cs_m) {
|
||||||
|
String rightSide = mC1.getRight();
|
||||||
|
String leftSide = mC2.getLeft();
|
||||||
|
for(TPHConstraint tphC : tcOfCs) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,4 +199,8 @@ public class FamilyOfGeneratedGenericsTest extends TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void testFirstTransitiveSubtypeForMethodTypes(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user