FC enthält Supertklassen

This commit is contained in:
JanUlrich 2014-10-01 17:13:08 +02:00
parent d636d29ab5
commit ab20e2c5e8
3 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,11 @@
package de.dhbwstuttgart.typeinference.unify;
import java.util.Vector;
import de.dhbwstuttgart.typeinference.Pair;
public interface Unifier {
public Vector<Vector<Pair>> unify (Vector<Pair> E);
}

View File

@ -0,0 +1,35 @@
import java.util.Vector;
class Matrix extends Vector<Vector<Integer>> {
Matrix mul(Matrix m){
Matrix ret;
ret = new Matrix();
Integer i;
i = 0;
while(i < this.size()) {
Vector<Integer> v1;
Vector<Integer> v2;
v1 = this.elementAt(i);
v2 = new Vector<Integer>();
Integer j;
j = 0;
while(j < this.size()) {
erg;
erg = 0;
Integer k;
k = 0;
while(k < v1.size()) {
erg = erg + v1.elementAt(k).intValue() * m.elementAt(k).elementAt(j).intValue();
k++;
}
v2.addElement(new Integer(erg));
j++;
}
ret.addElement(v2);
i++;
}
return ret;
}
}

View File

@ -0,0 +1,16 @@
package plugindevelopment.TypeInsertTests;
import java.util.Vector;
import org.junit.Test;
public class TypedMatrixTest {
private static final String TEST_FILE = "TypedMatrixTest.jav";
@Test
public void run(){
Vector<String> mustContain = new Vector<String>();
mustContain.add("Integer erg;");
MultipleTypesInsertTester.testSingleInsert(this.TEST_FILE, mustContain);
}
}