new file: .classpath
new file: .project new file: .settings/org.eclipse.jdt.core.prefs new file: bin/ new file: src/
This commit is contained in:
commit
6dc256e703
11
.classpath
Normal file
11
.classpath
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry excluding="javFiles/|javFiles/|classFiles/" kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-9">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="src/classFiles"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
17
.project
Normal file
17
.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>JavaTXExamples</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
15
.settings/org.eclipse.jdt.core.prefs
Normal file
15
.settings/org.eclipse.jdt.core.prefs
Normal file
@ -0,0 +1,15 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=9
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=9
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=9
|
BIN
bin/Main.class
Normal file
BIN
bin/Main.class
Normal file
Binary file not shown.
70
src/Main.java
Normal file
70
src/Main.java
Normal file
@ -0,0 +1,70 @@
|
||||
import java.util.Vector;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
|
||||
//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));
|
||||
|
||||
//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());
|
||||
}
|
||||
}
|
BIN
src/classFiles/Apply.class
Normal file
BIN
src/classFiles/Apply.class
Normal file
Binary file not shown.
BIN
src/classFiles/Fac.class
Normal file
BIN
src/classFiles/Fac.class
Normal file
Binary file not shown.
BIN
src/classFiles/Faculty.class
Normal file
BIN
src/classFiles/Faculty.class
Normal file
Binary file not shown.
BIN
src/classFiles/Fun1$$.class
Normal file
BIN
src/classFiles/Fun1$$.class
Normal file
Binary file not shown.
BIN
src/classFiles/Fun1$$LApply$_$$_$LApply$_$$_$.class
Normal file
BIN
src/classFiles/Fun1$$LApply$_$$_$LApply$_$$_$.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
src/classFiles/Fun2$$.class
Normal file
BIN
src/classFiles/Fun2$$.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
src/classFiles/Id.class
Normal file
BIN
src/classFiles/Id.class
Normal file
Binary file not shown.
BIN
src/classFiles/Lambda.class
Normal file
BIN
src/classFiles/Lambda.class
Normal file
Binary file not shown.
BIN
src/classFiles/Matrix.class
Normal file
BIN
src/classFiles/Matrix.class
Normal file
Binary file not shown.
BIN
src/classFiles/MatrixOP.class
Normal file
BIN
src/classFiles/MatrixOP.class
Normal file
Binary file not shown.
BIN
src/classFiles/OL.class
Normal file
BIN
src/classFiles/OL.class
Normal file
Binary file not shown.
BIN
src/classFiles/OLMain.class
Normal file
BIN
src/classFiles/OLMain.class
Normal file
Binary file not shown.
BIN
src/classFiles/Sorting.class
Normal file
BIN
src/classFiles/Sorting.class
Normal file
Binary file not shown.
BIN
src/classFiles/applyLambda.class
Normal file
BIN
src/classFiles/applyLambda.class
Normal file
Binary file not shown.
BIN
src/javFiles/._Fac.jav
Normal file
BIN
src/javFiles/._Fac.jav
Normal file
Binary file not shown.
BIN
src/javFiles/._Faculty.jav
Normal file
BIN
src/javFiles/._Faculty.jav
Normal file
Binary file not shown.
BIN
src/javFiles/._Id.jav
Normal file
BIN
src/javFiles/._Id.jav
Normal file
Binary file not shown.
BIN
src/javFiles/._Matrix.jav
Normal file
BIN
src/javFiles/._Matrix.jav
Normal file
Binary file not shown.
BIN
src/javFiles/._MatrixOP.jav
Normal file
BIN
src/javFiles/._MatrixOP.jav
Normal file
Binary file not shown.
BIN
src/javFiles/._OL.jav
Normal file
BIN
src/javFiles/._OL.jav
Normal file
Binary file not shown.
BIN
src/javFiles/._applyLambda.jav
Normal file
BIN
src/javFiles/._applyLambda.jav
Normal file
Binary file not shown.
15
src/javFiles/Fac.jav
Normal file
15
src/javFiles/Fac.jav
Normal file
@ -0,0 +1,15 @@
|
||||
import java.lang.Integer;
|
||||
|
||||
|
||||
public class Fac {
|
||||
|
||||
getFac( java.lang.Integer n){
|
||||
var res = 1;
|
||||
var i = 1;
|
||||
while(i<=n) {
|
||||
res = res * i;
|
||||
i++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
19
src/javFiles/Faculty.jav
Normal file
19
src/javFiles/Faculty.jav
Normal file
@ -0,0 +1,19 @@
|
||||
import java.lang.Integer;
|
||||
import java.lang.Long;
|
||||
|
||||
class Faculty {
|
||||
fact;
|
||||
|
||||
m () {
|
||||
|
||||
fact = (x) -> {
|
||||
if (x == 1) {
|
||||
return x;
|
||||
}
|
||||
else {
|
||||
return x * (fact.apply(x-1));
|
||||
}
|
||||
};
|
||||
return fact;
|
||||
}
|
||||
}
|
5
src/javFiles/Id.jav
Normal file
5
src/javFiles/Id.jav
Normal file
@ -0,0 +1,5 @@
|
||||
public class Id {
|
||||
id(b){
|
||||
return b;
|
||||
}
|
||||
}
|
11
src/javFiles/Lambda.jav
Normal file
11
src/javFiles/Lambda.jav
Normal file
@ -0,0 +1,11 @@
|
||||
import java.lang.Integer;
|
||||
|
||||
public class Lambda {
|
||||
|
||||
m () {
|
||||
var lam1 = (Integer x) -> {
|
||||
return x * x;
|
||||
};
|
||||
return lam1;
|
||||
}
|
||||
}
|
5
src/javFiles/LambdaField.jav
Normal file
5
src/javFiles/LambdaField.jav
Normal file
@ -0,0 +1,5 @@
|
||||
public class LambdaField<DMYQ,DJOU,DMFW extends DMYQ,DMYP extends DJOU> {
|
||||
|
||||
Fun1$$<DMYP, DMYQ> f = x -> x;
|
||||
|
||||
}
|
40
src/javFiles/Matrix.jav
Normal file
40
src/javFiles/Matrix.jav
Normal file
@ -0,0 +1,40 @@
|
||||
import java.util.Vector;
|
||||
import java.lang.Integer;
|
||||
import java.lang.Boolean;
|
||||
|
||||
public class Matrix extends Vector<Vector<Integer>> {
|
||||
|
||||
Matrix () {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
44
src/javFiles/MatrixOP.jav
Normal file
44
src/javFiles/MatrixOP.jav
Normal file
@ -0,0 +1,44 @@
|
||||
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()) {
|
||||
// Boolean a = this.add(vv.elementAt(i));
|
||||
this.add(vv.elementAt(i));
|
||||
i=i+1;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
25
src/javFiles/OL.jav
Normal file
25
src/javFiles/OL.jav
Normal file
@ -0,0 +1,25 @@
|
||||
import java.lang.Integer;
|
||||
import java.lang.Double;
|
||||
import java.lang.String;
|
||||
import java.lang.Long;
|
||||
import java.lang.Boolean;
|
||||
|
||||
|
||||
class OL {
|
||||
|
||||
m (x) { return x + x; }
|
||||
|
||||
//m(Boolean x) { return x; }
|
||||
}
|
||||
|
||||
|
||||
class OLMain {
|
||||
|
||||
main(x) {
|
||||
var ol;
|
||||
ol = new OL();
|
||||
return ol.m(x);
|
||||
}
|
||||
}
|
||||
|
||||
|
15
src/javFiles/Sorting.jav
Normal file
15
src/javFiles/Sorting.jav
Normal file
@ -0,0 +1,15 @@
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.lang.String;
|
||||
|
||||
class Sorting{
|
||||
merge(a, b){
|
||||
a.addAll(b);
|
||||
return a;
|
||||
}
|
||||
|
||||
void sort(a){
|
||||
a = merge(a,a);
|
||||
}
|
||||
|
||||
}
|
14
src/javFiles/applyLambda.jav
Normal file
14
src/javFiles/applyLambda.jav
Normal file
@ -0,0 +1,14 @@
|
||||
import java.lang.Integer;
|
||||
|
||||
public class Apply { }
|
||||
|
||||
public class applyLambda {
|
||||
|
||||
m () {
|
||||
var lam1 = (x) -> {
|
||||
return x;
|
||||
};
|
||||
return lam1.apply(new Apply());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user