From ab20e2c5e8b8b0d2546a3325a188cffc2a5fe185 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Wed, 1 Oct 2014 17:13:08 +0200 Subject: [PATCH] =?UTF-8?q?FC=20enth=C3=A4lt=20Supertklassen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../typeinference/unify/Unifier.java | 11 ++++++ .../TypeInsertTests/TypedMatrixTest.jav | 35 +++++++++++++++++++ .../TypeInsertTests/TypedMatrixTest.java | 16 +++++++++ 3 files changed, 62 insertions(+) create mode 100644 src/de/dhbwstuttgart/typeinference/unify/Unifier.java create mode 100644 test/plugindevelopment/TypeInsertTests/TypedMatrixTest.jav create mode 100644 test/plugindevelopment/TypeInsertTests/TypedMatrixTest.java diff --git a/src/de/dhbwstuttgart/typeinference/unify/Unifier.java b/src/de/dhbwstuttgart/typeinference/unify/Unifier.java new file mode 100644 index 00000000..73478957 --- /dev/null +++ b/src/de/dhbwstuttgart/typeinference/unify/Unifier.java @@ -0,0 +1,11 @@ +package de.dhbwstuttgart.typeinference.unify; + +import java.util.Vector; + +import de.dhbwstuttgart.typeinference.Pair; + +public interface Unifier { + + public Vector> unify (Vector E); + +} diff --git a/test/plugindevelopment/TypeInsertTests/TypedMatrixTest.jav b/test/plugindevelopment/TypeInsertTests/TypedMatrixTest.jav new file mode 100644 index 00000000..f2c5c3f5 --- /dev/null +++ b/test/plugindevelopment/TypeInsertTests/TypedMatrixTest.jav @@ -0,0 +1,35 @@ +import java.util.Vector; + +class Matrix extends Vector> { + + Matrix mul(Matrix m){ + Matrix ret; + ret = new Matrix(); + Integer i; + i = 0; + while(i < this.size()) { + Vector v1; + Vector v2; + v1 = this.elementAt(i); + v2 = new Vector(); + 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; + } + +} \ No newline at end of file diff --git a/test/plugindevelopment/TypeInsertTests/TypedMatrixTest.java b/test/plugindevelopment/TypeInsertTests/TypedMatrixTest.java new file mode 100644 index 00000000..810af999 --- /dev/null +++ b/test/plugindevelopment/TypeInsertTests/TypedMatrixTest.java @@ -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 mustContain = new Vector(); + mustContain.add("Integer erg;"); + MultipleTypesInsertTester.testSingleInsert(this.TEST_FILE, mustContain); + } +}