From 20b77430a948d7b48c0987056ca4385100043630 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Tue, 25 Jul 2017 11:14:59 -0700 Subject: [PATCH] Add an abstact class for external functions --- .../nwapw/abacus/number/externalFunction.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/org/nwapw/abacus/number/externalFunction.java diff --git a/src/org/nwapw/abacus/number/externalFunction.java b/src/org/nwapw/abacus/number/externalFunction.java new file mode 100644 index 0000000..bcc4786 --- /dev/null +++ b/src/org/nwapw/abacus/number/externalFunction.java @@ -0,0 +1,28 @@ +package org.nwapw.abacus.number; + +import java.util.HashMap; + +public abstract class externalFunction { + + private HashMap functions; + + public externalFunction(){ + functions=new HashMap<>(); + } + + public boolean hasFunction(Function x){ + return functions.containsKey(x); + } + public Function getFunction(String x){ + return functions.get(x); + } + public boolean registerFunction(String x, Function y){ + if(!functions.containsKey(x)) + return functions.put(x,y)==null; + return false; + } + public Function functionFor(String x){ + return null; + } + public abstract void load(); +}