This commit is contained in:
julian 2024-05-15 22:03:08 +02:00
parent 373a007129
commit e54e4dc04a
241 changed files with 12 additions and 4450 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -9,6 +9,7 @@ import de.dhbwstuttgart.syntaxtree.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.Method; import de.dhbwstuttgart.syntaxtree.Method;
import de.dhbwstuttgart.syntaxtree.TypeScope; import de.dhbwstuttgart.syntaxtree.TypeScope;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
import de.dhbwstuttgart.assumptions.TypeInferenceInformation;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -16,48 +17,35 @@ import java.util.Set;
import java.util.Stack; import java.util.Stack;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.lang.System;
import java.io.PrintStream;
import java.lang.String; import java.lang.String;
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceInformation;
import de.dhbwstuttgart.typeinference.assumptions.TypeScopeContainer;
import java.util.Iterator;
public class TypeInferenceBlockInformation extends TypeInferenceInformation { public class TypeInferenceBlockInformation extends TypeInferenceInformation {
private TypeScope methodContext; private TypeScope methodContext;
private ClassOrInterface currentClass; private ClassOrInterface currentClass;
public TypeInferenceBlockInformation(Collection<ClassOrInterface> availableClasses, ClassOrInterface currentClass, TypeScope methodContext) { public TypeInferenceBlockInformation(Collection<ClassOrInterface> availableClasses,
ClassOrInterface currentClass, TypeScope methodContext) {
super(availableClasses); super(availableClasses);
this.methodContext = new TypeScopeContainer(currentClass, methodContext); this.methodContext = new TypeScopeContainer(currentClass, methodContext);
this.currentClass = currentClass; this.currentClass = currentClass;
} }
public TypeInferenceBlockInformation(TypeInferenceBlockInformation oldScope, TypeScope newScope) { public TypeInferenceBlockInformation(TypeInferenceBlockInformation oldScope, TypeScope newScope) {
this(oldScope.getAvailableClasses(), oldScope.currentClass, new TypeScopeContainer(oldScope.methodContext, newScope)); this(oldScope.getAvailableClasses(), oldScope.currentClass, new TypeScopeContainer(oldScope.methodContext, newScope));
} }
public ClassOrInterface getCurrentClass() { public ClassOrInterface getCurrentClass() {
return this.currentClass; return currentClass;
} }
public ClassOrInterface getSuperClass() { public ClassOrInterface getSuperClass() {
Iterator var1 = this.getAvailableClasses().iterator(); for (var clazz : getAvailableClasses()) {
System.out.println(currentClass.getSuperClass().getName());
ClassOrInterface clazz; if (clazz.getClassName().equals(currentClass.getSuperClass().getName()))
do { return clazz;
if (!var1.hasNext()) { }
throw new DebugException("Class has no superclass!"); throw new DebugException("Class has no superclass!");
}
clazz = (ClassOrInterface)var1.next();
System.out.println(this.currentClass.getSuperClass().getName());
} while(!clazz.getClassName().equals(this.currentClass.getSuperClass().getName()));
return clazz;
} }
public TypeScope getCurrentTypeScope() { public TypeScope getCurrentTypeScope() {
return this.methodContext; return methodContext;
} }
} }

View File

@ -1,10 +0,0 @@
class Assign {
assign(x, y) {
x = y;
}
assign2(x, y) {
assign(x,y);
}
}

View File

@ -1,18 +0,0 @@
import java.lang.Object;
import java.util.Vector;
class CaptureConversion {
<X> void assign(Vector<X> v1, Vector<X> v2) {
v1 = v2;
}
void main() {
Vector<?> v1;
v1 = new Vector<Object>();
Vector<? extends Object> v2;
v2 = new Vector<Object>();
v1 = v2;
assign(v1, v2);
}
}

View File

@ -1,22 +0,0 @@
class Pair<U, T> {
U a;
T b;
Pair(U x, T y) {
a = x; b = y;
}
}
class Complex {
m(b) {
var c = b;
var d = c;
var e;
d = e;
var r1 = e;
var f = e;
var g;
f = g;
var r2 = g;
return new Pair<>(r1, r2);
}
}

