modified: ../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
ArrayList durch LinkedList ersetzt computeCartesianRecursiveOderConstraints auskommentiert
This commit is contained in:
parent
85a15cb256
commit
25b1d3e62d
@ -228,7 +228,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
public Set<Set<UnifyPair>> computeCartesianRecursiveOderConstraints(Set<Set<UnifyPair>> fstElems, List<Set<Set<UnifyPair>>> topLevelSets, IFiniteClosure fc, boolean parallel, int rekTiefe) {
|
||||
//ArrayList<Set<Set<UnifyPair>>> remainingSets = new ArrayList<>(topLevelSets);
|
||||
fstElems.addAll(topLevelSets.stream()
|
||||
@ -274,7 +274,8 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
// nextSetasList = al;
|
||||
//}
|
||||
//Set<UnifyPair> a = nextSetasListIt.next();
|
||||
/*if (nextSetasList.size()>1) {zu loeschen
|
||||
//
|
||||
/ *if (nextSetasList.size()>1) {zu loeschen
|
||||
if (nextSetasList.iterator().next().iterator().next().getLhsType().getName().equals("D"))
|
||||
System.out.print("");
|
||||
if (variance == 1) {
|
||||
@ -290,7 +291,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
else {
|
||||
a_next = nextSetasList.iterator().next();
|
||||
}
|
||||
*/
|
||||
* /
|
||||
if (!nextSetasList.iterator().hasNext())
|
||||
System.out.print("");
|
||||
if (nextSetasList.iterator().next().stream().filter(x -> x.getLhsType().getName().equals("D")).findFirst().isPresent() && nextSetasList.size()>1)
|
||||
@ -299,11 +300,13 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
while (nextSetasList.size() > 0) { //(nextSetasList.size() != 0) {
|
||||
Set<UnifyPair> a = null;
|
||||
if (variance == 1) {
|
||||
a = oup.max(nextSetasList.iterator());
|
||||
//a = oup.max(nextSetasList.iterator());
|
||||
a = nextSetasList.get(nextSetasList.size()-1);
|
||||
nextSetasList.remove(a);
|
||||
}
|
||||
else if (variance == -1) {
|
||||
a = oup.min(nextSetasList.iterator());
|
||||
//a = oup.min(nextSetasList.iterator());
|
||||
a = nextSetasList.get(0);
|
||||
nextSetasList.remove(a);
|
||||
}
|
||||
else if (variance == 0) {
|
||||
@ -311,7 +314,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
}
|
||||
//writeLog("nextSet: " + nextSetasList.toString()+ "\n");
|
||||
//nextSetasList.remove(a);
|
||||
/* zu loeschen
|
||||
/ * zu loeschen
|
||||
if (nextSetasList.size() > 0) {
|
||||
if (nextSetasList.size()>1) {
|
||||
if (variance == 1) {
|
||||
@ -328,7 +331,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
a_next = nextSetasList.iterator().next();
|
||||
}
|
||||
}
|
||||
*/
|
||||
* /
|
||||
//PL 2018-03-01
|
||||
//TODO: 1. Maximum und Minimum unterscheiden
|
||||
//TODO: 2. compare noch für alle Elmemente die nicht X =. ty sind erweitern
|
||||
@ -372,7 +375,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
|
||||
|
||||
|
||||
/* auskommentiert um alle Max und min Betrachtung auszuschalten ANFANG */
|
||||
/ * auskommentiert um alle Max und min Betrachtung auszuschalten ANFANG * /
|
||||
if (!result.isEmpty() && !isUndefinedPairSetSet(res)) {
|
||||
if (nextSetasList.iterator().hasNext() && nextSetasList.iterator().next().stream().filter(x -> x.getLhsType().getName().equals("B")).findFirst().isPresent() && nextSetasList.size()>1)
|
||||
System.out.print("");
|
||||
@ -407,9 +410,9 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
//break;
|
||||
}}
|
||||
}
|
||||
/* auskommentiert um alle Max und min Betrachtung auszuschalten ENDE */
|
||||
/ * auskommentiert um alle Max und min Betrachtung auszuschalten ENDE * /
|
||||
|
||||
/* PL 2018-11-05 wird falsch weil es auf der obersten Ebene ist.
|
||||
/ * PL 2018-11-05 wird falsch weil es auf der obersten Ebene ist.
|
||||
if (isUndefinedPairSetSet(res)) {
|
||||
int nofstred= 0;
|
||||
Set<UnifyPair> abhSubst = res.stream()
|
||||
@ -462,7 +465,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
writeLog("Number of Backtracking: " + noBacktracking);
|
||||
System.out.println("");
|
||||
}
|
||||
*/
|
||||
* /
|
||||
//if (nextSetasList.size() == 0 && isUndefinedPairSetSet(result) && nextSet.size() > 1) {
|
||||
// return result;
|
||||
//}
|
||||
@ -475,7 +478,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
} // End of while (nextSetasList.size() > 0)
|
||||
return result;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* Computes all principal type unifiers for a set of constraints.
|
||||
@ -820,15 +823,15 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
Set<UnifyPair> a = null;
|
||||
while (nextSetasList.size() > 0) { //(nextSetasList.size() != 0) {
|
||||
Set<UnifyPair> a_last = a;
|
||||
List<Set<UnifyPair>> nextSetasListRest = new ArrayList<>();
|
||||
List<Set<UnifyPair>> nextSetasListRest = new LinkedList<>();
|
||||
//List<Set<UnifyPair>> nextSetasListRestMin = new ArrayList<>();
|
||||
//List<Set<UnifyPair>> nextSetasListRestOder = new ArrayList<>();
|
||||
if (variance == 1) {
|
||||
//a = oup.max(nextSetasList.iterator());
|
||||
a = nextSetasList.get(nextSetasList.size()-1);
|
||||
nextSetasList.remove(a);
|
||||
nextSetasListRest = new ArrayList<>(nextSetasList);
|
||||
Iterator<Set<UnifyPair>> nextSetasListItRest = new ArrayList<Set<UnifyPair>>(nextSetasListRest).iterator();
|
||||
nextSetasListRest = new LinkedList<>(nextSetasList);
|
||||
Iterator<Set<UnifyPair>> nextSetasListItRest = new LinkedList<Set<UnifyPair>>(nextSetasListRest).iterator();
|
||||
while (nextSetasListItRest.hasNext()) {
|
||||
Set<UnifyPair> a_next = nextSetasListItRest.next();
|
||||
if (//a.equals(a_next) ||
|
||||
@ -839,9 +842,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
//Alle maximale Elemente in nextSetasListRest bestimmen
|
||||
List<Set<UnifyPair>> nextSetasListRestTest;
|
||||
do {
|
||||
nextSetasListRestTest = new ArrayList<Set<UnifyPair>>(nextSetasListRest);
|
||||
nextSetasListRestTest = new LinkedList<Set<UnifyPair>>(nextSetasListRest);
|
||||
if (!nextSetasListRest.isEmpty()) {
|
||||
Set<UnifyPair> max = oup.max(nextSetasListRest.iterator());
|
||||
//Set<UnifyPair> max = oup.max(nextSetasListRest.iterator());
|
||||
Set<UnifyPair> max = nextSetasListRest.get(nextSetasListRest.size()-1);
|
||||
Iterator<Set<UnifyPair>> nextSetasListItRest2 = new ArrayList<Set<UnifyPair>>(nextSetasListRest).iterator();
|
||||
while (nextSetasListItRest2.hasNext()) {
|
||||
Set<UnifyPair> a_nextRest = nextSetasListItRest2.next();
|
||||
@ -858,7 +862,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
//a = oup.min(nextSetasList.iterator());
|
||||
a = nextSetasList.get(0);
|
||||
nextSetasList.remove(a);
|
||||
nextSetasListRest = new ArrayList<>(nextSetasList);
|
||||
nextSetasListRest = new LinkedList<>(nextSetasList);
|
||||
Iterator<Set<UnifyPair>> nextSetasListItRest = new ArrayList<Set<UnifyPair>>(nextSetasListRest).iterator();
|
||||
while (nextSetasListItRest.hasNext()) {
|
||||
Set<UnifyPair> a_next = nextSetasListItRest.next();
|
||||
@ -871,9 +875,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
|
||||
List<Set<UnifyPair>> nextSetasListRestTest;
|
||||
do {
|
||||
nextSetasListRestTest = new ArrayList<Set<UnifyPair>>(nextSetasListRest);
|
||||
nextSetasListRestTest = new LinkedList<Set<UnifyPair>>(nextSetasListRest);
|
||||
if (!nextSetasListRest.isEmpty()) {
|
||||
Set<UnifyPair> min = oup.min(nextSetasListRest.iterator());
|
||||
//Set<UnifyPair> min = oup.min(nextSetasListRest.iterator());
|
||||
Set<UnifyPair> min = nextSetasListRest.get(0);
|
||||
Iterator<Set<UnifyPair>> nextSetasListItRest2 = new ArrayList<Set<UnifyPair>>(nextSetasListRest).iterator();
|
||||
while (nextSetasListItRest2.hasNext()) {
|
||||
Set<UnifyPair> a_nextRest = nextSetasListItRest2.next();
|
||||
@ -887,7 +892,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
}
|
||||
else if (variance == 2) {
|
||||
a = nextSetasList.remove(0);
|
||||
nextSetasListRest = new ArrayList<>(nextSetasList);
|
||||
nextSetasListRest = new LinkedList<>(nextSetasList);
|
||||
}
|
||||
else if (variance == 0) {
|
||||
a = nextSetasList.remove(0);
|
||||
|
Loading…
Reference in New Issue
Block a user