forked from JavaTX/JavaCompilerCore
modified: src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
Maximumsbildung auf maximale Elemente soweit fertig Argument von mul funktion nicht, liefret nur Vec<TypPl>
This commit is contained in:
parent
01dd4e57e6
commit
5d39863cc6
@ -5,6 +5,7 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@ -310,17 +311,22 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
Set<Set<UnifyPair>> computeCartesianRecursive(Set<Set<UnifyPair>> fstElems, ArrayList<Set<Set<UnifyPair>>> topLevelSets, Set<UnifyPair> eq, IFiniteClosure fc, boolean parallel) {
|
||||
ArrayList<Set<Set<UnifyPair>>> remainingSets = new ArrayList<>(topLevelSets);
|
||||
Set<Set<UnifyPair>> nextSet = remainingSets.remove(0);
|
||||
ArrayList<Set<UnifyPair>> nextSetasList = new ArrayList<>(nextSet);
|
||||
List<Set<UnifyPair>> nextSetasList = oup.sortedCopy(nextSet);//new ArrayList<>(nextSet);
|
||||
Set<Set<UnifyPair>> result = new HashSet<>();
|
||||
int i = 0;
|
||||
byte variance = nextSetasList.iterator().next().iterator().next().getVariance();
|
||||
Set<UnifyPair> a_next = null;
|
||||
if (nextSetasList.size()>1) {
|
||||
if (variance == 1 && nextSetasList.size() > 1) {
|
||||
List<Set<UnifyPair>> al = new ArrayList<>(nextSetasList.size());
|
||||
for (int ii = 0; ii < nextSetasList.size();ii++) {
|
||||
al.add(0,nextSetasList.get(ii));
|
||||
}
|
||||
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("");
|
||||
if (variance == 1) {
|
||||
a_next = oup.max(nextSetasList.iterator());
|
||||
List<Set<UnifyPair>> liup = oup.sortedCopy(nextSetasList);
|
||||
}
|
||||
else if (variance == -1) {
|
||||
a_next = oup.min(nextSetasList.iterator());
|
||||
@ -332,12 +338,14 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
else {
|
||||
a_next = nextSetasList.iterator().next();
|
||||
}
|
||||
*/
|
||||
if (nextSetasList.iterator().next().iterator().next().getLhsType().getName().equals("D") && nextSetasList.size()>1)
|
||||
System.out.print("");
|
||||
while (nextSetasList.size() != 0) {
|
||||
Set<UnifyPair> a = a_next;
|
||||
while (nextSetasList.size() > 0) { //(nextSetasList.size() != 0) {
|
||||
Set<UnifyPair> a = nextSetasList.remove(0);
|
||||
//writeLog("nextSet: " + nextSetasList.toString()+ "\n");
|
||||
nextSetasList.remove(a);
|
||||
//nextSetasList.remove(a);
|
||||
/* zu loeschen
|
||||
if (nextSetasList.size() > 0) {
|
||||
if (nextSetasList.size()>1) {
|
||||
if (variance == 1) {
|
||||
@ -354,6 +362,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
|
||||
@ -370,27 +379,23 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
}
|
||||
|
||||
if (!result.isEmpty() && !isUndefinedPairSetSet(result)) {
|
||||
Iterator<Set<UnifyPair>> nextSetasListIt = new ArrayList<Set<UnifyPair>>(nextSetasList).iterator();
|
||||
if (variance == 1) {
|
||||
if (a.iterator().next().getLhsType().getName().equals("WL"))
|
||||
System.out.print("");
|
||||
if (a.equals(a_next) ||
|
||||
while (nextSetasListIt.hasNext()) {
|
||||
Set<UnifyPair> a_next = nextSetasListIt.next();
|
||||
if (a.equals(a_next) ||
|
||||
(oup.compare(a, a_next) == 1)) {
|
||||
System.out.print("");
|
||||
break;
|
||||
}
|
||||
else {
|
||||
System.out.print("");
|
||||
nextSetasList.remove(a_next);
|
||||
}
|
||||
}
|
||||
}
|
||||
else { if (variance == -1) {
|
||||
if (a.iterator().next().getLhsType().getName().equals("A"))
|
||||
System.out.print("");
|
||||
if (a.equals(a_next) || (oup.compare(a, a_next) == -1)) {
|
||||
System.out.print("");
|
||||
break;
|
||||
}
|
||||
else {
|
||||
System.out.print("");
|
||||
while (nextSetasListIt.hasNext()) {
|
||||
Set<UnifyPair> a_next = nextSetasListIt.next();
|
||||
if (a.equals(a_next) ||
|
||||
(oup.compare(a, a_next) == -1)) {
|
||||
nextSetasList.remove(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (variance == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user