diff --git a/src/org/nwapw/abacus/number/Function.java b/src/org/nwapw/abacus/number/Function.java index 9659c59..8b42124 100644 --- a/src/org/nwapw/abacus/number/Function.java +++ b/src/org/nwapw/abacus/number/Function.java @@ -2,14 +2,11 @@ package org.nwapw.abacus.number; public abstract class Function { - public int arity; + protected abstract boolean matchesParams(Number[] params); + protected abstract Number applyInternal(Number[] params); - protected abstract Number applyInternal(Number...params); - - public Number apply(Number...params) throws IllegalArgumentException { - if(params.length != arity) - throw new IllegalArgumentException("Invalid number of arguments: Function takes " - + arity + ", " + params.length + " provided."); + public Number apply(Number...params) { + if(!matchesParams(params)) return null; return applyInternal(params); }