View File

@ -1,7 +0,0 @@
public class InfReturn {
m(a) {
var ret;
a = ret;
return ret;
}
}

View File

@ -1,8 +0,0 @@
public class InfReturnII {
m(a, b) {
var ret;
a = ret;
b = ret;
return ret;
}
}

View File

@ -1,7 +0,0 @@
class InnerInf {
m(a, b) {
var i;
a = i;
b = i;
}
}

View File

@ -1,43 +0,0 @@
/*
class Pair<T, U> {
T x;
U y;
public Pair() { }
public Pair(T x, U y) {
this.x = x;
this.y = y;
}
public T fst () {
return x;
}
public U snd () {
return y;
}
}
*/
public class Iteration {
id(x) {
return x;
}
m1(x, y) {
var help;
help = m2(x, y);
var y2 = help.snd();
var x2 = id(x);
return new Pair<>(x2,y2);
}
m2(x,y) {
var help = m1(x, y);
var x2 = help.fst();
var y2 = id(y);
return new Pair<>(x2, y2);
}
}

View File

@ -1,7 +0,0 @@
import java.lang.Integer;
import java.lang.Double;
class Overloading {
m(x) { return x + x; }
m(x) { return x || x; }
}

View File

@ -1,36 +0,0 @@
import java.util.Vector;
import java.lang.Boolean;
import java.lang.Object;
class Pair<U, T> {
U a;
T b;
make(x) {
var ret = new Pair<>();
ret.a = x.elementAt(0);
ret.b = x.elementAt(1);
return ret;
}
eq(a, b) {
b = a;
return a == b;
}
compare( p) {
return eq(p.a, p.b);
//return p.a == p.b;
}
/*
void m(Pair<?, ?> p, Vector<?> b)
{
//this.compare(p); //1, type incorrect
this.compare(this.make(b)); //2, OK
}
*/
}

View File

@ -1,8 +0,0 @@
class RecursionCond {
m(a, b, c) {
if (1 == 2) {
b = m(a, b);
c = m(a, b);
} else return a;
}
}

View File

@ -1,14 +0,0 @@
import java.util.stream.Stream;
import java.util.Vector;
import java.lang.Integer;
class StreamTest {
m() {
var vecInt = new Vector<Integer>();
var strInt = vecInt.stream();
var dup = x -> x*2;
strInt.map(dup);
return dup;
}
}

View File

@ -1,9 +0,0 @@
import java.lang.Boolean;
import java.lang.Integer;
public class Test {
fac = (x) -> {
if (x == 1) { return 1; }
return x * fac.apply(x - 1);
};
}

View File

@ -1,19 +0,0 @@
class Triple<U, T, S> {
U a;
T b;
S c;
Triple(U x, T y, S z) {
a = x; b = y; c = z;
}
U fst() { return a; }
T snd() { return b; }
S thrd() { return c; }
}
public class TripleTest {
m() {
return new Triple<>(m().thrd(), m().thrd(), m().thrd());
}
}

View File

@ -1,12 +0,0 @@
class Twice2 {
id1inst = new Id<>();
id1 = id1inst.id;
id2inst = new Id<>();
id2 = id2inst.id;
twice = id1.apply(id2);
}
class Id<T> {
id = (T x) -> x;
}

View File

@ -1,12 +0,0 @@
import java.util.Vector;
import java.lang.Boolean;
class UseWildcardPair{
void m(Pair<?, ?> p, Vector<?> b)
{
p.compare(p); //1, type incorrect
p.compare(p.make(b)); //2, OK
}
}

View File

@ -1,8 +0,0 @@
import java.lang.Integer;
import java.lang.String;
public class AA {
m(Integer i) { return "AA"; }
m2(AA x) { return "AA"; }
}

View File

@ -1,9 +0,0 @@
import java.lang.Integer;
import java.lang.Long;
public class AddLong{
Long add(Integer a, Long b) {
Long c = a+b;
return c;
}
}

View File

