modified: src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java
This commit is contained in:
parent
13144d0ac9
commit
661fa53937
@ -519,6 +519,7 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
List<Set<Constraint<Pair>>> orCons = methAndTphs.constraints.getOderConstraints();
|
List<Set<Constraint<Pair>>> orCons = methAndTphs.constraints.getOderConstraints();
|
||||||
List<List<Constraint<Pair>>> orConsList = new ArrayList<>();
|
List<List<Constraint<Pair>>> orConsList = new ArrayList<>();
|
||||||
List<HashMap<Relation, List<TPHConstraint>>> orConsListConverted = new ArrayList<>();
|
List<HashMap<Relation, List<TPHConstraint>>> orConsListConverted = new ArrayList<>();
|
||||||
|
//gehe die OrConstraints der aktuellen Methode durch und teile nach Operator auf (
|
||||||
for(int i=0; i<orCons.size(); i++) {
|
for(int i=0; i<orCons.size(); i++) {
|
||||||
HashMap<Relation, List<TPHConstraint>> orConsInternal = new HashMap<>();
|
HashMap<Relation, List<TPHConstraint>> orConsInternal = new HashMap<>();
|
||||||
List<TPHConstraint> orConsWithEQUAL = new ArrayList();
|
List<TPHConstraint> orConsWithEQUAL = new ArrayList();
|
||||||
@ -550,6 +551,8 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
orConsListConverted.add(orConsInternal);
|
orConsListConverted.add(orConsInternal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// oldCons sind alle Und- und Oder-Constraints
|
||||||
|
// zunächst in meine Datenstruktur(Ali) konvertieren
|
||||||
List<Pair> oldConsList = new ArrayList<>(oldCons);
|
List<Pair> oldConsList = new ArrayList<>(oldCons);
|
||||||
List<TPHConstraint> oldConsListConverted = new ArrayList<>();
|
List<TPHConstraint> oldConsListConverted = new ArrayList<>();
|
||||||
for(Pair pair: oldConsList) {
|
for(Pair pair: oldConsList) {
|
||||||
@ -561,10 +564,8 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
}
|
}
|
||||||
oldConsListConverted.add(new TPHConstraint(((TypePlaceholder) pair.TA1).getName(), ((TypePlaceholder) pair.TA2).getName(), r));
|
oldConsListConverted.add(new TPHConstraint(((TypePlaceholder) pair.TA1).getName(), ((TypePlaceholder) pair.TA2).getName(), r));
|
||||||
}
|
}
|
||||||
// List<TPHConstraint> tcOfoldCons = buildTransitiveClosure(oldConsListConverted);
|
|
||||||
// Set<Pair> tcOfoldConsSet = buildTransitiveClosureForCP(oldCons);
|
|
||||||
|
|
||||||
// for(int i=0; i<orConsListConverted.size(); i++) {
|
// Berechnung der Regel
|
||||||
for(int i=0; i<orCons.size(); i++) {
|
for(int i=0; i<orCons.size(); i++) {
|
||||||
Constraint<Pair> extendsSet = new Constraint<Pair>();
|
Constraint<Pair> extendsSet = new Constraint<Pair>();
|
||||||
Constraint<Pair> equalSet = new Constraint<Pair>();
|
Constraint<Pair> equalSet = new Constraint<Pair>();
|
||||||
@ -572,31 +573,23 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
Iterator<Pair> it = con.iterator();
|
Iterator<Pair> it = con.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
Pair p = it.next();
|
Pair p = it.next();
|
||||||
// List<TPHConstraint> extendsList = orConsListConverted.get(i).get(Relation.EXTENDS);
|
|
||||||
// List<TPHConstraint> equalList = orConsListConverted.get(i).get(Relation.EQUAL);
|
|
||||||
if (p.OperatorSmallerDot()) {
|
if (p.OperatorSmallerDot()) {
|
||||||
extendsSet.add(p);
|
extendsSet.add(p);
|
||||||
} else if (p.OperatorEqual()) {
|
} else if (p.OperatorEqual()) {
|
||||||
equalSet.add(p);
|
equalSet.add(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// for (TPHConstraint ex : extendsList) {
|
|
||||||
Iterator<Pair> itExtends = extendsSet.iterator();
|
Iterator<Pair> itExtends = extendsSet.iterator();
|
||||||
while(itExtends.hasNext()) {
|
while(itExtends.hasNext()) {
|
||||||
Pair pairExtends = itExtends.next();
|
Pair pairExtends = itExtends.next();
|
||||||
// for (TPHConstraint eq : equalList) {
|
|
||||||
Iterator<Pair> itEqual = equalSet.iterator();
|
Iterator<Pair> itEqual = equalSet.iterator();
|
||||||
while(itEqual.hasNext()) {
|
while(itEqual.hasNext()) {
|
||||||
Pair pairEqual = itEqual.next();
|
Pair pairEqual = itEqual.next();
|
||||||
// MethodConstraint mc = new MethodConstraint(ex.getRight(), eq.getLeft(), Relation.EXTENDS);
|
|
||||||
Pair newPair = new Pair(resSet.resolveType((TypePlaceholder)(pairExtends.TA2)).resolvedType, resSet.resolveType((TypePlaceholder)(pairEqual.TA1)).resolvedType, PairOperator.SMALLERDOT);
|
Pair newPair = new Pair(resSet.resolveType((TypePlaceholder)(pairExtends.TA2)).resolvedType, resSet.resolveType((TypePlaceholder)(pairEqual.TA1)).resolvedType, PairOperator.SMALLERDOT);
|
||||||
// for (TPHConstraint tc : tcOfoldCons) {
|
|
||||||
Iterator<Pair> itTC = tcOfoldConsSet.iterator();
|
Iterator<Pair> itTC = tcOfoldConsSet.iterator();
|
||||||
while(itTC.hasNext()) {
|
while(itTC.hasNext()) {
|
||||||
Pair pairTC = itTC.next();
|
Pair pairTC = itTC.next();
|
||||||
// if (tc.getLeft() == mc.getLeft() && tc.getRight() == mc.getRight() && tc.getRel() == mc.getRel()) {
|
|
||||||
if(resSet.resolveType((TypePlaceholder)(pairTC.TA1)).resolvedType == newPair.TA1 && resSet.resolveType((TypePlaceholder)(pairTC.TA2)).resolvedType == newPair.TA2 && pairTC.OperatorSmallerDot() && newPair.OperatorSmallerDot()) { //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(resSet.resolveType((TypePlaceholder)(pairTC.TA1)).resolvedType == newPair.TA1 && resSet.resolveType((TypePlaceholder)(pairTC.TA2)).resolvedType == newPair.TA2 && pairTC.OperatorSmallerDot() && newPair.OperatorSmallerDot()) { //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 (!checkForDuplicates(mc, tempMC)) {
|
|
||||||
if(newPair.TA1 != newPair.TA2) {
|
if(newPair.TA1 != newPair.TA2) {
|
||||||
if (!checkForDuplicatesForSets(newPair, tempSet)) {
|
if (!checkForDuplicatesForSets(newPair, tempSet)) {
|
||||||
tempSet.add(newPair);
|
tempSet.add(newPair);
|
||||||
@ -609,6 +602,7 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// aus der alten Datenstruktur in die neue Datenstruktur (von Ali)
|
||||||
Iterator<Pair> itTemp = tempSet.iterator();
|
Iterator<Pair> itTemp = tempSet.iterator();
|
||||||
while(itTemp.hasNext()) {
|
while(itTemp.hasNext()) {
|
||||||
Pair p = itTemp.next();
|
Pair p = itTemp.next();
|
||||||
|
Loading…
Reference in New Issue
Block a user