From 385a64eace766526b3565d125a625391a4ff4fb5 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Sat, 26 Aug 2017 11:52:02 -0700 Subject: [PATCH] Make ReducerApplicable an independent interface. --- .../function/applicable/ReducerApplicable.kt | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/core/src/main/kotlin/org/nwapw/abacus/function/applicable/ReducerApplicable.kt b/core/src/main/kotlin/org/nwapw/abacus/function/applicable/ReducerApplicable.kt index 6de6a27..f1a3036 100644 --- a/core/src/main/kotlin/org/nwapw/abacus/function/applicable/ReducerApplicable.kt +++ b/core/src/main/kotlin/org/nwapw/abacus/function/applicable/ReducerApplicable.kt @@ -11,20 +11,18 @@ import org.nwapw.abacus.tree.Reducer * @param the return type of the application. * @param the required type of the reducer. */ -interface ReducerApplicable : Applicable { - - override fun applyInternal(params: Array): O? { - return null - } - - override fun apply(vararg params: T): O? { - return null - } +interface ReducerApplicable { + /** + * Checks if this applicable can be applied to the + * given parameters. + * @param params the parameters to check. + */ + fun matchesParams(params: Array): Boolean /** * Applies this applicable to the given arguments, and reducer. * @param reducer the reducer to use in the application. - * @param args the arguments to apply to. + * @param params the arguments to apply to. * @return the result of the application. */ fun applyWithReducerInternal(reducer: Reducer, params: Array): O? @@ -32,7 +30,7 @@ interface ReducerApplicable : Applicable * Applies this applicable to the given arguments, and reducer, * if the arguments and reducer are compatible with this applicable. * @param reducer the reducer to use in the application. - * @param args the arguments to apply to. + * @param params the arguments to apply to. * @return the result of the application, or null if the arguments are incompatible. */ fun applyWithReducer(reducer: Reducer, vararg params: T): O? {