@ -1,30 +0,0 @@
import java.lang.Integer;
import java.lang.Boolean;
import java.lang.String;
import java.lang.Byte;
import java.lang.Short;
import java.lang.Long;
import java.lang.Float;
import java.lang.Double;
import java.lang.Character;
class AssignToLit {
void m(){
// String s = "Test";
// Boolean b = false;
// Byte byte1 = 5;
// Byte byte2 = 55;
// Short short1 = 5;
// Short short2 = 55;
// Integer int1 = 5;
// Integer int2 = 8888888;
// Long long1 = 1;
// Long long2 = 5;
// Long long3 = 89989898;
// Float float1 = 1;
// Float float2 = 55;
// Double d1 = 1;
// Double d2 = 55;
Character c = 'A';
}
}

View File

@ -1,3 +0,0 @@
import java.lang.Integer;
public class BB extends AA { }

View File

@ -1,17 +0,0 @@
import java.lang.Integer;
import java.lang.Double;
public class BinaryInMeth {
m(a){
return ++a;
}
m2(a,b){
return m(a+b);
}
m3(a) {
return m(++a);
}
}

View File

@ -1,7 +0,0 @@
class B { }
class Box_Main extends B {
m(b) {
b.m(new Box_Main());
b.m(new B());
}
}

View File

@ -1,3 +0,0 @@
class Box<A> {
void m(A a) { }
}

View File

@ -1,11 +0,0 @@
import java.lang.Integer;
import java.lang.String;
public class CC extends BB {
m(Integer i) {
return "CC";
}
m2(CC x) { return "CC"; }
}

View File

@ -1,13 +0,0 @@
import java.lang.Integer;
public class Chain {
x = 5;
chain() {
return this;
}
m() {
return this.chain().chain().chain().x;
}
}

View File

@ -1,8 +0,0 @@
import java.lang.Integer;
public class ClassGenLam {
lam = x-> x;
// public ClassGenLam() {
// lam = x->x;
// }
}

View File

@ -1,6 +0,0 @@
class Cycle {
m(x, y) {
y = x;
x = y;
}
}

View File

@ -1,4 +0,0 @@
import java.lang.Integer;
public class DD extends CC { }

View File

@ -1,11 +0,0 @@
public class DuMethod{
method(a){
return a+a;
}
method(a){
return a;
}
}

View File

@ -1,3 +0,0 @@
public class EmptyClass{
}

View File

@ -1,8 +0,0 @@
public class EmptyMethod{
public void m1(){
System.out.println("test");
}
public void m2(){}
}

View File

@ -1,9 +0,0 @@
import java.lang.String;
public class Example {
public m() {
String x = "X";
return x;
}
}

View File

@ -1,3 +0,0 @@
public class Exceptions {
// m(Integer i) throws
}

View File

@ -1,8 +0,0 @@
class Expressions{
void test(){
var x = 2;
x = x + 2;
}
}

View File

@ -1,10 +0,0 @@
import java.util.Vector;
class Matrix extends Vector<Vector<Integer>> {
methode(m) {
m.add(1);
Matrix i;
methode(i);
}
}

View File

@ -1,15 +0,0 @@
import java.lang.Integer;
import java.lang.Double;
import java.lang.String;
public class Fac {
getFac(n) {
var res = 1;
var i = 1;
while (i <= n) {
res = res * i;
i++;
}
return res;
}
}

View File

@ -1,52 +0,0 @@
import java.lang.Integer;
//import java.lang.Long;
//import java.lang.Short;
public class Faculty {
public fact;
Faculty() {
fact = (x) -> {
if (x == 1) {
return 1;
}
else {
return x * (fact.apply(x-1));
}
};
}
public getFact(java.lang.Integer x) {
return fact.apply(x);
}
}
// m (x) {
//
//// var fact = (x) -> {
//// if (x == 1) {
//// return x;
//// }
//// else {
//// return x * (fact.apply(x-1));
//// }
//// };
//// return fact;
//// var x = 13;
//// if(x>22) {
//// return 0;
//// }else if(x <1){
//// return x;
//// }else {
//// return 1;
//// }
//
// if (x < 0) {
// return 0;
// }else if(x<2) {
// return x;
// } else {
// return x * m(x-1);
// }
// }
//}

