forked from JavaTX/JavaCompilerCore
FC enthält Supertklassen
This commit is contained in:
parent
d636d29ab5
commit
ab20e2c5e8
11
src/de/dhbwstuttgart/typeinference/unify/Unifier.java
Normal file
11
src/de/dhbwstuttgart/typeinference/unify/Unifier.java
Normal 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);
|
||||||
|
|
||||||
|
}
|
35
test/plugindevelopment/TypeInsertTests/TypedMatrixTest.jav
Normal file
35
test/plugindevelopment/TypeInsertTests/TypedMatrixTest.jav
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
16
test/plugindevelopment/TypeInsertTests/TypedMatrixTest.java
Normal file
16
test/plugindevelopment/TypeInsertTests/TypedMatrixTest.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user