Class AbstractEval
- java.lang.Object
-
- com.singularsys.extensions.fastreal.AbstractEval
-
- All Implemented Interfaces:
JepComponent
,ParserVisitor
,java.io.Serializable
public abstract class AbstractEval extends java.lang.Object implements ParserVisitor, JepComponent
Abstract base class for rpe-base evaluation routines.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<PostfixMathCommandI>
customFunctionCommands
List of additional PFMC's needed for evaluation.protected java.util.Map<java.lang.String,java.lang.Short>
functionHash
HashMap for function name lookup.protected Jep
jep
protected static java.lang.String
ls
protected OperatorTableI
opSet
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractEval()
AbstractEval(Jep jep)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
chargeFunctionName(java.lang.String oldname, java.lang.String newname)
Changes the name of the standard set functions used.protected void
duplicateCustomFunctions(AbstractEval rpe, Jep jep)
Copies the set of custom functions.protected abstract java.lang.Object
getConstantValue(short ref)
java.lang.String
getFunction(int ref)
Returns the name of the function with a given reference number.protected short
getUserFunction(java.lang.String name, PostfixMathCommandI pfmc)
void
init(Jep j)
CallsJepComponent.init(Jep)
for any custom function which implementsJepComponent
.static java.lang.String
staticGetFunction(int ref)
A static version of the function to retrieve names of functions.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.singularsys.jep.JepComponent
getLightWeightInstance
-
Methods inherited from interface com.singularsys.jep.ParserVisitor
visit, visit, visit, visit
-
-
-
-
Field Detail
-
opSet
protected transient OperatorTableI opSet
-
jep
protected transient Jep jep
-
functionHash
protected final java.util.Map<java.lang.String,java.lang.Short> functionHash
HashMap for function name lookup. Can't be static for cases when a function is renamed.
-
customFunctionCommands
protected java.util.List<PostfixMathCommandI> customFunctionCommands
List of additional PFMC's needed for evaluation. Most function likesin
are hard coded so don't appear here.
-
ls
protected static final java.lang.String ls
-
-
Constructor Detail
-
AbstractEval
public AbstractEval(Jep jep)
-
AbstractEval
protected AbstractEval()
-
-
Method Detail
-
getUserFunction
protected short getUserFunction(java.lang.String name, PostfixMathCommandI pfmc)
-
getFunction
public java.lang.String getFunction(int ref)
Returns the name of the function with a given reference number.- Parameters:
ref
- reference number, one of those inRpConstants
or- Returns:
- the name of the function
-
staticGetFunction
public static java.lang.String staticGetFunction(int ref)
A static version of the function to retrieve names of functions. As this is static names may not reflect names changed bychargeFunctionName(String, String)
.- Parameters:
ref
- reference number, one of those inRpConstants
- Returns:
-
getConstantValue
protected abstract java.lang.Object getConstantValue(short ref)
-
init
public void init(Jep j)
CallsJepComponent.init(Jep)
for any custom function which implementsJepComponent
.- Specified by:
init
in interfaceJepComponent
- Parameters:
j
- the current Jep instance
-
duplicateCustomFunctions
protected void duplicateCustomFunctions(AbstractEval rpe, Jep jep)
Copies the set of custom functions. If a function implementsJepComponent
then itsJepComponent.getLightWeightInstance()
method is called, otherwise the same instance is used.- Parameters:
rpe
- rpe instance to copy functions tojep
- jep instance for new context, can be null. If not null theJepComponent.init(Jep)
is called.
-
chargeFunctionName
public void chargeFunctionName(java.lang.String oldname, java.lang.String newname) throws JepException
Changes the name of the standard set functions used. The standard names are "sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh, abs, exp, log, ln, sqrt, sec, cosec, cot, atan2, if" which are implemented internally.- Parameters:
oldname
- name from listnewname
- replacement name- Throws:
JepException
- if oldname is not found
-
-