View File

@ -1,10 +0,0 @@
class Faculty2 {
m () {
var fact = (Integer x) -> {
return x;
};
return fact;
}
}

View File

@ -1,17 +0,0 @@
import java.lang.Integer;
class Faculty {
m () {
var fact = (Integer x) -> {
if (x == 1) {
return x;
}
else {
return x * (fact.apply(x-1));
}
};
return fact;
}
}

View File

@ -1,19 +0,0 @@
import java.lang.Integer;
class Faculty {
Integer mul(Integer x, Integer y) {
return x;
}
Fun1<java.lang.Integer,java.lang.Integer> m () {
var fact = (Integer x) -> {
return mul(x, fact.apply(x));
};
return fact;
}
}
interface Fun1<A,B>{
B apply(A a);
}

View File

@ -1,9 +0,0 @@
import java.lang.Integer;
public class Field {
public x = 5;
m(){
return x;
}
}

View File

@ -1,13 +0,0 @@
class Box<A> {
A f;
}
class B {
}
class Box_Main extends B {
m(b) {
b.f = new Box_Main();
b.f = new B();
}
}

View File

@ -1,4 +0,0 @@
public class FieldTph {
a;
}

View File

@ -1,14 +0,0 @@
import java.lang.String;
public class FieldTph2 {
a;
m(b){
b = a;
return b;
}
m2(c){
a = c;
}
}

View File

@ -1,26 +0,0 @@
public class FieldTphConsMeth {
a;
public FieldTphConsMeth(c) {
a = id(c);
}
id(b) {
return b;
}
setA(x) {
a = x;
return a;
}
m(x,y) {
x = id(y);
}
/*m2(x,y) {
x = setA(y);
return x;
}*/
}

View File

@ -1,27 +0,0 @@
import java.lang.Boolean;
public class FieldTphMMeth {
a;
public FieldTphMMeth(c,d,e) {
a = m(c,d,e);
}
m(b,d,e) {
if(e) {
return m3(b);
} else{
return m3(d);
}
}
m2(b) {
a = m3(b);
}
m3(b){
return b;
}
}

View File

@ -1,11 +0,0 @@
import java.lang.String;
class Fields{
test2 = "test";
test;
m(){
var test3;
return test;
}
}

View File

@ -1,30 +0,0 @@
import java.lang.Integer;
import java.lang.Boolean;
class For{
Integer m(Integer x){
var c = x + 2;
Boolean b = true;
c = 5;
c++;
++c;
c--;
--c;
while(x<2){
x = x +1;
b = false;
}
for(int i = 0; i<10; i++) {
x = x + 5;
}
return x;
}
// m2(Integer x){
// if(x<2) {
// return 1;
// }else {
// return 2;
// }
// }
}

View File

@ -1,12 +0,0 @@
import java.util.Vector;
import java.lang.Integer;
import java.lang.String;
//import java.lang.Byte;
//import java.lang.Boolean;
public class FunOL {
add(f, y) {
return f.apply() + y;
}
}

View File

@ -1,15 +0,0 @@
import java.lang.Integer;
import java.util.function.Function;
public class FunctionalInterface {
Integer accept(Function<Integer, Integer> f) {
return f.apply(20);
}
Integer m() {
var v = accept(i -> {
return i * 10;
});
return v;
}
}

View File

@ -1,8 +0,0 @@
import java.lang.Integer;
import java.util.Vector;
public class Gen{
Vector<Integer> m(Vector<Integer> v){
return v;
}
}

View File

@ -1,17 +0,0 @@
class Generics<B> {
Generics(B b){
}
B mt1(B b){
return mt1(b);
}
}
/*
Problem:
auto test = new List<String>();
auto test2 = new List<Integer>();
... //code, welcher möglicherweise test und test2 vertauscht
test.add("hallo");
*/

View File

@ -1,9 +0,0 @@
import java.lang.String;
import java.lang.Integer;
class Generics2<B extends String>{
<B extends Integer> B m1(B b){
return b;
}
}

View File

