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

modified:   ../../src/de/dhbwstuttgart/typeinference/unify/model/OrderingUnifyPair.java
	modified:   ../javFiles/Matrix.jav
mul1 und add ergaenzt.
Fehler bei elementAt: Liefert Object als Returntyp
This commit is contained in:
Martin Plümicke 2018-03-13 08:46:25 +01:00
parent 1667b394f2
commit 13c70148a8
3 changed files with 10 additions and 4 deletions

View File

@ -362,7 +362,10 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
}
if (!result.isEmpty()) {
if (variance == 1) {
if (a.equals(a_next) || (oup.compare(a, a_next) == 1)) {
if (a.iterator().next().getLhsType().getName().equals("WL"))
System.out.print("");
if (a.equals(a_next) ||
(oup.compare(a, a_next) == 1)) {
System.out.print("");
break;
}

View File

@ -117,7 +117,8 @@ public class OrderingUnifyPair extends Ordering<Set<UnifyPair>> {
Stream<UnifyPair> rseq = righteq.stream(); //right.filter(x -> (x.getLhsType() instanceof PlaceholderType && x.getPairOp() == PairOperator.EQUALSDOT));
BinaryOperator<HashMap<UnifyType,UnifyPair>> combiner = (x,y) -> { x.putAll(y); return x;};
HashMap<UnifyType,UnifyPair> hm = rseq.reduce(new HashMap<UnifyType,UnifyPair>(), (x, y)-> { x.put(y.getLhsType(),y); return x; }, combiner);
lseq = lseq.filter(x -> !(hm.get(x.getLhsType()) == null));
lseq = lseq.filter(x -> !(hm.get(x.getLhsType()) == null));//NOCHMALS UEBERPRUEFEN!!!!
lseq = lseq.filter(x -> !x.equals(hm.get(x.getLhsType()))); //Elemente die gleich sind muessen nicht verglichen werden
Optional<Integer> si = lseq.map(x -> compareEq(x, hm.get(x.getLhsType()))).reduce((x,y)-> { if (x == y) return x; else return 0; } );
if (!si.isPresent()) return 0;
else return si.get();

View File

@ -3,6 +3,8 @@ import java.lang.Integer;
import java.lang.Boolean;
class Matrix extends Vector<Vector<Integer>> {
Integer mul1(Integer x, Integer y) { return x;}
Integer add(Integer x, Integer y) { return x;}
mul(m) {
var ret = new Matrix();
var i = 0;
@ -14,8 +16,8 @@ class Matrix extends Vector<Vector<Integer>> {
var erg = 0;
var k = 0;
while(k < v1.size()) {
erg = erg + v1.elementAt(k)
* m.elementAt(k).elementAt(j);
erg = add(erg, mul1(v1.elementAt(k),
m.elementAt(k).elementAt(j)));
k++; }
v2.addElement(new Integer(erg));
j++; }