finishing touches

This commit is contained in:
Yadunand Prem
2022-09-19 20:30:36 +08:00
parent 05a6f3e572
commit caccc490fe
6 changed files with 11 additions and 11 deletions

View File

@@ -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);
} }

View File

@@ -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> {

View File

@@ -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> {

View File

@@ -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> {

View File

@@ -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();
} }
} }