modified: ../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java

ArrayList durch LinkedList ersetzt
computeCartesianRecursiveOderConstraints auskommentiert
This commit is contained in:
Martin Plümicke 2019-02-14 08:53:32 +01:00
parent 85a15cb256
commit 25b1d3e62d

View File

@ -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,6 +274,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
// nextSetasList = al;
//}
//Set<UnifyPair> a = nextSetasListIt.next();
//
/ *if (nextSetasList.size()>1) {zu loeschen
if (nextSetasList.iterator().next().iterator().next().getLhsType().getName().equals("D"))
System.out.print("");
@ -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) {
@ -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);