Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,5 @@
public interface Interface {
int method1(double value)
int method2(String name)
int add(int a, int b)
}

View file

@ -0,0 +1,5 @@
public abstract class Abstract1 {
abstract public int methodA(Date value)
abstract protected int methodB(String name)
int add(int a, int b) { a + b }
}

View file

@ -0,0 +1,3 @@
public abstract class Abstract2 implements Interface {
int add(int a, int b) { a + b }
}

View file

@ -0,0 +1,15 @@
public class Concrete1 implements Interface {
public int method1(double value) { value as int }
public int method2(String name) { (! name) ? 0 : name.toList().collect { it as char }.sum() }
public int add(int a, int b) { a + b }
}
public class Concrete2 extends Abstract1 {
public int methodA(Date value) { value.toCalendar()[Calendar.DAY_OF_YEAR] }
protected int methodB(String name) { (! name) ? 0 : name.toList().collect { it as char }.sum() }
}
public class Concrete3 extends Abstract2 {
public int method1(double value) { value as int }
public int method2(String name) { (! name) ? 0 : name.toList().collect { it as char }.sum() }
}

View file

@ -0,0 +1,12 @@
def c1 = new Concrete1()
assert c1 instanceof Interface
println (new Concrete1().method2("Superman"))
def c2 = new Concrete2()
assert c2 instanceof Abstract1
println (new Concrete2().methodB("Spiderman"))
def c3 = new Concrete3()
assert c3 instanceof Interface
assert c3 instanceof Abstract2
println (new Concrete3().method2("Hellboy"))