Compare commits
4 Commits
LSP-Interf
...
KPS2025
Author | SHA1 | Date | |
---|---|---|---|
|
db040d590e | ||
|
f496ff13b8 | ||
|
642ecc9a50 | ||
|
a0e59eebe8 |
9
resources/KPSPresentation/AddEle.jav
Normal file
9
resources/KPSPresentation/AddEle.jav
Normal file
@@ -0,0 +1,9 @@
|
||||
import java.util.Vector;
|
||||
import java.util.Collection;
|
||||
|
||||
class AddEle {
|
||||
addEle(x, y) {
|
||||
x.add(y);
|
||||
return x;
|
||||
}
|
||||
}
|
15
resources/KPSPresentation/Fac.jav
Normal file
15
resources/KPSPresentation/Fac.jav
Normal file
@@ -0,0 +1,15 @@
|
||||
import java.lang.Double;
|
||||
import java.lang.Integer;
|
||||
|
||||
public class Fac {
|
||||
|
||||
getFac(n){
|
||||
var res = 1;
|
||||
var i = 1;
|
||||
while(i<=n) {
|
||||
res = res * i;
|
||||
i++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
18
resources/KPSPresentation/Faculty.jav
Normal file
18
resources/KPSPresentation/Faculty.jav
Normal file
@@ -0,0 +1,18 @@
|
||||
import java.lang.Integer;
|
||||
import java.lang.Float;
|
||||
|
||||
public class Faculty {
|
||||
public Fun1$$<Integer, Integer> fact = (x) -> {
|
||||
if (x == 1) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return x * (fact.apply(x-1));
|
||||
}
|
||||
};
|
||||
|
||||
public getFact(x) {
|
||||
return fact.apply(x);
|
||||
}
|
||||
|
||||
}
|
18
resources/KPSPresentation/FacultyBug.jav
Normal file
18
resources/KPSPresentation/FacultyBug.jav
Normal file
@@ -0,0 +1,18 @@
|
||||
import java.lang.Integer;
|
||||
import java.lang.Float;
|
||||
|
||||
public class FacultyBug {
|
||||
public Fun1$$<Float, Float> fact = (x) -> {
|
||||
if (x == 1) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return x * (fact.apply(x-1));
|
||||
}
|
||||
};
|
||||
|
||||
public getFact(x) {
|
||||
return fact.apply(x);
|
||||
}
|
||||
|
||||
}
|
11
resources/KPSPresentation/Id.jav
Normal file
11
resources/KPSPresentation/Id.jav
Normal file
@@ -0,0 +1,11 @@
|
||||
class Id {
|
||||
id2 = x -> x;
|
||||
|
||||
id(x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
id3(x) {
|
||||
return id(x);
|
||||
}
|
||||
}
|
11
resources/KPSPresentation/Lambda.jav
Normal file
11
resources/KPSPresentation/Lambda.jav
Normal file
@@ -0,0 +1,11 @@
|
||||
import java.lang.Integer;
|
||||
|
||||
public class Lambda {
|
||||
|
||||
m () {
|
||||
var lam1 = (x) -> {
|
||||
return x * x;
|
||||
};
|
||||
return lam1;
|
||||
}
|
||||
}
|
105
resources/KPSPresentation/Main.jav
Normal file
105
resources/KPSPresentation/Main.jav
Normal file
@@ -0,0 +1,105 @@
|
||||
import java.lang.String ;
|
||||
import java.lang.System;
|
||||
import java.io.PrintStream;
|
||||
import java.lang.Character;
|
||||
import java.lang.Object;
|
||||
import java.lang.Integer;
|
||||
import fst;
|
||||
import Id;
|
||||
import OLMain;
|
||||
import Fac;
|
||||
import Faculty;
|
||||
import applyLambda;
|
||||
import java.util.Vector;
|
||||
import Matrix;
|
||||
|
||||
public class Main {
|
||||
public static main(x) {
|
||||
/*
|
||||
new fst().main(5);
|
||||
System.out.println(new fst().main(5));
|
||||
|
||||
//Id.jav: the identity-function
|
||||
//applied to an integer
|
||||
System.out.println(new Id().id(1));
|
||||
//applied to a string
|
||||
System.out.println(new Id().id("hallo"));
|
||||
//lamda-Expr
|
||||
//System.out.println(new Id().id2.apply(1));
|
||||
//Bug: https://gitea.hb.dhbw-stuttgart.de/JavaTX/JavaCompilerCore/issues/378
|
||||
|
||||
//OL.jav: Overloading
|
||||
OLMain ol = new OLMain();
|
||||
|
||||
//the function main is applied to an integer
|
||||
System.out.println(ol.main(2));
|
||||
//the main is applied to a double
|
||||
System.out.println(ol.main(2.0));
|
||||
System.out.println(ol.main("Hallo"));
|
||||
//Fac.jav
|
||||
System.out.println(new Fac().getFac(6));
|
||||
|
||||
|
||||
//Faculty.jav
|
||||
//System.out.println(new Faculty().fact.apply(6));
|
||||
//Bug: https://gitea.hb.dhbw-stuttgart.de/JavaTX/JavaCompilerCore/issues/378
|
||||
System.out.println(new Faculty().getFact(3));
|
||||
|
||||
//Lambda.jav: An lambda expression applied by the method apply
|
||||
//System.out.println(new Lambda().m().apply(77));
|
||||
//Bug: https://gitea.hb.dhbw-stuttgart.de/JavaTX/JavaCompilerCore/issues/378
|
||||
|
||||
//applyLambda.jav: A defined lambda expression is applied
|
||||
System.out.println(new applyLambda().m());
|
||||
*/
|
||||
Vector<Vector<Integer>> vv = new Vector<Vector<Integer>>();
|
||||
Vector<Integer> v1 = new Vector<Integer> ();
|
||||
v1.addElement(2);
|
||||
v1.addElement(2);
|
||||
Vector<Integer> v2 = new Vector<Integer> ();
|
||||
v2.addElement(3);
|
||||
v2.addElement(3);
|
||||
Matrix m1 = new Matrix();
|
||||
m1.addElement(v1);
|
||||
m1.addElement(v2);
|
||||
//vv.addElement(v1);
|
||||
//vv.addElement(v2);
|
||||
//Matrix m1 = new Matrix(vv);
|
||||
|
||||
Vector<Vector<Integer>> vv1 = new Vector<Vector<Integer>>();
|
||||
Vector<Integer> v3 = new Vector<Integer> ();
|
||||
v3.addElement(2);
|
||||
v3.addElement(2);
|
||||
Vector<Integer> v4 = new Vector<Integer> ();
|
||||
v4.addElement(3);
|
||||
v4.addElement(3);
|
||||
Matrix m2 = new Matrix();
|
||||
m2.addElement(v3);
|
||||
m2.addElement(v4);
|
||||
//vv1.addElement(v3);
|
||||
//vv1.addElement(v4);
|
||||
//Matrix m2 = new Matrix(vv1);
|
||||
|
||||
|
||||
//Matrix m3 = m1.mul(vv1);
|
||||
Matrix m3 = m1.mul(m2);
|
||||
System.out.println(m1.toString() + " * " + m2.toString() + " = " + m3.toString());
|
||||
/*
|
||||
//MatrixOP
|
||||
MatrixOP mOp1 = new MatrixOP();
|
||||
mOp1.addElement(v1);
|
||||
mOp1.addElement(v2);
|
||||
MatrixOP mOp2 = mOp1.mul.apply(mOp1, mOp1);
|
||||
System.out.println(m1.toString() + " * " + m2.toString() + " = " + mOp2.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public class MainBug {
|
||||
public static main(x) {
|
||||
System.out.println(new fst().main(5));
|
||||
//System.out.println(new FacultyBug().getFact(3));
|
||||
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
41
resources/KPSPresentation/Matrix.jav
Normal file
41
resources/KPSPresentation/Matrix.jav
Normal file
@@ -0,0 +1,41 @@
|
||||
import java.util.Vector;
|
||||
import java.lang.Integer;
|
||||
import java.lang.Boolean;
|
||||
|
||||
public class Matrix extends Vector<Vector<Integer>> {
|
||||
|
||||
|
||||
public Matrix () {
|
||||
}
|
||||
|
||||
public Matrix(vv) {
|
||||
var i = 0;
|
||||
while(i < vv.size()) {
|
||||
this.add(vv.elementAt(i));
|
||||
i=i+1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mul(m) {
|
||||
var ret = new Matrix();
|
||||
var i = 0;
|
||||
while(i < size()) {
|
||||
var v1 = this.elementAt(i);
|
||||
var v2 = new Vector<Integer>();
|
||||
var j = 0;
|
||||
while(j < v1.size()) {
|
||||
var erg = 0;
|
||||
var k = 0;
|
||||
while(k < v1.size()) {
|
||||
erg = erg + v1.elementAt(k)
|
||||
* m.elementAt(k).elementAt(j);
|
||||
k++; }
|
||||
v2.addElement(erg);
|
||||
j++; }
|
||||
ret.addElement(v2);
|
||||
i++;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
42
resources/KPSPresentation/MatrixOP.jav
Normal file
42
resources/KPSPresentation/MatrixOP.jav
Normal file
@@ -0,0 +1,42 @@
|
||||
import java.util.Vector;
|
||||
import java.lang.Integer;
|
||||
import java.lang.Byte;
|
||||
import java.lang.Boolean;
|
||||
|
||||
public class MatrixOP extends Vector<Vector<Integer>> {
|
||||
|
||||
MatrixOP () {
|
||||
}
|
||||
|
||||
MatrixOP(vv) {
|
||||
Integer i;
|
||||
i = 0;
|
||||
while(i < vv.size()) {
|
||||
this.add(vv.elementAt(i));
|
||||
i=i+1;
|
||||
}
|
||||
}
|
||||
|
||||
Fun2$$<Vector<? extends Vector<? extends Integer>>, Vector<? extends Vector<? extends Integer>>, MatrixOP> mul = (m1, m2) -> {
|
||||
var ret = new MatrixOP();
|
||||
var i = 0;
|
||||
while(i < m1.size()) {
|
||||
var v1 = m1.elementAt(i);
|
||||
var v2 = new Vector<Integer>();
|
||||
var j = 0;
|
||||
while(j < v1.size()) {
|
||||
var erg = 0;
|
||||
var k = 0;
|
||||
while(k < v1.size()) {
|
||||
erg = erg + v1.elementAt(k)
|
||||
* m2.elementAt(k).elementAt(j);
|
||||
k++; }
|
||||
// v2.addElement(new Integer(erg));
|
||||
v2.addElement(erg);
|
||||
j++; }
|
||||
ret.addElement(v2);
|
||||
i++;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}
|
30
resources/KPSPresentation/OL.jav
Normal file
30
resources/KPSPresentation/OL.jav
Normal file
@@ -0,0 +1,30 @@
|
||||
import java.lang.String;
|
||||
import java.lang.Integer;
|
||||
import java.lang.Double;
|
||||
import java.lang.Boolean;
|
||||
import java.lang.Object;
|
||||
|
||||
|
||||
|
||||
|
||||
class OL {
|
||||
|
||||
m(x) { return x + x; }
|
||||
|
||||
|
||||
m(x) { return x || x; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class OLMain {
|
||||
|
||||
main(x) {
|
||||
var ol;
|
||||
ol = new OL();
|
||||
return ol.m(x);
|
||||
}
|
||||
}
|
||||
|
20
resources/KPSPresentation/OLFun.jav
Normal file
20
resources/KPSPresentation/OLFun.jav
Normal file
@@ -0,0 +1,20 @@
|
||||
import java.lang.String;
|
||||
import java.lang.Integer;
|
||||
import java.lang.Double;
|
||||
import java.util.Vector;
|
||||
import java.lang.Boolean;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class OLFun {
|
||||
x;
|
||||
|
||||
|
||||
m(f, y) {
|
||||
y = f.apply(x+x);
|
||||
return x;
|
||||
}
|
||||
|
||||
}
|
12
resources/KPSPresentation/Pair.jav
Normal file
12
resources/KPSPresentation/Pair.jav
Normal file
@@ -0,0 +1,12 @@
|
||||
class Pair {
|
||||
fst;
|
||||
snd;
|
||||
|
||||
Pair(fst, snd) { this.fst=fst; this.snd=snd; }
|
||||
|
||||
getfst() { return this.fst; }
|
||||
|
||||
swap() {
|
||||
return new Pair<>(this.snd, this.fst);
|
||||
}
|
||||
}
|
9
resources/KPSPresentation/Plus.jav
Normal file
9
resources/KPSPresentation/Plus.jav
Normal file
@@ -0,0 +1,9 @@
|
||||
import java.lang.Integer;
|
||||
import java.lang.String;
|
||||
|
||||
public class Plus {
|
||||
|
||||
m(a, b) {
|
||||
return a+b;
|
||||
}
|
||||
}
|
25
resources/KPSPresentation/Sorting.jav
Normal file
25
resources/KPSPresentation/Sorting.jav
Normal file
@@ -0,0 +1,25 @@
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.lang.String;
|
||||
|
||||
public class Sorting{
|
||||
merge(a, b){
|
||||
a.addAll(b);
|
||||
return a;
|
||||
}
|
||||
|
||||
|
||||
sort(in){
|
||||
var firstHalf = in;
|
||||
var secondHalf = in;
|
||||
return merge(sort(firstHalf), sort(secondHalf));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
void sort(a){
|
||||
a = merge(a,a);
|
||||
}
|
||||
*/
|
||||
}
|
20
resources/KPSPresentation/Swap.jav
Normal file
20
resources/KPSPresentation/Swap.jav
Normal file
@@ -0,0 +1,20 @@
|
||||
import java.lang.String;
|
||||
import java.lang.Object;
|
||||
import java.lang.System;
|
||||
import java.io.PrintStream;
|
||||
import java.lang.Character;
|
||||
|
||||
public class Swap{
|
||||
<ZDP, ZEA, ZDO, YZP, ZCY, ZDZ> Fun1$$<ZCY, Fun1$$<ZDZ, ZEA>> swap(f){
|
||||
return x->y->f.apply(y).apply(x);
|
||||
}
|
||||
|
||||
Fun1$$<String, Fun1$$<String, Fun1$$<String, String>>> swap(f){
|
||||
return x -> y -> z -> f.apply(z).apply(x).apply(y);
|
||||
}
|
||||
|
||||
public static main (y) {
|
||||
var func = x -> y -> z -> x + y + z;
|
||||
var res = new Swap().swap(func).apply("A").apply("B").apply("C");
|
||||
System.out.println(res);}
|
||||
}
|
6
resources/KPSPresentation/TPHMethod.jav
Normal file
6
resources/KPSPresentation/TPHMethod.jav
Normal file
@@ -0,0 +1,6 @@
|
||||
class TPHMethod {
|
||||
void m(a, b) {
|
||||
a = b;
|
||||
b=a;
|
||||
}
|
||||
}
|
16
resources/KPSPresentation/Test.jav
Normal file
16
resources/KPSPresentation/Test.jav
Normal file
@@ -0,0 +1,16 @@
|
||||
class Test{
|
||||
void m( op, a, b ){
|
||||
op.myapply(a, b);
|
||||
}
|
||||
}
|
||||
|
||||
class Atype{}
|
||||
class Btype{}
|
||||
|
||||
class Operator1{
|
||||
void myapply(Atype p1, Atype p2){...}
|
||||
}
|
||||
|
||||
class Operator2{
|
||||
void myapply(Btype p1, Btype p2){...}
|
||||
}
|
7
resources/KPSPresentation/Uncurrier.jav
Normal file
7
resources/KPSPresentation/Uncurrier.jav
Normal file
@@ -0,0 +1,7 @@
|
||||
public class Uncurrier{
|
||||
uncurry (f){
|
||||
return x -> f.apply(x);}
|
||||
uncurry (f){
|
||||
return (x, y) -> f.apply(x).apply(y);
|
||||
}
|
||||
}
|
7
resources/KPSPresentation/UncurrierMain.jav
Normal file
7
resources/KPSPresentation/UncurrierMain.jav
Normal file
@@ -0,0 +1,7 @@
|
||||
import Uncurrier;
|
||||
|
||||
class UncurrierMain {
|
||||
public static main(x) {
|
||||
var uc = new Uncurrier() ;
|
||||
}
|
||||
}
|
16
resources/KPSPresentation/VectorAdd.jav
Normal file
16
resources/KPSPresentation/VectorAdd.jav
Normal file
@@ -0,0 +1,16 @@
|
||||
import java.lang.Integer;
|
||||
import java.lang.String;
|
||||
import java.util.Vector;
|
||||
|
||||
class VectorAdd {
|
||||
vectorAdd(v1, v2) {
|
||||
var i = 0;
|
||||
var erg = new Vector<>();
|
||||
while (i < v1.size()) {
|
||||
erg.addElement(v1.elementAt(i) + v2.elementAt(i));
|
||||
i++;
|
||||
}
|
||||
return erg;
|
||||
}
|
||||
}
|
||||
|
16
resources/KPSPresentation/applyLambda.jav
Normal file
16
resources/KPSPresentation/applyLambda.jav
Normal file
@@ -0,0 +1,16 @@
|
||||
import java.util.Vector;
|
||||
class Apply { }
|
||||
|
||||
public class applyLambda {
|
||||
|
||||
public m () {
|
||||
var lam1 = (x) -> {
|
||||
return x;
|
||||
};
|
||||
|
||||
return lam1.apply(new Apply());
|
||||
//return lam1;
|
||||
//return new Vector();
|
||||
}
|
||||
}
|
||||
|
7
resources/KPSPresentation/fst.jav
Normal file
7
resources/KPSPresentation/fst.jav
Normal file
@@ -0,0 +1,7 @@
|
||||
//import java.lang.Integer;
|
||||
|
||||
class fst {
|
||||
main(x) {
|
||||
return x;
|
||||
}
|
||||
}
|
8
resources/KPSPresentation/genVector.jav
Normal file
8
resources/KPSPresentation/genVector.jav
Normal file
@@ -0,0 +1,8 @@
|
||||
import java.util.Vector;
|
||||
|
||||
class genVector {
|
||||
|
||||
m(v) {
|
||||
return v.elementAt(0);
|
||||
}
|
||||
}
|
8
resources/KPSPresentation/idTest.jav
Normal file
8
resources/KPSPresentation/idTest.jav
Normal file
@@ -0,0 +1,8 @@
|
||||
import java.lang.Integer;
|
||||
import Id;
|
||||
|
||||
class Test {
|
||||
m() {
|
||||
Integer o1 = new Id<Integer,Integer>().id2.apply(1);
|
||||
}
|
||||
}
|
9
resources/KPSPresentation/lambdaId.jav
Normal file
9
resources/KPSPresentation/lambdaId.jav
Normal file
@@ -0,0 +1,9 @@
|
||||
public class lambdaId {
|
||||
lambdaId = x -> x;
|
||||
|
||||
/*
|
||||
id3 (x) {
|
||||
return lambdaId.apply(x);
|
||||
}
|
||||
*/
|
||||
}
|
9
resources/KPSPresentation/mathStruc.jav
Normal file
9
resources/KPSPresentation/mathStruc.jav
Normal file
@@ -0,0 +1,9 @@
|
||||
class mathStruc {
|
||||
model;
|
||||
|
||||
innerOp = (o) -> (ms) -> new mathStruc<>(o.apply(model,ms.model));
|
||||
|
||||
mathStruc(m) {
|
||||
model =m;
|
||||
}
|
||||
}
|
18
resources/KPSPresentation/mathStrucInteger.jav
Normal file
18
resources/KPSPresentation/mathStrucInteger.jav
Normal file
@@ -0,0 +1,18 @@
|
||||
import java.lang.Integer;
|
||||
|
||||
class mathStruc {
|
||||
model;
|
||||
|
||||
innerOp = (o) -> (ms) -> new mathStruc<>(o.apply(model,ms.model));
|
||||
|
||||
mathStruc(m) {
|
||||
model =m;
|
||||
}
|
||||
}
|
||||
|
||||
class mathStrucIntegerUse {
|
||||
main() {
|
||||
var ms = new mathStruc<>(2);
|
||||
return ms.innerOp.apply((x,y) -> x+y).apply(ms);
|
||||
}
|
||||
}
|
90
resources/KPSPresentation/mathStrucMatrixOP.jav
Normal file
90
resources/KPSPresentation/mathStrucMatrixOP.jav
Normal file
@@ -0,0 +1,90 @@
|
||||
import java.util.Vector;
|
||||
import java.lang.Integer;
|
||||
import java.lang.Boolean;
|
||||
|
||||
public class mathStrucMatrixOP {
|
||||
model;
|
||||
|
||||
innerOp = (o) -> (ms) -> new mathStrucMatrixOP<>(o.apply(model,ms.model));
|
||||
|
||||
public mathStrucMatrixOP(m) {
|
||||
model =m;
|
||||
}
|
||||
}
|
||||
|
||||
public class MatrixOP extends Vector<Vector<Integer>> {
|
||||
|
||||
MatrixOP () {
|
||||
}
|
||||
|
||||
MatrixOP(vv) {
|
||||
Integer i;
|
||||
i = 0;
|
||||
while(i < vv.size()) {
|
||||
// Boolean a = this.add(vv.elementAt(i));
|
||||
this.add(vv.elementAt(i));
|
||||
i=i+1;
|
||||
}
|
||||
}
|
||||
|
||||
public mul = (m1, m2) -> {
|
||||
var ret = new MatrixOP();
|
||||
var i = 0;
|
||||
while(i < m1.size()) {
|
||||
var v1 = m1.elementAt(i);
|
||||
var v2 = new Vector<Integer>();
|
||||
var j = 0;
|
||||
while(j < v1.size()) {
|
||||
var erg = 0;
|
||||
var k = 0;
|
||||
while(k < v1.size()) {
|
||||
erg = erg + v1.elementAt(k)
|
||||
* m2.elementAt(k).elementAt(j);
|
||||
k++; }
|
||||
// v2.addElement(new Integer(erg));
|
||||
v2.addElement(erg);
|
||||
j++; }
|
||||
ret.addElement(v2);
|
||||
i++;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class mathStrucUseMatrixOP {
|
||||
|
||||
main() {
|
||||
Vector<Vector<Integer>> vv = new Vector<Vector<Integer>>();
|
||||
Vector<Integer> v1 = new Vector<Integer>();
|
||||
v1.addElement(2);
|
||||
v1.addElement(2);
|
||||
Vector<Integer> v2 = new Vector<Integer>();
|
||||
v2.addElement(3);
|
||||
v2.addElement(3);
|
||||
vv.addElement(v1);
|
||||
vv.addElement(v2);
|
||||
|
||||
MatrixOP m1 = new MatrixOP(vv);
|
||||
|
||||
Vector<Vector<Integer>> vv1 = new Vector<Vector<Integer>>();
|
||||
Vector<Integer> v3 = new Vector<Integer>();
|
||||
v3.addElement(2);
|
||||
v3.addElement(2);
|
||||
Vector<Integer> v4 = new Vector<Integer>();
|
||||
v4.addElement(3);
|
||||
v4.addElement(3);
|
||||
vv1.addElement(v3);
|
||||
vv1.addElement(v4);
|
||||
|
||||
MatrixOP m2 = new MatrixOP(vv1);
|
||||
|
||||
var mms;
|
||||
mms = new mathStrucMatrixOP<>(m1);
|
||||
var mms2;
|
||||
mms2 = new mathStrucMatrixOP<>(m2);
|
||||
var mms3;
|
||||
mms3 = mms.innerOp.apply(m1.mul).apply(mms2);
|
||||
return mms3;
|
||||
}
|
||||
}
|
14
resources/KPSPresentation/test1.jav
Normal file
14
resources/KPSPresentation/test1.jav
Normal file
@@ -0,0 +1,14 @@
|
||||
import java.lang.String;
|
||||
import java.lang.Boolean;
|
||||
import java.lang.Integer;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class testclass{
|
||||
|
||||
public testMethod(ele){
|
||||
if(ele){
|
||||
return 1;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
@@ -2,6 +2,7 @@ import java.util.Vector;
|
||||
import java.lang.Integer;
|
||||
//import java.lang.Byte;
|
||||
import java.lang.Boolean;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public class MatrixOP extends Vector<Vector<Integer>> {
|
||||
|
||||
|
@@ -6,7 +6,6 @@ import de.dhbwstuttgart.bytecode.FunNGenerator;
|
||||
import de.dhbwstuttgart.environment.CompilationEnvironment;
|
||||
import de.dhbwstuttgart.environment.DirectoryClassLoader;
|
||||
import de.dhbwstuttgart.exceptions.DebugException;
|
||||
import de.dhbwstuttgart.languageServerInterface.model.LanguageServerTransferObject;
|
||||
import de.dhbwstuttgart.parser.JavaTXParser;
|
||||
import de.dhbwstuttgart.parser.NullToken;
|
||||
import de.dhbwstuttgart.parser.scope.GenericsRegistry;
|
||||
@@ -476,85 +475,6 @@ public class JavaTXCompiler {
|
||||
return results.stream().map((unifyPairs -> new ResultSet(UnifyTypeFactory.convert(unifyPairs, Pair.generateTPHMap(cons))))).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* TEMPORARY - Only for Language Server Usage
|
||||
*/
|
||||
public LanguageServerTransferObject getResultSetAndAbstractSyntax(File file) throws IOException, ClassNotFoundException {
|
||||
var sf = sourceFiles.get(file);
|
||||
if(sf == null){
|
||||
sf = sourceFiles.values().stream().findFirst().get();
|
||||
}
|
||||
Set<ClassOrInterface> allClasses = new HashSet<>();
|
||||
allClasses.addAll(getAvailableClasses(sf));
|
||||
allClasses.addAll(sf.getClasses());
|
||||
var newClasses = CompilationEnvironment.loadDefaultPackageClasses(sf.getPkgName(), file, this).stream().map(ASTFactory::createClass).collect(Collectors.toSet());
|
||||
for (var clazz : newClasses) {
|
||||
// Don't load classes that get recompiled
|
||||
if (sf.getClasses().stream().anyMatch(nf -> nf.getClassName().equals(clazz.getClassName())))
|
||||
continue;
|
||||
if (allClasses.stream().noneMatch(old -> old.getClassName().equals(clazz.getClassName())))
|
||||
allClasses.add(clazz);
|
||||
}
|
||||
|
||||
final ConstraintSet<Pair> cons = getConstraints(file);
|
||||
Set<Set<UnifyPair>> results = new HashSet<>();
|
||||
try {
|
||||
Writer logFile = new OutputStreamWriter(new NullOutputStream());
|
||||
IFiniteClosure finiteClosure = UnifyTypeFactory.generateFC(allClasses.stream().toList(), logFile, classLoader, this);
|
||||
ConstraintSet<UnifyPair> unifyCons = UnifyTypeFactory.convert(this, cons);
|
||||
Function<UnifyPair, UnifyPair> distributeInnerVars = x -> {
|
||||
UnifyType lhs, rhs;
|
||||
if (((lhs = x.getLhsType()) instanceof PlaceholderType) && ((rhs = x.getRhsType()) instanceof PlaceholderType) && (((PlaceholderType) lhs).isInnerType() || ((PlaceholderType) rhs).isInnerType())) {
|
||||
((PlaceholderType) lhs).setInnerType(true);
|
||||
((PlaceholderType) rhs).setInnerType(true);
|
||||
}
|
||||
return x;
|
||||
|
||||
};
|
||||
|
||||
|
||||
unifyCons = unifyCons.map(distributeInnerVars);
|
||||
TypeUnify unify = new TypeUnify();
|
||||
Set<PlaceholderType> varianceTPHold;
|
||||
Set<PlaceholderType> varianceTPH = new HashSet<>();
|
||||
varianceTPH = varianceInheritanceConstraintSet(unifyCons);
|
||||
|
||||
List<Set<Constraint<UnifyPair>>> oderConstraints = unifyCons.getOderConstraints();
|
||||
|
||||
if (resultmodel) {
|
||||
/* UnifyResultModel Anfang */
|
||||
UnifyResultModel urm = new UnifyResultModel(cons, finiteClosure);
|
||||
UnifyResultListenerImpl li = new UnifyResultListenerImpl();
|
||||
urm.addUnifyResultListener(li);
|
||||
unify.unifyParallel(unifyCons.getUndConstraints(), oderConstraints, finiteClosure, logFile, log, urm, usedTasks);
|
||||
generateBytecode(sf, li.getResults());
|
||||
return new LanguageServerTransferObject(li.getResults(), sf, ASTTypePrinter.print(sf), generatedGenerics);
|
||||
}
|
||||
/* UnifyResultModel End */
|
||||
else {
|
||||
Set<Set<UnifyPair>> result = unify.unifyOderConstraints(unifyCons.getUndConstraints(), oderConstraints, finiteClosure, logFile, log, new UnifyResultModel(cons, finiteClosure), usedTasks);
|
||||
results.addAll(result);
|
||||
|
||||
results = results.stream().map(x -> {
|
||||
Optional<Set<UnifyPair>> res = new RuleSet().subst(x.stream().map(y -> {
|
||||
if (y.getPairOp() == PairOperator.SMALLERDOTWC)
|
||||
y.setPairOp(PairOperator.EQUALSDOT);
|
||||
return y; // alle Paare a <.? b erden durch a =. b ersetzt
|
||||
}).collect(Collectors.toCollection(HashSet::new)));
|
||||
if (res.isPresent()) {// wenn subst ein Erg liefert wurde was veraendert
|
||||
return new TypeUnifyTask().applyTypeUnificationRules(res.get(), finiteClosure);
|
||||
} else
|
||||
return x; // wenn nichts veraendert wurde wird x zurueckgegeben
|
||||
}).collect(Collectors.toCollection(HashSet::new));
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
}
|
||||
generateBytecode(sf, results.stream().map((unifyPairs -> new ResultSet(UnifyTypeFactory.convert(unifyPairs, Pair.generateTPHMap(cons))))).collect(Collectors.toList()));
|
||||
return new LanguageServerTransferObject(results.stream().map((unifyPairs -> new ResultSet(UnifyTypeFactory.convert(unifyPairs, Pair.generateTPHMap(cons))))).collect(Collectors.toList()), sf, ASTTypePrinter.print(sf), generatedGenerics);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Vererbt alle Variancen bei Paaren (a <. theta) oder (Theta <. a) wenn a eine Variance !=0 hat auf alle Typvariablen in Theta.
|
||||
*
|
||||
|
@@ -1,120 +0,0 @@
|
||||
package de.dhbwstuttgart.languageServerInterface;
|
||||
|
||||
|
||||
import de.dhbwstuttgart.bytecode.Codegen;
|
||||
import de.dhbwstuttgart.core.JavaTXCompiler;
|
||||
import de.dhbwstuttgart.environment.IByteArrayClassLoader;
|
||||
import de.dhbwstuttgart.languageServerInterface.model.LanguageServerTransferObject;
|
||||
import de.dhbwstuttgart.parser.scope.JavaClassName;
|
||||
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
||||
import de.dhbwstuttgart.syntaxtree.factory.NameGenerator;
|
||||
import de.dhbwstuttgart.target.generate.ASTToTargetAST;
|
||||
import de.dhbwstuttgart.target.generate.GenericsResult;
|
||||
import de.dhbwstuttgart.target.tree.TargetStructure;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.file.DirectoryStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Implementation of an Interface for the Language-Server to get the Resultset and abstract Syntax.
|
||||
*/
|
||||
public class LanguageServerInterface {
|
||||
|
||||
|
||||
public LanguageServerTransferObject getResultSetAndAbastractSyntax(String path, String resetNamesTo) throws IOException, URISyntaxException, ClassNotFoundException {
|
||||
NameGenerator.resetTo(resetNamesTo);
|
||||
return getResultSetAndAbstractSyntax(path);
|
||||
|
||||
}
|
||||
|
||||
public SourceFile getAst(String path, String resetNamesTo) throws IOException, URISyntaxException, ClassNotFoundException {
|
||||
NameGenerator.resetTo(resetNamesTo);
|
||||
return getAST(path);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* returns the ResultSets, GenericResultSet and the AST
|
||||
* You have to give the input as well as the path because of potential locks when the File is currently opened in an IDE.
|
||||
* Example: file:///c:/test/main.jav -> file:///c:/test/out/main.class
|
||||
*
|
||||
* @param pathAsString the URI of the File. See Example.
|
||||
*/
|
||||
public LanguageServerTransferObject getResultSetAndAbstractSyntax(String pathAsString){
|
||||
System.setOut(new PrintStream(OutputStream.nullOutputStream()));
|
||||
try {
|
||||
var uri = new URI(pathAsString);
|
||||
var path = Path.of(uri);
|
||||
var file = path.toFile();
|
||||
Files.createDirectories(path.getParent().resolve("out"));
|
||||
var compiler = new JavaTXCompiler(List.of(file), List.of(path.getParent().toFile()), path.getParent().resolve("out").toFile());
|
||||
|
||||
var parsedSource = compiler.sourceFiles.get(file);
|
||||
var tiResults = compiler.typeInference(file);
|
||||
|
||||
Map<JavaClassName, byte[]> bytecode = compiler.generateBytecode(parsedSource, tiResults);
|
||||
Files.createDirectories(path.getParent().resolve("out"));
|
||||
compiler.writeClassFile(bytecode, path.getParent().resolve("out").toFile(), false);
|
||||
|
||||
return new LanguageServerTransferObject(tiResults, parsedSource, "", compiler.getGeneratedGenerics());
|
||||
}catch (Exception e){
|
||||
throw new RuntimeException("Compiler could not compile Files.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the AST without calculating the result
|
||||
* You have to give the input as well as the path because of potential locks when the File is currently opened in an IDE.
|
||||
* Example: file:///c:/test/main.jav -> file:///c:/test/out/main.class
|
||||
*
|
||||
* @param path the URI of the File. See Example.
|
||||
* @throws IOException
|
||||
* @throws ClassNotFoundException
|
||||
* @throws URISyntaxException
|
||||
*/
|
||||
public SourceFile getAST(String path) throws IOException, ClassNotFoundException, URISyntaxException {
|
||||
|
||||
|
||||
System.setOut(new PrintStream(OutputStream.nullOutputStream()));
|
||||
|
||||
|
||||
URI uri = new URI(path);
|
||||
ArrayList<String> pathWithoutName = new ArrayList<>(List.of(uri.getPath().split("/")));
|
||||
pathWithoutName.remove(List.of(uri.getPath().split("/")).size() - 1);
|
||||
String stringPathWithoutName = "";
|
||||
|
||||
for (String i : pathWithoutName) {
|
||||
stringPathWithoutName += "/" + i;
|
||||
}
|
||||
|
||||
try {
|
||||
FileUtils.cleanDirectory(new File(stringPathWithoutName + "/out"));
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
try {
|
||||
(new File(stringPathWithoutName + "/out")).mkdirs();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
var test = getAST(uri.getPath().split("/")[uri.getPath().split("/").length - 1], new File(stringPathWithoutName).getPath());
|
||||
System.setOut(System.out);
|
||||
return test;
|
||||
}
|
||||
|
||||
public static SourceFile getAST(String filename, String filePath) throws IOException, ClassNotFoundException {
|
||||
var file = Path.of(filePath, filename).toFile();
|
||||
var compiler = new JavaTXCompiler(List.of(file), List.of(file.getParentFile()), Path.of(filePath + "/out").toFile());
|
||||
return compiler.sourceFiles.get(file);
|
||||
}
|
||||
}
|
@@ -1,40 +0,0 @@
|
||||
package de.dhbwstuttgart.languageServerInterface;
|
||||
|
||||
|
||||
|
||||
import de.dhbwstuttgart.languageServerInterface.model.CustomParserErrorHandler;
|
||||
import de.dhbwstuttgart.languageServerInterface.model.ParserError;
|
||||
import de.dhbwstuttgart.parser.antlr.Java17Lexer;
|
||||
import de.dhbwstuttgart.parser.antlr.Java17Parser;
|
||||
import de.dhbwstuttgart.parser.antlr.Java17ParserBaseListener;
|
||||
import org.antlr.v4.runtime.CharStream;
|
||||
import org.antlr.v4.runtime.CharStreams;
|
||||
import org.antlr.v4.runtime.CommonTokenStream;
|
||||
import org.antlr.v4.runtime.tree.ParseTree;
|
||||
import org.antlr.v4.runtime.tree.ParseTreeWalker;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ParserInterface {
|
||||
|
||||
public List<ParserError> getParseErrors(String input){
|
||||
|
||||
CustomParserErrorHandler errorListener = new CustomParserErrorHandler();
|
||||
CharStream charStream = CharStreams.fromString(input);
|
||||
|
||||
Java17Lexer lexer = new Java17Lexer(charStream);
|
||||
CommonTokenStream tokens = new CommonTokenStream(lexer);
|
||||
|
||||
Java17Parser parser = new Java17Parser(tokens);
|
||||
parser.removeErrorListeners();
|
||||
parser.addErrorListener(errorListener);
|
||||
|
||||
|
||||
ParseTree tree = parser.sourceFile();
|
||||
ParseTreeWalker walker = new ParseTreeWalker();
|
||||
Java17ParserBaseListener listener = new Java17ParserBaseListener();
|
||||
walker.walk(listener, tree);
|
||||
|
||||
return errorListener.getErrorMessages();
|
||||
}
|
||||
}
|
@@ -1,47 +0,0 @@
|
||||
package de.dhbwstuttgart.languageServerInterface.model;
|
||||
|
||||
|
||||
|
||||
import org.antlr.v4.runtime.*;
|
||||
import org.antlr.v4.runtime.atn.ATNConfigSet;
|
||||
import org.antlr.v4.runtime.dfa.DFA;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
import java.util.List;
|
||||
|
||||
public class CustomParserErrorHandler implements ANTLRErrorListener {
|
||||
private final List<ParserError> errorMessages = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) {
|
||||
int endCharPosition = charPositionInLine;
|
||||
if (offendingSymbol instanceof Token) {
|
||||
Token offendingToken = (Token) offendingSymbol;
|
||||
endCharPosition = charPositionInLine + offendingToken.getText().length();
|
||||
}
|
||||
|
||||
ParserError parserError = new ParserError(line, charPositionInLine, endCharPosition, msg);
|
||||
errorMessages.add(parserError);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportAmbiguity(Parser parser, DFA dfa, int i, int i1, boolean b, BitSet bitSet, ATNConfigSet atnConfigSet) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportAttemptingFullContext(Parser parser, DFA dfa, int i, int i1, BitSet bitSet, ATNConfigSet atnConfigSet) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reportContextSensitivity(Parser parser, DFA dfa, int i, int i1, int i2, ATNConfigSet atnConfigSet) {
|
||||
|
||||
}
|
||||
|
||||
public List<ParserError> getErrorMessages() {
|
||||
return errorMessages;
|
||||
}
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
package de.dhbwstuttgart.languageServerInterface.model;
|
||||
|
||||
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
||||
import de.dhbwstuttgart.target.generate.GenericsResult;
|
||||
import de.dhbwstuttgart.typeinference.result.ResultSet;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class LanguageServerTransferObject {
|
||||
List<ResultSet> resultSets;
|
||||
SourceFile Ast;
|
||||
String printedAst;
|
||||
Map<SourceFile, List<GenericsResult>> generatedGenerics = new HashMap<>();
|
||||
|
||||
|
||||
public LanguageServerTransferObject(List<ResultSet> resultSets, SourceFile Ast, String printedAst, Map<SourceFile, List<GenericsResult>> generatedGenerics) {
|
||||
this.resultSets = resultSets;
|
||||
this.Ast = Ast;
|
||||
this.printedAst = printedAst;
|
||||
this.generatedGenerics = generatedGenerics;
|
||||
}
|
||||
|
||||
public List<ResultSet> getResultSets() {return resultSets;}
|
||||
public SourceFile getAst() {return Ast;}
|
||||
public String getPrintedAst() {return printedAst;}
|
||||
public Map<SourceFile, List<GenericsResult>> getGeneratedGenerics() {return generatedGenerics;}
|
||||
}
|
@@ -1,48 +0,0 @@
|
||||
package de.dhbwstuttgart.languageServerInterface.model;
|
||||
|
||||
public class ParserError {
|
||||
|
||||
private int line;
|
||||
private int charPositionInLine;
|
||||
private int endCharPosition;
|
||||
String msg;
|
||||
|
||||
public ParserError(int line, int charPositionInLine, int endCharPosition, String msg) {
|
||||
this.line = line;
|
||||
this.charPositionInLine = charPositionInLine;
|
||||
this. endCharPosition = endCharPosition;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public int getEndCharPosition() {
|
||||
return endCharPosition;
|
||||
}
|
||||
|
||||
public void setEndCharPosition(int endCharPosition) {
|
||||
this.endCharPosition = endCharPosition;
|
||||
}
|
||||
|
||||
public void setCharPositionInLine(int charPositionInLine) {
|
||||
this.charPositionInLine = charPositionInLine;
|
||||
}
|
||||
|
||||
public void setLine(int line) {
|
||||
this.line = line;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public int getCharPositionInLine() {
|
||||
return charPositionInLine;
|
||||
}
|
||||
|
||||
public int getLine() {
|
||||
return line;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
package de.dhbwstuttgart.languageServerInterface.model;
|
||||
|
||||
|
||||
import com.google.common.reflect.TypeResolver;
|
||||
import de.dhbwstuttgart.typeinference.unify.UnifyResultEvent;
|
||||
import de.dhbwstuttgart.typeinference.unify.UnifyResultListener;
|
||||
|
||||
public class ResultSetListener implements UnifyResultListener {
|
||||
|
||||
TypeResolver typeResolver;
|
||||
|
||||
public ResultSetListener(TypeResolver typeResolver){
|
||||
this.typeResolver = typeResolver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNewTypeResultFound(UnifyResultEvent evt) {
|
||||
|
||||
}
|
||||
}
|
@@ -14,10 +14,6 @@ public class NameGenerator {
|
||||
strNextName = "A";
|
||||
}
|
||||
|
||||
public static void resetTo(String name) {
|
||||
strNextName = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Berechnet einen neuen, eindeutigen Namen f�r eine neue
|
||||
* <code>TypePlaceholder</code>. <br>Author: J�rg B�uerle
|
||||
|
@@ -1,4 +1,3 @@
|
||||
|
||||
package de.dhbwstuttgart.target.generate;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.FunNGenerator;
|
||||
|
@@ -63,11 +63,13 @@ public class AllgemeinTest {
|
||||
//String className = "Cycle";
|
||||
//String className = "TripleTest";
|
||||
//String className = "WildcardList";
|
||||
String className = "List";
|
||||
//String className = "List";
|
||||
//String className = "Box";
|
||||
//String className = "GenBox";
|
||||
//String className = "InnerInf";
|
||||
//String className = "Foo";
|
||||
//String className = "Uncurrier";
|
||||
String className = "UncurrierMain";
|
||||
//PL 2019-10-24: genutzt fuer unterschiedliche Tests
|
||||
path = System.getProperty("user.dir")+"/resources/AllgemeinTest/" + className + ".jav";
|
||||
//path = System.getProperty("user.dir")+"/src/test/resources/AllgemeinTest/Overloading_Generics.jav";
|
||||
|
97
src/test/java/KPSPresentation.java
Normal file
97
src/test/java/KPSPresentation.java
Normal file
@@ -0,0 +1,97 @@
|
||||
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static targetast.TestCodegen.generateClassFiles;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import de.dhbwstuttgart.core.JavaTXCompiler;
|
||||
|
||||
public class KPSPresentation {
|
||||
|
||||
private static String path;
|
||||
private static File fileToTest;
|
||||
private static JavaTXCompiler compiler;
|
||||
private static ClassLoader loader;
|
||||
private static Class<?> classToTest;
|
||||
private static String pathToClassFile;
|
||||
private static Object instanceOfClass;
|
||||
|
||||
|
||||
public void testAlgo(String className) throws Exception {
|
||||
//PL 2019-10-24: genutzt fuer unterschiedliche Tests
|
||||
path = System.getProperty("user.dir")+"/resources/KPSPresentation/" + className + ".jav";
|
||||
//path = System.getProperty("user.dir")+"/src/test/resources/AllgemeinTest/Overloading_Generics.jav";
|
||||
//path = System.getProperty("user.dir")+"/src/test/resources/bytecode/javFiles/mathStrucInteger.jav";
|
||||
//compiler = new JavaTXCompiler(Lists.newArrayList(new File(System.getProperty("user.dir")+"/src/test/resources/AllgemeinTest/Overloading_Generics.jav")));
|
||||
///*
|
||||
compiler = new JavaTXCompiler(
|
||||
Lists.newArrayList(new File(path)),
|
||||
Lists.newArrayList(new File(System.getProperty("user.dir")+"/resources/KPSPresentation/classFiles/")),
|
||||
new File(System.getProperty("user.dir")+"/resources/KPSPresentation/classFiles/"));
|
||||
//*/
|
||||
compiler.generateBytecode();
|
||||
pathToClassFile = System.getProperty("user.dir")+"/resources/KPSPresentation/classFiles/";
|
||||
loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
|
||||
classToTest = loader.loadClass(className);
|
||||
//classToTest = loader.loadClass("Overloading_Generics");
|
||||
//instanceOfClass = classToTest.getDeclaredConstructor().newInstance("A");
|
||||
//classToTest = loader.loadClass("Overloading_Generics1");
|
||||
//instanceOfClass = classToTest.getDeclaredConstructor(Object.class).newInstance("B");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void MainTest() throws Exception {
|
||||
testAlgo("Main");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fstTest() throws Exception {
|
||||
testAlgo("fst");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void IdTest() throws Exception {
|
||||
testAlgo("Id");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void OLTest() throws Exception {
|
||||
testAlgo("OL");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void FacTest() throws Exception {
|
||||
testAlgo("Fac");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void FacultyTest() throws Exception {
|
||||
testAlgo("Faculty");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void Lambda() throws Exception {
|
||||
testAlgo("Lambda");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void applyLambda() throws Exception {
|
||||
testAlgo("applyLambda");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void Matrix() throws Exception {
|
||||
testAlgo("Matrix");
|
||||
}
|
||||
|
||||
}
|
@@ -1,5 +0,0 @@
|
||||
public class t{
|
||||
public mofus(){
|
||||
return 1;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user