finishing touches
This commit is contained in:
@@ -12,5 +12,5 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
interface Applicable<T> {
|
interface Applicable<T> {
|
||||||
<R> Applicable<R> apply(Immutator<Probably<R>, Probably<T>> immutator);
|
<R> Applicable<R> apply(Probably<Immutator<R, T>> probablyImmutator);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* CS2030S Lab 4
|
* CS2030S Lab 4
|
||||||
* AY22/23 Semester 1
|
* AY22/23 Semester 1
|
||||||
*
|
*
|
||||||
* @author Put Your Name (Lab Group)
|
* @author Yadunand Prem (10B)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Improbable<T> implements Immutator<Probably<T>, T> {
|
class Improbable<T> implements Immutator<Probably<T>, T> {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
* CS2030S Lab 4
|
* CS2030S Lab 4
|
||||||
* AY22/23 Semester 1
|
* AY22/23 Semester 1
|
||||||
*
|
*
|
||||||
* @author Put Your Name (Lab Group)
|
* @author Yadunand Prem (10B)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class IsModEq implements Immutator<Boolean, Integer> {
|
class IsModEq implements Immutator<Boolean, Integer> {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* CS2030S Lab 4
|
* CS2030S Lab 4
|
||||||
* AY22/23 Semester 1
|
* AY22/23 Semester 1
|
||||||
*
|
*
|
||||||
* @author Put Your Name (Lab Group)
|
* @author Yadunand Prem (10B)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Print implements Action<Object> {
|
class Print implements Action<Object> {
|
||||||
|
|||||||
@@ -124,11 +124,11 @@ class Probably<T> implements Actionable<T>, Immutatorable<T>, Applicable<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <R> Probably<R> apply(Immutator<Probably<R>, Probably<T>> immutator) {
|
public <R> Probably<R> apply(Probably<Immutator<R, T>> probablyImmutator) {
|
||||||
if (this.value == null) {
|
if (this.value != null && probablyImmutator.value != null) {
|
||||||
return none();
|
return just(probablyImmutator.value.invoke(this.value));
|
||||||
}
|
}
|
||||||
return immutator.invoke(this);
|
return none();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user