@ -1,7 +0,0 @@
import java.lang.String;
import java.lang.Integer;
import java.util.List;
class Generics3<B extends String & List<Integer>> {
}

View File

@ -1,12 +0,0 @@
import java.lang.String;
import java.lang.Integer;
class Generics4<B extends String> {
<C extends Integer> C m1(C b){
return b;
}
m2(x) {
return m1(x);
}
}

View File

@ -1,57 +0,0 @@
import java.lang.Integer;
import java.lang.Long;
import java.lang.Float;
import java.lang.Double;
public class GreaterEqual {
gE(Integer a, Integer b){
var c = a>=b;
return c;
}
gE(Long a, Long b){
var c = a>=b;
return c;
}
gE(Float a, Float b){
var c = a>=b;
return c;
}
gE(Double a, Double b){
var c = a>=b;
return c;
}
gE(Long a, Integer b){
var c = a>=b;
return c;
}
gE(Float a, Integer b){
var c = a>=b;
return c;
}
gE(Double a, Integer b){
var c = a>=b;
return c;
}
gE(Float a, Long b){
var c = a>=b;
return c;
}
gE(Double a, Long b){
var c = a>=b;
return c;
}
gE(Double a, Float b){
var c = a>=b;
return c;
}
}

View File

@ -1,56 +0,0 @@
import java.lang.Integer;
import java.lang.Long;
import java.lang.Float;
import java.lang.Double;
public class GreaterThan {
gT(Integer a, Integer b){
var c = a>b;
return c;
}
gT(Long a, Long b){
var c = a>b;
return c;
}
gT(Float a, Float b){
var c = a>b;
return c;
}
gT(Double a, Double b){
var c = a>b;
return c;
}
gT(Long a, Integer b){
var c = a>b;
return c;
}
gT(Float a, Integer b){
var c = a>b;
return c;
}
gT(Double a, Integer b){
var c = a>b;
return c;
}
gT(Float a, Long b){
var c = a>b;
return c;
}
gT(Double a, Long b){
var c = a>b;
return c;
}
gT(Double a, Float b){
var c = a>b;
return c;
}
}

View File

@ -1,9 +0,0 @@
import java.lang.System;
import java.lang.String;
import java.io.PrintStream;
public class HelloWorld {
static hello() {
System.out.println("Hello World!");
}
}

View File

@ -1,20 +0,0 @@
public class Id <FAU> {
// a;
// id(b){
// return b;
// }
id2 = x -> x;
// id2 = () -> {
// var x = m(a);
// var y = x;
// var z = y;
// };
//
// m(a){
// return a;
// }
id3 (x) {
return id2.apply(x);
}
}

View File

@ -1,15 +0,0 @@
import java.lang.Integer;
import java.lang.Boolean;
import java.lang.String;
public class IfTest{
Integer m1(Boolean b) {
Integer i;
String b;
if(b) {
return i;
}else{
return b;
}
}
}

View File

@ -1,8 +0,0 @@
import java.util.Vector;
class Import {
void methode(){
Vector v = new Vector<>();
v.add("X");
}
}

View File

