modified: src/de/dhbwstuttgart/typeinference/unify/model/FiniteClosure.java

kleiner Fehler korrigiert
	modified:   test/javFiles/Matrix.jav
This commit is contained in:
Martin Plümicke 2018-05-25 11:16:02 +02:00
parent 1de897fb1f
commit 9d53d9d5d1
2 changed files with 18 additions and 6 deletions

View File

@ -194,6 +194,11 @@ public class FiniteClosure extends Ordering<UnifyType> implements IFiniteClosure
@Override @Override
//Eingefuegt PL 2018-05-24 F-Bounded Problematik //Eingefuegt PL 2018-05-24 F-Bounded Problematik
public Set<UnifyType> greater(UnifyType type, Set<UnifyType> fBounded) { public Set<UnifyType> greater(UnifyType type, Set<UnifyType> fBounded) {
if(type instanceof FunNType) {
return computeGreaterFunN((FunNType) type, fBounded);
}
Set<UnifyType> result = new HashSet<>(); Set<UnifyType> result = new HashSet<>();
Set<Pair<UnifyType,Set<UnifyType>>> PairResultFBounded = new HashSet<>(); Set<Pair<UnifyType,Set<UnifyType>>> PairResultFBounded = new HashSet<>();
@ -224,7 +229,7 @@ public class FiniteClosure extends Ordering<UnifyType> implements IFiniteClosure
Set<UnifyType> fBoundedNew = new HashSet<>(fBounded); Set<UnifyType> fBoundedNew = new HashSet<>(fBounded);
fBoundedNew.add(theta1); fBoundedNew.add(theta1);
Set<UnifyType> theta2Set = candidate.getContentOfPredecessors(); Set<UnifyType> theta2Set = candidate.getContentOfPredecessors();
//System.out.println("");
for(UnifyType theta2 : theta2Set) { for(UnifyType theta2 : theta2Set) {
result.add(theta2.apply(sigma)); result.add(theta2.apply(sigma));
PairResultFBounded.add(new Pair<>(theta2.apply(sigma), fBoundedNew)); PairResultFBounded.add(new Pair<>(theta2.apply(sigma), fBoundedNew));
@ -253,10 +258,17 @@ public class FiniteClosure extends Ordering<UnifyType> implements IFiniteClosure
// System.out.println(""); // System.out.println("");
//} //}
BinaryOperator<Boolean> bo = (a,b) -> (a || b); BinaryOperator<Boolean> bo = (a,b) -> (a || b);
if (lfBounded.stream().reduce(false,f,bo)) continue; //F-Bounded Endlosrekursion if (lfBounded.stream().reduce(false,f,bo)) {
paramCandidates.add(grArg(t.getTypeParams().get(i), new HashSet<>(fBounded) )); //F-Bounded Endlosrekursion
HashSet<UnifyType> res = new HashSet<UnifyType>();
paramCandidates.add(res);
}
else {
paramCandidates.add(grArg(t.getTypeParams().get(i), new HashSet<>(fBounded) ));
}
} }
permuteParams(paramCandidates).forEach(x -> result.add(t.setTypeParams(x))); permuteParams(paramCandidates).forEach(x -> result.add(t.setTypeParams(x)));
//System.out.println("");
} }
} }
return result; return result;

View File

@ -15,9 +15,9 @@ class Matrix extends Vector<Vector<Integer>> {
var erg = 0; var erg = 0;
var k = 0; var k = 0;
while(k < v1.size()) { while(k < v1.size()) {
//erg = erg + v1.elementAt(k) * m.elementAt(k).elementAt(j); erg = erg + v1.elementAt(k) * m.elementAt(k).elementAt(j);
erg = add1(erg, mul1(v1.elementAt(k), // erg = add1(erg, mul1(v1.elementAt(k),
m.elementAt(k).elementAt(j))); // m.elementAt(k).elementAt(j)));
k++; } k++; }
v2.addElement(new Integer(erg)); v2.addElement(new Integer(erg));
j++; } j++; }