modified: src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java
modified: src/test/java/insertGenerics/TestTwoArgs.java
This commit is contained in:
parent
bf8d4fe647
commit
d1ad6e218a
@ -513,8 +513,8 @@ public class FamilyOfGeneratedGenerics {
|
||||
|
||||
public static List<MethodConstraint> secondLineMethodDefinition(List<TPHConstraint> allConstraints, HashMap<String, List<PairTphMethod<PositionFinder.Position, String>>> posOfTphs, MethodAndTPH methodAndTPH, ResultSet resSet, Set<Pair> oldCons) {
|
||||
List<MethodConstraint> tempMC = new ArrayList<>(); //für Ergebnisse basierend auf der neuen Datenstruktur (Ali)
|
||||
Set<Pair> tempSet = new HashSet<>(); //für Ergebnisse des ersten Teils basierend auf der alten Datenstruktur
|
||||
Set<Pair> tempSet2 = new HashSet<>(); //für Ergebnisse des zweiten Teils basierend auf der alten Datenstruktur
|
||||
Set<Pair> tempSet = new HashSet<>(); //für Ergebnisse des ersten Teils der Bedinung basierend auf der alten Datenstruktur
|
||||
Set<Pair> tempSet2 = new HashSet<>(); //für Ergebnisse des zweiten Teils der Bedingung basierend auf der alten Datenstruktur
|
||||
Set<Pair> tcOfoldConsSet = buildTransitiveClosureForCP(oldCons, resSet);
|
||||
List<TPHConstraint> tcOfCs = buildTransitiveClosure(allConstraints);
|
||||
MethodAndTPH methAndTphs = methodAndTPH;
|
||||
@ -572,7 +572,7 @@ public class FamilyOfGeneratedGenerics {
|
||||
// Constraint<Pair> extendsSetAllOfOr = new Constraint<Pair>();
|
||||
// Constraint<Pair> equalSetAllOfOr = new Constraint<Pair>();
|
||||
|
||||
// Berechnung des ersten Teils der Regel
|
||||
// Berechnung des ersten Teils der Bedingung der Regel
|
||||
for(int i=0; i<orCons.size(); i++) {
|
||||
Constraint<Pair> extendsSet = new Constraint<Pair>();
|
||||
Constraint<Pair> equalSet = new Constraint<Pair>();
|
||||
@ -597,15 +597,18 @@ public class FamilyOfGeneratedGenerics {
|
||||
while(itEqual.hasNext()) {
|
||||
Pair pairEqual = itEqual.next();
|
||||
// tphR = (TypePlaceholder) (pairEqual.TA2);
|
||||
//newPair entspricht \sigma(T'_0) < \sigma(R_0)
|
||||
//TODO: Überprüfen: newPair und tras clos ohne resolvedType
|
||||
Pair newPair = new Pair(resSet.resolveType((TypePlaceholder)(pairExtends.TA2)).resolvedType,
|
||||
resSet.resolveType((TypePlaceholder)(pairEqual.TA1)).resolvedType, PairOperator.SMALLERDOT);
|
||||
Iterator<Pair> itTC = tcOfoldConsSet.iterator();
|
||||
while(itTC.hasNext()) {
|
||||
while(itTC.hasNext()) {//ueberpruefen ob newPair in transitiv closure
|
||||
Pair pairTC = itTC.next();
|
||||
if(resSet.resolveType((TypePlaceholder)(pairTC.TA1)).resolvedType == newPair.TA1 && resSet.resolveType((TypePlaceholder)(pairTC.TA2)).resolvedType == newPair.TA2 && pairTC.OperatorSmallerDot() && newPair.OperatorSmallerDot()) { //erst hier bei pairTC resolvedType, damit Pairs aus oldCons in der Methode zur Berechnung von der transitiven Hülle nicht in eine Endlosschleife kommen (Cycles!)
|
||||
if(newPair.TA1 != newPair.TA2) { //eliminieren der Fälle wie AA<.AA
|
||||
if (!checkForDuplicatesForSets(newPair, tempSet)) {
|
||||
tempSet.add(newPair);
|
||||
//TODO: evtl. pairExtends hinzufuegen
|
||||
tempSet.add(newPair);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -637,7 +640,7 @@ public class FamilyOfGeneratedGenerics {
|
||||
|
||||
}
|
||||
|
||||
// Berechnung des zweiten Teils der Regel
|
||||
// Berechnung des zweiten Teils der Bedingung der Regel
|
||||
for(int i=0; i<orCons.size(); i++) {
|
||||
Constraint<Pair> extendsSet = new Constraint<Pair>();
|
||||
Constraint<Pair> equalSet = new Constraint<Pair>();
|
||||
@ -658,6 +661,7 @@ public class FamilyOfGeneratedGenerics {
|
||||
Iterator<Pair> itEqual2 = equalSet.iterator();
|
||||
while (itEqual2.hasNext()) {
|
||||
Pair pairEqual2 = itEqual2.next();
|
||||
//TODO: Auf trans.FamilyOfGeneratedGenerics Huelle pruefen
|
||||
Pair newPair2 = new Pair(resSet.resolveType((TypePlaceholder) (pairExtends2.TA2)).resolvedType, resSet.resolveType((TypePlaceholder) (pairEqual2.TA1)).resolvedType, PairOperator.SMALLERDOT);
|
||||
TypePlaceholder tphR = (TypePlaceholder) pairEqual2.TA2;
|
||||
Iterator<Pair> itUndCons = undCons.iterator();
|
||||
@ -731,7 +735,7 @@ public class FamilyOfGeneratedGenerics {
|
||||
} else if (p.GetOperator() == PairOperator.EQUALSDOT) {
|
||||
r = Relation.EQUAL;
|
||||
}
|
||||
for(TPHConstraint tphCons: tcOfCs) {
|
||||
for(TPHConstraint tphCons: tcOfCs) {//TODO: hier werden Elemente der Trans. clo herausgenommen, aber die dazugehoerigen OrCons nicht.
|
||||
if(ta1 == tphCons.getLeft() && ta2 == tphCons.getRight() && r==Relation.EXTENDS) {
|
||||
MethodConstraint mc = new MethodConstraint(ta1, ta2, r);
|
||||
if(!checkForDuplicates(mc, tempMC)) {
|
||||
@ -815,7 +819,7 @@ public class FamilyOfGeneratedGenerics {
|
||||
|
||||
|
||||
|
||||
public static List<MethodConstraint> methodTypesWithoutClassTypesNEW(List<String> tphsToCompute, List<MethodConstraint> cs_m, HashMap<String, List<PairTphMethod<PositionFinder.Position, String>>> posOfTphs) {
|
||||
public static List<MethodConstraint> methodTypesWithoutClassTypesNEW(List<String> tphsToCompute, List<MethodConstraint> cs_m) {
|
||||
List<MethodConstraint> tempMC = new ArrayList<>(cs_m);
|
||||
List<MethodConstraint> tempMC2 = new ArrayList<>(cs_m);
|
||||
List<String> toRemove = new ArrayList<>();
|
||||
@ -824,7 +828,7 @@ public class FamilyOfGeneratedGenerics {
|
||||
if(tphCons.getLeft() == tph) {
|
||||
toRemove.add(tphCons.getRight());
|
||||
tempMC2.remove(tphCons);
|
||||
tempMC2 = methodTypesWithoutClassTypesNEW(toRemove,tempMC2,posOfTphs);
|
||||
tempMC2 = methodTypesWithoutClassTypesNEW(toRemove,tempMC2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -884,7 +888,7 @@ public class FamilyOfGeneratedGenerics {
|
||||
for (PairTphMethod p : posOfTphs.get(tph)) {
|
||||
if(p.fst == PositionFinder.Position.FIELD) {
|
||||
tphs.add(tph);
|
||||
mcWithoutCc = methodTypesWithoutClassTypesNEW(tphs, listToAdd, posOfTphs);
|
||||
mcWithoutCc = methodTypesWithoutClassTypesNEW(tphs, listToAdd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,6 +80,8 @@ public class TestTwoArgs {
|
||||
lmc.add(new MethodConstraint("AG", "P", Relation.EXTENDS));
|
||||
lmc.add(new MethodConstraint("AH", "T", Relation.EXTENDS));
|
||||
lmc.add(new MethodConstraint("T", "AP", Relation.EXTENDS));
|
||||
lmc.add(new MethodConstraint("AL", "AF", Relation.EXTENDS));
|
||||
lmc.add(new MethodConstraint("P", "AL", Relation.EXTENDS));
|
||||
methodConstraintsWithPositionTest.put("TPH AFmain(TPH AGTPH AH)", lmc);
|
||||
|
||||
FamilyOfGeneratedGenerics fogg = compiler.fogg;
|
||||
|
Loading…
Reference in New Issue
Block a user