modified: src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java
This commit is contained in:
parent
0cb1f244bc
commit
bbfd8aa203
@ -571,79 +571,6 @@ public class FamilyOfGeneratedGenerics {
|
||||
oldConsListConverted.add(new TPHConstraint(((TypePlaceholder) pair.TA1).getName(), ((TypePlaceholder) pair.TA2).getName(), r));
|
||||
}
|
||||
|
||||
// dies ist das "R" aus dem ersten Teil, wird im zweiten Teil gebraucht
|
||||
// TypePlaceholder tphR = null;
|
||||
// Constraint<Pair> extendsSetAllOfOr = new Constraint<Pair>();
|
||||
// Constraint<Pair> equalSetAllOfOr = new Constraint<Pair>();
|
||||
|
||||
|
||||
// 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>();
|
||||
//für jede einzelne OrConstraint-Menge gehe durch
|
||||
for(Constraint con: orCons.get(i)) {
|
||||
Iterator<Pair> it = con.iterator();
|
||||
//für jeden Eintrag der Menge
|
||||
while (it.hasNext()) {
|
||||
Pair p = it.next();
|
||||
if (p.OperatorSmallerDot()) {
|
||||
extendsSet.add(p);
|
||||
// extendsSetAllOfOr.add(p);
|
||||
} else if (p.OperatorEqual()) {
|
||||
equalSet.add(p);
|
||||
// equalSetAllOfOr.add(p);
|
||||
}
|
||||
}
|
||||
Iterator<Pair> itExtends = extendsSet.iterator();
|
||||
while(itExtends.hasNext()) {
|
||||
Pair pairExtends = itExtends.next();
|
||||
Iterator<Pair> itEqual = equalSet.iterator();
|
||||
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()) {//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)) {
|
||||
//TODO: evtl. pairExtends hinzufuegen
|
||||
//tempSet.add(newPair);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*// Berechnung des zweiten Teils der Regel
|
||||
Iterator<Pair> itEqual = equalSet.iterator();
|
||||
while(itEqual.hasNext()) {
|
||||
Pair pairEqual = itEqual.next();
|
||||
Iterator<Pair> itExtends = equalSet.iterator();
|
||||
while(itExtends.hasNext()) {
|
||||
Pair pairExtends = itExtends.next();
|
||||
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()) {
|
||||
Pair pairTC = itTC.next();
|
||||
|
||||
// prüfe, ob das "R" von vorhin in einem EqualConstraint links auftaucht
|
||||
if(tphR == pairEqual.TA1) {
|
||||
// tempSet.add();
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
// Berechnung des zweiten Teils der Bedingung der Regel
|
||||
for(int i=0; i<orCons.size(); i++) {
|
||||
@ -672,30 +599,6 @@ public class FamilyOfGeneratedGenerics {
|
||||
Pair newPairOld = new Pair(pairExtends2.TA2, pairEqual2.TA1);
|
||||
Pair newPair2 = new Pair(resSet.resolveType((TypePlaceholder) (pairExtends2.TA2)).resolvedType, resSet.resolveType((TypePlaceholder) (pairEqual2.TA1)).resolvedType, PairOperator.SMALLERDOT);
|
||||
TPHConstraint newPairTPHConstraint = new TPHConstraint(newPair2);
|
||||
//if (!tcOfoldConsSet.contains(newPairOld)) { continue; }
|
||||
Iterator<TPHConstraint> itTC = tcOfCs.iterator(); //tcOfoldConsSet.iterator();
|
||||
/*
|
||||
buildTransitiveClosureForCP(
|
||||
mapMethodsAndTph.get(posOfTPHs.get(((TypePlaceholder)pairExtends2.TA2)
|
||||
.getName()).get(0).snd)
|
||||
.constraints.getAll(),
|
||||
resSet).iterator();
|
||||
*/
|
||||
//while(itTC.hasNext()) {//ueberpruefen ob newPair in transitiv closure
|
||||
//Pair pairTC = itTC.next();
|
||||
//if //((pairTC.TA1.equals(newPairOld.TA1))
|
||||
// ((resSet.resolveType((TypePlaceholder)(pairTC.TA1)).resolvedType.equals(newPair2.TA1))
|
||||
// && resSet.resolveType((TypePlaceholder)(pairTC.TA2)).resolvedType.equals(newPair2.TA2)
|
||||
// //&& pairTC.OperatorSmallerDot()
|
||||
// //&& newPair2.OperatorSmallerDot()
|
||||
// )
|
||||
//TPHConstraint tPHCons = itTC.next();
|
||||
//if newPairTPHConstraint
|
||||
//{ //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!)
|
||||
// transClo = true;
|
||||
// break;
|
||||
//}
|
||||
//}
|
||||
if (tcOfCs.contains(newPairTPHConstraint)|| (newPairTPHConstraint.getLeft().equals(newPairTPHConstraint.getRight()))) {
|
||||
transClo = true;
|
||||
}
|
||||
@ -705,34 +608,34 @@ public class FamilyOfGeneratedGenerics {
|
||||
while (itUndCons.hasNext()) {
|
||||
Pair pairUndCons2 = itUndCons.next();
|
||||
rEqExRtilde = rEqExRtilde || (tphR == pairUndCons2.TA1);
|
||||
// Pair rExRtildePair = new Pair(resSet.resolveType((TypePlaceholder) (tphR)).resolvedType, resSet.resolveType((TypePlaceholder) (pairExtends2.TA2)).resolvedType, PairOperator.SMALLERDOT);
|
||||
}
|
||||
boolean isPairInTExTapostrophe = false;
|
||||
// Constraint<Pair> allOfOr = new Constraint<Pair>();
|
||||
for(Set<Constraint<Pair>> scp: orCons) {
|
||||
Iterator<Constraint<Pair>> itSCP = scp.iterator();
|
||||
while(itSCP.hasNext()) {
|
||||
Constraint<Pair> cp = itSCP.next();
|
||||
Iterator<Pair> itCP = cp.iterator();
|
||||
while(itCP.hasNext()) {
|
||||
Pair p = itCP.next();
|
||||
if(p.OperatorSmallerDot()) {
|
||||
isPairInTExTapostrophe = isPairInTExTapostrophe || tphR.equals(p.TA1);
|
||||
}
|
||||
boolean isPairInTExTapostrophe = false;
|
||||
for(Set<Constraint<Pair>> scp: orCons) {
|
||||
Iterator<Constraint<Pair>> itSCP = scp.iterator();
|
||||
while(itSCP.hasNext()) {
|
||||
Constraint<Pair> cp = itSCP.next();
|
||||
Iterator<Pair> itCP = cp.iterator();
|
||||
while(itCP.hasNext()) {
|
||||
Pair p = itCP.next();
|
||||
if(p.OperatorSmallerDot()) {
|
||||
isPairInTExTapostrophe = isPairInTExTapostrophe || tphR.equals(p.TA1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (transClo && (rEqExRtilde || isPairInTExTapostrophe)) {
|
||||
if (!newPair2.TA1.equals(newPair2.TA2)) { //eliminieren der Fälle wie AA<.AA
|
||||
if (transClo && !checkForDuplicatesForSets(newPair2, tempSet2))
|
||||
tempSet2.add(newPair2);
|
||||
}
|
||||
if (!checkForDuplicatesForSets(pairExtends2, tempSet2))
|
||||
tempSet2.add(pairExtends2);
|
||||
}
|
||||
}
|
||||
if (transClo && (rEqExRtilde || isPairInTExTapostrophe)) {
|
||||
if (!newPair2.TA1.equals(newPair2.TA2)) { //eliminieren der Fälle wie AA<.AA
|
||||
if (!checkForDuplicatesForSets(newPair2, tempSet2)) {
|
||||
tempSet2.add(newPair2);
|
||||
}
|
||||
}
|
||||
if (!checkForDuplicatesForSets(pairExtends2, tempSet2)) {
|
||||
tempSet2.add(pairExtends2);
|
||||
}
|
||||
}
|
||||
}
|
||||
String key = ((TypePlaceholder)pairExtends2.TA2).getName();
|
||||
if (posOfTphs.containsKey(key)) {
|
||||
if (posOfTphs.get(key).contains(new PairTphMethod<>(PositionFinder.Position.METHOD, methodAndTPH.getId()))) {
|
||||
|
Loading…
Reference in New Issue
Block a user