@ -1,65 +0,0 @@
public class Inf {
m(x,y,a){
var z;
var v;
var w;
var b;
y=x;
z=x;
v=y;
w=y;
y=a;
b=a;
var c;
var d;
c = v;
d = v;
}
}
/*
TPH M m(TPH N x, TPH O y, TPH P a)({
TPH Q z;
TPH R v;
TPH S w;
TPH T b;
(y)::TPH O = (x)::TPH N;
(z)::TPH Q = (x)::TPH N;
(v)::TPH R = (y)::TPH O;
(w)::TPH S = (y)::TPH O;
(y)::TPH O = (a)::TPH P;
(b)::TPH T = (a)::TPH P;
TPH U c;
TPH V d;
(c)::TPH U = (v)::TPH R;
(d)::TPH V = (v)::TPH R;
return;
})::TPH W
Inf()({
super(());
})::TPH Z
}
// c::U d::V
// \ /
// v::R w::S
// \ /
// z::Q y::O b::T
// \ / \ /
// x::N a::P
RESULT Final: [[(TPH N < TPH O), (TPH R < TPH V), (TPH N < TPH Q), (TPH P < TPH O), (TPH R < TPH U), (TPH M = void), (TPH O < TPH S), (TPH O < TPH R), (TPH P < TPH T)]]
Simplified constraints: [(TPH O < TPH S), (TPH P < TPH O), (TPH O < TPH R), (TPH P < TPH T), (TPH N < TPH O), (TPH N < TPH Q)]
m: [(TPH DDV = java.lang.Object), (TPH DDX = java.lang.Object), (TPH DDX < TPH DDV), (TPH N < TPH DDX), (TPH P < TPH DDX)]
Class Inf: []
Inf: []
Unify nach Oder-Constraints-Anpassung:
UND:[(void =. M, , -1 WC: false, IT: false), (N <. O, 1 WC: false, IT: false, 1 WC: false, IT: false), (P <. O, 1 WC: false, IT: false, 1 WC: false, IT: false), (N <. Q, 1 WC: false, IT: false, 0 WC: true, IT: false), (O <. S, 1 WC: false, IT: false, 0 WC: true, IT: false), (O <. R, 1 WC: false, IT: false, 0 WC: true, IT: false), (P <. T, 1 WC: false, IT: false, 0 WC: true, IT: false)]
isInherited = false
isStatement = false
ODER:
*/

View File

@ -1,6 +0,0 @@
class Infimum {
m(x, y, z) {
y = x;
z = x;
}
}

View File

@ -1,18 +0,0 @@
import java.util.Vector;
import java.lang.Integer;
import java.lang.String;
public class Inherit {
main(d, i) {
return d.m(i);
}
main(v, i) {
var aa = v.elementAt(0);
return aa.m(i);
}
}

View File

@ -1,17 +0,0 @@
import java.util.Vector;
import java.lang.Integer;
import java.lang.String;
public class Inherit2 {
main(d) {
return d.m2(d);
}
main(v) {
var aa = v.elementAt(0);
return aa.m2(aa);
}
}

View File

@ -1,18 +0,0 @@
import java.lang.Number;
import java.lang.Integer;
import java.lang.Double;
import java.lang.String;
public class InstanceOf {
main(n) {
if (n instanceof Integer i) {
takes(i);
return "Integer";
} else if (n instanceof Double d) {
takes(d);
return "Double";
}
}
takes(i) {} // Should be overloaded
}

View File

@ -1,3 +0,0 @@
public interface Interface1{
public void test();
}

View File

@ -1,33 +0,0 @@
import java.lang.Integer;
interface A {
void method1();
default method2() {
}
}
interface B {
void method3();
}
interface C {
Integer myInt();
}
class ClassX implements A {
}
record ClassY(Integer myInt) implements C {}
public class Interfaces implements A, B {
public void method1() {
}
public void method3() {
var intf = new Interfaces();
intf = new ClassX();
intf.method1();
C c = new ClassY(10);
c.myInt();
}
}

View File

@ -1,13 +0,0 @@
public class KompTph {
public m(a, b, c) {
var d = a;
var e = a;
a = b;
c = b;
m2(a,c);
}
public m2(a,b){
m(a,a,b);
}
}

View File

@ -1,9 +0,0 @@
public class LamRunnable{
public LamRunnable(){
Runnable lam = () -> {System.out.println("lambda");};
lam.run();
}
}

View File

@ -1,11 +0,0 @@
import java.lang.Integer;
public class Lambda {
m () {
var lam1 = (x) -> {
return x;
};
return lam1;
}
}

View File

@ -1,35 +0,0 @@
import java.lang.String;
public class Lambda2
{
public static void main(List<String> args){
var listOfStrings = new List<String>();
var listOfObjects;
listOfObjects = map(listOfStrings, (a) -> a);
}
public map(a , b){
b.apply(a);
return a;
}
/*
public static <I,O> List<O> map(List<I> input, Function<I,O> func) {
List<O> output;
output = new List<O>();
output.add(func.apply(input.get()));
return output;
}
*/
}
class List<A>{
/* A get();
void add(A);
*/
}
/*
class Function<A,B>{
B apply(A a);
}
*/

