1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-11-16 07:33:09 -08:00
Abacus/src/org/nwapw/abacus/number/Function.java

17 lines
473 B
Java
Raw Normal View History

package org.nwapw.abacus.number;
public abstract class Function {
public int arity;
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.");
return applyInternal(params);
}
}