mirror of
https://github.com/DanilaFe/abacus
synced 2024-11-13 14:19:53 -08:00
Add an abstact class for external functions
This commit is contained in:
parent
3b91304175
commit
20b77430a9
28
src/org/nwapw/abacus/number/externalFunction.java
Normal file
28
src/org/nwapw/abacus/number/externalFunction.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package org.nwapw.abacus.number;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public abstract class externalFunction {
|
||||
|
||||
private HashMap<String, Function> 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();
|
||||
}
|
Loading…
Reference in New Issue
Block a user