forked from JavaTX/JavaCompilerCore
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) {
|
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);
|
//ArrayList<Set<Set<UnifyPair>>> remainingSets = new ArrayList<>(topLevelSets);
|
||||||
fstElems.addAll(topLevelSets.stream()
|
fstElems.addAll(topLevelSets.stream()
|
||||||
@ -274,6 +274,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
// nextSetasList = al;
|
// nextSetasList = al;
|
||||||
//}
|
//}
|
||||||
//Set<UnifyPair> a = nextSetasListIt.next();
|
//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"))
|
if (nextSetasList.iterator().next().iterator().next().getLhsType().getName().equals("D"))
|
||||||
System.out.print("");
|
System.out.print("");
|
||||||
@ -299,11 +300,13 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
while (nextSetasList.size() > 0) { //(nextSetasList.size() != 0) {
|
while (nextSetasList.size() > 0) { //(nextSetasList.size() != 0) {
|
||||||
Set<UnifyPair> a = null;
|
Set<UnifyPair> a = null;
|
||||||
if (variance == 1) {
|
if (variance == 1) {
|
||||||
a = oup.max(nextSetasList.iterator());
|
//a = oup.max(nextSetasList.iterator());
|
||||||
|
a = nextSetasList.get(nextSetasList.size()-1);
|
||||||
nextSetasList.remove(a);
|
nextSetasList.remove(a);
|
||||||
}
|
}
|
||||||
else if (variance == -1) {
|
else if (variance == -1) {
|
||||||
a = oup.min(nextSetasList.iterator());
|
//a = oup.min(nextSetasList.iterator());
|
||||||
|
a = nextSetasList.get(0);
|
||||||
nextSetasList.remove(a);
|
nextSetasList.remove(a);
|
||||||
}
|
}
|
||||||
else if (variance == 0) {
|
else if (variance == 0) {
|
||||||
@ -475,7 +478,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
} // End of while (nextSetasList.size() > 0)
|
} // End of while (nextSetasList.size() > 0)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Computes all principal type unifiers for a set of constraints.
|
* 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;
|
Set<UnifyPair> a = null;
|
||||||
while (nextSetasList.size() > 0) { //(nextSetasList.size() != 0) {
|
while (nextSetasList.size() > 0) { //(nextSetasList.size() != 0) {
|
||||||
Set<UnifyPair> a_last = a;
|
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>> nextSetasListRestMin = new ArrayList<>();
|
||||||
//List<Set<UnifyPair>> nextSetasListRestOder = new ArrayList<>();
|
//List<Set<UnifyPair>> nextSetasListRestOder = new ArrayList<>();
|
||||||
if (variance == 1) {
|
if (variance == 1) {
|
||||||
//a = oup.max(nextSetasList.iterator());
|
//a = oup.max(nextSetasList.iterator());
|
||||||
a = nextSetasList.get(nextSetasList.size()-1);
|
a = nextSetasList.get(nextSetasList.size()-1);
|
||||||
nextSetasList.remove(a);
|
nextSetasList.remove(a);
|
||||||
nextSetasListRest = new ArrayList<>(nextSetasList);
|
nextSetasListRest = new LinkedList<>(nextSetasList);
|
||||||
Iterator<Set<UnifyPair>> nextSetasListItRest = new ArrayList<Set<UnifyPair>>(nextSetasListRest).iterator();
|
Iterator<Set<UnifyPair>> nextSetasListItRest = new LinkedList<Set<UnifyPair>>(nextSetasListRest).iterator();
|
||||||
while (nextSetasListItRest.hasNext()) {
|
while (nextSetasListItRest.hasNext()) {
|
||||||
Set<UnifyPair> a_next = nextSetasListItRest.next();
|
Set<UnifyPair> a_next = nextSetasListItRest.next();
|
||||||
if (//a.equals(a_next) ||
|
if (//a.equals(a_next) ||
|
||||||
@ -839,9 +842,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
//Alle maximale Elemente in nextSetasListRest bestimmen
|
//Alle maximale Elemente in nextSetasListRest bestimmen
|
||||||
List<Set<UnifyPair>> nextSetasListRestTest;
|
List<Set<UnifyPair>> nextSetasListRestTest;
|
||||||
do {
|
do {
|
||||||
nextSetasListRestTest = new ArrayList<Set<UnifyPair>>(nextSetasListRest);
|
nextSetasListRestTest = new LinkedList<Set<UnifyPair>>(nextSetasListRest);
|
||||||
if (!nextSetasListRest.isEmpty()) {
|
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();
|
Iterator<Set<UnifyPair>> nextSetasListItRest2 = new ArrayList<Set<UnifyPair>>(nextSetasListRest).iterator();
|
||||||
while (nextSetasListItRest2.hasNext()) {
|
while (nextSetasListItRest2.hasNext()) {
|
||||||
Set<UnifyPair> a_nextRest = nextSetasListItRest2.next();
|
Set<UnifyPair> a_nextRest = nextSetasListItRest2.next();
|
||||||
@ -858,7 +862,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
//a = oup.min(nextSetasList.iterator());
|
//a = oup.min(nextSetasList.iterator());
|
||||||
a = nextSetasList.get(0);
|
a = nextSetasList.get(0);
|
||||||
nextSetasList.remove(a);
|
nextSetasList.remove(a);
|
||||||
nextSetasListRest = new ArrayList<>(nextSetasList);
|
nextSetasListRest = new LinkedList<>(nextSetasList);
|
||||||
Iterator<Set<UnifyPair>> nextSetasListItRest = new ArrayList<Set<UnifyPair>>(nextSetasListRest).iterator();
|
Iterator<Set<UnifyPair>> nextSetasListItRest = new ArrayList<Set<UnifyPair>>(nextSetasListRest).iterator();
|
||||||
while (nextSetasListItRest.hasNext()) {
|
while (nextSetasListItRest.hasNext()) {
|
||||||
Set<UnifyPair> a_next = nextSetasListItRest.next();
|
Set<UnifyPair> a_next = nextSetasListItRest.next();
|
||||||
@ -871,9 +875,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
|
|
||||||
List<Set<UnifyPair>> nextSetasListRestTest;
|
List<Set<UnifyPair>> nextSetasListRestTest;
|
||||||
do {
|
do {
|
||||||
nextSetasListRestTest = new ArrayList<Set<UnifyPair>>(nextSetasListRest);
|
nextSetasListRestTest = new LinkedList<Set<UnifyPair>>(nextSetasListRest);
|
||||||
if (!nextSetasListRest.isEmpty()) {
|
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();
|
Iterator<Set<UnifyPair>> nextSetasListItRest2 = new ArrayList<Set<UnifyPair>>(nextSetasListRest).iterator();
|
||||||
while (nextSetasListItRest2.hasNext()) {
|
while (nextSetasListItRest2.hasNext()) {
|
||||||
Set<UnifyPair> a_nextRest = nextSetasListItRest2.next();
|
Set<UnifyPair> a_nextRest = nextSetasListItRest2.next();
|
||||||
@ -887,7 +892,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
|||||||
}
|
}
|
||||||
else if (variance == 2) {
|
else if (variance == 2) {
|
||||||
a = nextSetasList.remove(0);
|
a = nextSetasList.remove(0);
|
||||||
nextSetasListRest = new ArrayList<>(nextSetasList);
|
nextSetasListRest = new LinkedList<>(nextSetasList);
|
||||||
}
|
}
|
||||||
else if (variance == 0) {
|
else if (variance == 0) {
|
||||||
a = nextSetasList.remove(0);
|
a = nextSetasList.remove(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user