View File

@ -1,23 +0,0 @@
public class Lambda2
{
/*
public static <A> List<A> map(List<? extends A> input,
Function<? super A, ? extends A> func){
input.add(func.apply(input.get()));
}
*/
public map(input,func){
input.add(func.apply(input.get()));
return map(new List<String>(), func);
}
}
class List<A>{
A get();
void add(A);
}
class Function<A,B>{
B apply(A a);
}

View File

@ -1,18 +0,0 @@
class Lambda{
methode(){
return ((f) -> f);
}
}
/*
interface Fun0<A>{
A apply();
}
interface Fun1<A,B>{
A apply(B b);
}
*/
interface Fun2<A,B,C>{
A apply(B b, C c);
}

View File

@ -1,12 +0,0 @@
import java.lang.Integer;
public class LambdaCapture {
Integer i = 8;
f;
public LambdaCapture(){
Integer w = 7;
f = j ->{
return w+i;};
}
}

View File

@ -1,6 +0,0 @@
public class LambdaField {
f = x -> x;
}

View File

@ -1,17 +0,0 @@
import java.lang.Runnable;
import java.lang.String;
import java.lang.System;
import java.io.PrintStream;
public class LambdaRunnable {
public LambdaRunnable(){
Runnable lam = () -> {
System.out.println("Runnable is running");
};
lam.run();
}
}

View File

@ -1,9 +0,0 @@
import java.lang.Integer;
public class Lambda {
m () {
var lam1 = (x) -> { };
return lam1;
}
}

View File

@ -1,56 +0,0 @@
import java.lang.Integer;
import java.lang.Long;
import java.lang.Float;
import java.lang.Double;
public class LessEqual {
lessEqual(Integer a, Integer b){
var c = a<=b;
return c;
}
lessEqual(Long a, Long b){
var c = a<=b;
return c;
}
lessEqual(Float a, Float b){
var c = a<=b;
return c;
}
lessEqual(Double a, Double b){
var c = a<=b;
return c;
}
lessEqual(Long a, Integer b){
var c = a<=b;
return c;
}
lessEqual(Float a, Integer b){
var c = a<=b;
return c;
}
lessEqual(Double a, Integer b){
var c = a<=b;
return c;
}
lessEqual(Float a, Long b){
var c = a<=b;
return c;
}
lessEqual(Double a, Long b){
var c = a<=b;
return c;
}
lessEqual(Double a, Float b){
var c = a<=b;
return c;
}
}

View File

@ -1,57 +0,0 @@
import java.lang.Integer;
import java.lang.Long;
import java.lang.Float;
import java.lang.Double;
public class LessThan {
lessThan(Integer a, Integer b){
var c = a<b;
return c;
}
lessThan(Long a, Long b){
var c = a<b;
return c;
}
lessThan(Float a, Float b){
var c = a<b;
return c;
}
lessThan(Double a, Double b){
var c = a<b;
return c;
}
lessThan(Long a, Integer b){
var c = a<b;
return c;
}
lessThan(Float a, Integer b){
var c = a<b;
return c;
}
lessThan(Double a, Integer b){
var c = a<b;
return c;
}
lessThan(Float a, Long b){
var c = a<b;
return c;
}
lessThan(Double a, Long b){
var c = a<b;
return c;
}
lessThan(Double a, Float b){
var c = a<b;
return c;
}
}

View File

@ -1,20 +0,0 @@
import java.lang.Integer;
import java.lang.String;
class ListenerOverload{
call(p){
call(p.left);
call(p.right);
}
call(Integer i){}
call(String s){}
}
class Pair{
left;
right;
}

View File

@ -1,44 +0,0 @@
import java.util.Vector;
import java.lang.Integer;
//import java.lang.Float;
//import java.lang.Byte;
//import java.lang.Boolean;
public class Matrix extends Vector<Vector<Integer>> {
Matrix () {
}
Matrix(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(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(new Integer(erg));
v2.addElement(erg);
j++; }
ret.addElement(v2);
i++;
}
return ret;
}
}

Some files were not shown because too many files have changed in this diff Show More