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

21 lines
563 B
Java
Raw Normal View History

package org.nwapw.abacus.number;
2017-07-24 14:26:09 -07:00
import java.util.HashMap;
public abstract class Function {
2017-07-24 14:26:09 -07:00
private static final HashMap<Class<? extends Number>, Integer> priorityMap =
new HashMap<Class<? extends Number>, Integer>() {{
put(NaiveNumber.class, 0);
}};
protected abstract boolean matchesParams(Number[] params);
protected abstract Number applyInternal(Number[] params);
public Number apply(Number...params) {
if(!matchesParams(params)) return null;
return applyInternal(params);
}
}