Compare commits

...

2 Commits

Author SHA1 Message Date
pl@gohorb.ba-horb.de
f496ff13b8 new file: ../applyLambda.jav
All checks were successful
Build and Test with Maven / Build-and-test-with-Maven (push) Successful in 1m35s
2025-09-24 15:57:47 +02:00
pl@gohorb.ba-horb.de
642ecc9a50 modified: ../Id.jav
modified:   ../Main.jav
	modified:   ../OL.jav
	modified:   ../../../src/test/java/KPSPresentation.java
2025-09-24 15:57:22 +02:00
5 changed files with 84 additions and 36 deletions

View File

@@ -1,6 +1,5 @@
class Id {
id2 = x -> x;
id4 = x -> x;
id(x) {
return x;

View File

@@ -3,40 +3,53 @@ import java.lang.System;
import java.io.PrintStream;
import java.lang.Character;
import java.lang.Object;
import fst;
import java.lang.Integer;
import fst;
import Id;
import OLMain;
import Fac
import Faculty;
//import FacultyBug;
import java.lang.Float;
import applyLambda;
public class Main {
public static main(x) {
new fst().main(5);
//System.out.println(new Faculty().getFact(3));
//Id.jav: the identity-function
//applied to an integer
System.out.println(new Id().id(1).toString());
//applied to a string
System.out.println(new Id().id("hallo").toString());
//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"));
System.out.println(new Fac().getFac(6));
System.out.println(new Faculty().m().apply(6));
//Lambda.jav: An lambda expression applied by the method apply
System.out.println(new Lambda().m().apply(77));
/*
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);
@@ -69,15 +82,13 @@ public class Main {
//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());
}
}
}
@@ -86,5 +97,7 @@ public class MainBug {
System.out.println(new fst().main(5));
//System.out.println(new FacultyBug().getFact(3));
}
}
}
*/
}
}

View File

@@ -9,7 +9,7 @@ import java.lang.Object;
class OL {
Integer m(Integer x) { return x + x; }
m(x) { return x + x; }
m(x) { return x || x; }

View 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();
}
}

View File

@@ -54,18 +54,38 @@ public class KPSPresentation {
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 FacultyBugTest() throws Exception {
testAlgo("FacultyBug");
public void Lambda() throws Exception {
testAlgo("Lambda");
}
@Test
public void applyLambda() throws Exception {
testAlgo("applyLambda");
}
}