copy files over
This commit is contained in:
parent
e3a2b6a3b8
commit
672d87b00e
13
Lab5/cs2030s/fp/Action.java
Normal file
13
Lab5/cs2030s/fp/Action.java
Normal file
@ -0,0 +1,13 @@
|
||||
package cs2030s.fp;
|
||||
/**
|
||||
* The Action interface that can be called
|
||||
* on an object of type T to act.
|
||||
* Contains a single abstract method call.
|
||||
* CS2030S Lab 4
|
||||
* AY22/23 Semester 1
|
||||
* @author Yadunand Prem (10B)
|
||||
*/
|
||||
|
||||
public interface Action<T> {
|
||||
void call(T item);
|
||||
}
|
14
Lab5/cs2030s/fp/Actionable.java
Normal file
14
Lab5/cs2030s/fp/Actionable.java
Normal file
@ -0,0 +1,14 @@
|
||||
package cs2030s.fp;
|
||||
/**
|
||||
* The Actionable interface that can
|
||||
* act when given an action.
|
||||
* Contains a single abstract method act.
|
||||
* CS2030S Lab 4
|
||||
* AY22/23 Semester 1
|
||||
* @author Yadunand Prem (10B)
|
||||
*/
|
||||
|
||||
// act consumes the T and passes it to action, thus super
|
||||
public interface Actionable<T> {
|
||||
public void act(Action<? super T> action);
|
||||
}
|
13
Lab5/cs2030s/fp/Immutator.java
Normal file
13
Lab5/cs2030s/fp/Immutator.java
Normal file
@ -0,0 +1,13 @@
|
||||
package cs2030s.fp;
|
||||
/**
|
||||
* The Immutator interface that can transform
|
||||
* to type T2, an object of type T1.
|
||||
* Contains a single abstract method invoke.
|
||||
* CS2030S Lab 4
|
||||
* AY22/23 Semester 1
|
||||
* @author Yadunand Prem (10B)
|
||||
*/
|
||||
|
||||
public interface Immutator<R, P> {
|
||||
public R invoke(P param);
|
||||
}
|
14
Lab5/cs2030s/fp/Immutatorable.java
Normal file
14
Lab5/cs2030s/fp/Immutatorable.java
Normal file
@ -0,0 +1,14 @@
|
||||
package cs2030s.fp;
|
||||
/**
|
||||
* The Immutatorable interface that can
|
||||
* transform when given something that is
|
||||
* Immutator.
|
||||
* Contains a single abstract method transform.
|
||||
* CS2030S Lab 4
|
||||
* AY22/23 Semester 1
|
||||
* @author Yadunand Prem (10B)
|
||||
*/
|
||||
|
||||
public interface Immutatorable<T> {
|
||||
public <R> Immutatorable<R> transform(Immutator<? extends R, ? super T> immutator);
|
||||
}
|
Loading…
Reference in New Issue
Block a user