Class AbstractEval
java.lang.Object
com.singularsys.extensions.fastreal.AbstractEval
- All Implemented Interfaces:
GenericVisitor<Void,,Void, ParseException> JepComponent,Serializable
public abstract class AbstractEval
extends Object
implements GenericVisitor<Void,Void,ParseException>, JepComponent
Abstract base class for rpe-base evaluation routines.
Since Jep 4.1, extension 2.2, this now implements GenericVisitor
some method signatures have changed to be more specific.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List<PostfixMathCommandI> List of additional PFMC's needed for evaluation.HashMap for function name lookup.protected Jepprotected static final Stringprotected OperatorTableI -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchargeFunctionName(String oldname, String newname) Changes the name of the standard set functions used.protected voidduplicateCustomFunctions(AbstractEval rpe, Jep jep) Copies the set of custom functions.protected abstract ObjectgetConstantValue(short ref) getFunction(int ref) Returns the name of the function with a given reference number.protected shortgetUserFunction(String name, PostfixMathCommandI pfmc) voidCallsJepComponent.init(Jep)for any custom function which implementsJepComponent.makeException(String message) Create an Exception of the correct type.static StringstaticGetFunction(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, waitMethods inherited from interface com.singularsys.jep.GenericVisitor
makeException, visit, visit, visit, visit, visit, visitChildrenMethods inherited from interface com.singularsys.jep.JepComponent
getLightWeightInstance
-
Field Details
-
opSet
-
jep
-
functionHash
HashMap for function name lookup. Can't be static for cases when a function is renamed. -
customFunctionCommands
List of additional PFMC's needed for evaluation. Most function likesinare hard coded so don't appear here. -
ls
-
-
Constructor Details
-
AbstractEval
-
AbstractEval
protected AbstractEval()
-
-
Method Details
-
getUserFunction
-
getFunction
Returns the name of the function with a given reference number.- Parameters:
ref- reference number, one of those inRpConstantsor- Returns:
- the name of the function
-
staticGetFunction
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
-
init
CallsJepComponent.init(Jep)for any custom function which implementsJepComponent.- Specified by:
initin interfaceJepComponent- Parameters:
j- the current Jep instance
-
duplicateCustomFunctions
Copies the set of custom functions. If a function implementsJepComponentthen 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
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
-
makeException
Description copied from interface:GenericVisitorCreate an Exception of the correct type. A typical implementation is@Override public JepException makeException(String message) { return new JepException(message); }- Specified by:
makeExceptionin interfaceGenericVisitor<Void,Void, ParseException> - Parameters:
message- error message- Returns:
- an Exception
-