Package com.singularsys.jep
Class FunctionTable
java.lang.Object
com.singularsys.jep.FunctionTable
- All Implemented Interfaces:
JepComponent,Serializable
- Direct Known Subclasses:
BigDecFunctionTable,CaseInsensitiveFunctionTable,NullWrappedFunctionTable,RealFunctionTable,StandardFunctionTable
A table holding details of the functions known to Jep.
This class has no functions loaded.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionConstructor with an empty map.protectedFunctionTable(Map<String, PostfixMathCommandI> oldMap) Constructor with a pre-specified map. -
Method Summary
Modifier and TypeMethodDescriptionaddFunction(String name, PostfixMathCommandI pfmc) voidclear()booleancontainsKey(String key) booleancontainsValue(PostfixMathCommandI value) entrySet()getFunction(String name) Returnsthis.voidInitialize the component.booleanisEmpty()keySet()Returns a new shallow copy of this function table.intsize()protected Map<String,PostfixMathCommandI> Return a copy of the internal map with the same set of functions as this one.toString()values()
-
Field Details
-
table
-
-
Constructor Details
-
FunctionTable
public FunctionTable()Constructor with an empty map. -
FunctionTable
Constructor with a pre-specified map. Subclasses should define similar constructors to allow theshallowCopy()to work.- Parameters:
oldMap- map with existing set of functions- Since:
- 4.0
-
-
Method Details
-
init
Description copied from interface:JepComponentInitialize the component. This method is called whenever a component is added to Jep. Hence, it allows components to keep track of the other components they may rely on.- Specified by:
initin interfaceJepComponent- Parameters:
jep- the current Jep instance
-
getFunction
-
addFunction
-
clear
public void clear() -
entrySet
-
isEmpty
public boolean isEmpty() -
keySet
-
size
public int size() -
values
-
containsKey
-
containsValue
-
remove
-
getLightWeightInstance
Returnsthis. If any functions are not thread-safe then useshallowCopy()instead.- Specified by:
getLightWeightInstancein interfaceJepComponent- Returns:
this
-
threadSafeMapCopy
Return a copy of the internal map with the same set of functions as this one. If any of the pfmc's implement theJepComponentinterface then that functionsJepComponent.getLightWeightInstance()method will be called to return a thread safe function. This method can be combined with theFunctionTable(Map)constructor to allow subclasses to implement a thread-safegetLightWeightInstance()method.- Returns:
- Since:
- 4.0
-
shallowCopy
Returns a new shallow copy of this function table. Calls thethreadSafeMapCopy()method to ensure the table is safe to use a separate thread. All subclasses should override this method to create a function table of the matching type. A typical implementation would be@Override public FunctionTable shallowCopy() { Map<String,PostfixMathCommandI> newMap = this.threadSafeMapCopy(); return new myFunctionTable(newMap); }using thethreadSafeMapCopy()method to return a copy of the map of operators and a constructor taking this map which uses theFunctionTable(Map)constructor.- Returns:
- a new shallow copy of this function table
-
toString
-