Package org.mariuszgromada.math.mxparser
Class Function
- java.lang.Object
-
- org.mariuszgromada.math.mxparser.PrimitiveElement
-
- org.mariuszgromada.math.mxparser.Function
-
- All Implemented Interfaces:
java.io.Serializable
public class Function extends PrimitiveElement implements java.io.Serializable
Function class provides possibility to define user functions. Functions can be used in further processing by any expression, dependent or recursive argument, function, etc... For example:- 'f(x) = sin(x)'
- 'g(x,y) = sin(x)+cos(y)'
- 'h(x,y = f(x)+g(y,x)'
- in general 'f(x1,x2,...,xn)' where x1,...,xn are arguments
When creating a function you should avoid names reserved as parser keywords, in general words known in mathematical language as function names, operators (for example: sin, cos, +, -, pi, e, etc...). Please be informed that after associating the constant with the expression, function or dependent/recursive argument its name will be recognized by the parser as reserved key word. It means that it could not be the same as any other key word known by the parser for this particular expression.
- Version:
- 6.1.0
- See Also:
RecursiveArgument,Expression,Argument,Constant,FunctionExtension, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intBODY_EXTENDEDFunction with body based on the extended code.static intBODY_RUNTIMEFunction with body based on the expression string.(package private) doublecomputingTimeKeeps computing timeprivate java.lang.Stringdescriptionfunction descriptionprivate java.lang.StringerrorMessageDefinitionError Message registered on function definition: - constructor, set name, ...private intfunctionBodyTypeFunction body type.(package private) ExpressionfunctionExpressionfunction expressionprivate FunctionExtensionfunctionExtensionFunction extension (body based in code)private FunctionExtensionVariadicfunctionExtensionVariadicFunction extension variadic (body based in code)private java.lang.StringfunctionNamefunction name(package private) booleanisVariadicIndicates whether UDF is variadicstatic booleanNO_SYNTAX_ERRORSStatus of the syntax - no syntax errorstatic intNOT_FOUNDWhen function was not foundprivate intparametersNumberThe number of function parametersprivate static intserialClassIDprivate static longserialVersionUIDstatic booleanSYNTAX_ERRORStatus of the syntax - syntax error or syntax status unknownstatic booleanSYNTAX_ERROR_OR_STATUS_UNKNOWNDeprecated.Planned to be removed, useSYNTAX_ERRORinsteadprivate static booleanSYNTAX_STATUS_UNKNOWNprivate booleansyntaxStatusDefinitionSyntax status registered on argument definition: - constructor, set name, ...private booleanthisAlreadyAddedstatic java.lang.StringTYPE_DESCstatic intTYPE_IDFunction type id identifier
-
Constructor Summary
Constructors Modifier Constructor Description Function(java.lang.String functionName, java.lang.String functionExpressionString, java.lang.String... argumentsNames)Constructor - creates function from function name, function expression string and argument names.Function(java.lang.String functionName, java.lang.String functionExpressionString, PrimitiveElement... elements)Constructor - creates function from function name and function expression string.Function(java.lang.String functionName, FunctionExtension functionExtension)Constructor for function definition based on your own source code - this is via implementation of FunctionExtension interface.Function(java.lang.String functionName, FunctionExtensionVariadic functionExtensionVariadic)Constructor for function definition based on your own source code - this is via implementation of FunctionExtensionVariadic interface.Function(java.lang.String functionDefinitionString, PrimitiveElement... elements)Constructor for function definition in natural math language, for instance providing on string "f(x,y) = sin(x) + cos(x)" is enough to define function "f" with parameters "x and y" and function body "sin(x) + cos(x)".privateFunction(Function functionToClone, boolean isThreadSafeClone, CloneCache cloneCache)Private constructor used for function cloning.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddArguments(Argument... arguments)Adds arguments (variadic) to the function expression definition.voidaddConstants(java.util.List<Constant> constantsList)Adds constants to the function expression definition.voidaddConstants(Constant... constants)Adds constants (variadic parameters) to the function expression definition.voidaddDefinitions(PrimitiveElement... elements)Adds user defined elements (such as: Arguments, Constants, Functions) to the function expressions.voidaddFunctions(Function... functions)Adds functions (variadic parameters) to the function expression definition.private voidaddHeadTokensArguments(java.util.List<Token> headTokens)(package private) voidaddRelatedExpression(Expression expression)Adds related expression.private static java.lang.StringbuildErrorMessageIncorrectNumberOfFunctionParameters(java.lang.String functionName, int expectedNumberOfParameters, int providedNumberOfParameters)private static java.lang.StringbuildErrorMessageInvalidFunctionDefinitionString(java.lang.String functionDefinitionString)private static java.lang.StringbuildErrorMessageInvalidFunctionName(java.lang.String functionName)doublecalculate()Calculates function valuedoublecalculate(double... parameters)Calculates function valuedoublecalculate(Argument... arguments)Calculates function valuedoublecalculate(CalcStepsRegister calcStepsRegister)Calculates function value and registers all the calculation steps(package private) voidcheckRecursiveMode()Checks whether function name appears in function body if yes the recursive mode is being setbooleancheckSyntax()Checks function syntaxprotected Functionclone()clone methodFunctioncloneForThreadSafe()Creates a completely independent 1-1 clone that can be safely used by a separate thread.(package private) FunctioncloneForThreadSafeInternal(CloneCache cloneCache)(package private) FunctioncloneForThreadSafeInternal(Expression relatedExpressionThatInitiatedClone, CloneCache cloneCache)private intcountRecursiveArguments()voiddefineArgument(java.lang.String argumentName, double argumentValue)Enables to define the argument (associated with the function expression) based on the argument name and the argument value.voiddefineArguments(java.lang.String... argumentsNames)Enables to define the arguments (associated with the function expression) based on the given arguments names.voiddefineConstant(java.lang.String constantName, double constantValue)Enables to define the constant (associated with the function expression) based on the constant name and constant value.voiddefineFunction(java.lang.String functionName, java.lang.String functionExpressionString, java.lang.String... argumentsNames)Enables to define the function (associated with the function expression) based on the function name, function expression string and arguments names (variadic parameters).ArgumentgetArgument(int argumentIndex)Gets argument from the function expression.ArgumentgetArgument(java.lang.String argumentName)Gets argument from the function expression.intgetArgumentIndex(java.lang.String argumentName)Gets argument index from the function expression.intgetArgumentsNumber()Gets number of arguments associated with the function expression.doublegetComputingTime()Gets computing timeConstantgetConstant(int constantIndex)Gets constant associated with the function expression.ConstantgetConstant(java.lang.String constantName)Gets constant associated with the function expression.intgetConstantIndex(java.lang.String constantName)Gets constant index associated with the function expression.intgetConstantsNumber()Gets number of constants associated with the function expression.java.lang.StringgetDescription()Gets function descriptionjava.lang.StringgetErrorMessage()Returns error message after checking the syntax.FunctiongetFunction(int functionIndex)Gets function associated with the function expression.FunctiongetFunction(java.lang.String functionName)Gets function associated with the function expression.intgetFunctionBodyType()Returns function body type:BODY_RUNTIMEBODY_EXTENDEDjava.lang.StringgetFunctionExpressionString()Gets function expression stringintgetFunctionIndex(java.lang.String functionName)Gets index of function associated with the function expression.java.lang.StringgetFunctionName()Gets function name.intgetFunctionsNumber()Gets number of functions associated with the function expression.java.lang.StringgetParameterName(int parameterIndex)Gets user defined function parameter nameintgetParametersNumber()Gets number of parameters associated with the function expression.booleangetRecursiveMode()Gets recursive mode statusbooleangetVerboseMode()Returns verbose mode statusprivate voidregisterNoSyntaxErrorInDefinition()private voidregisterSyntaxErrorInDefinition(java.lang.String errorMessage)voidremoveAllArguments()Removes all arguments associated with the function expression.voidremoveAllConstants()Removes all constants associated with the function expressionvoidremoveAllFunctions()Removes all functions associated with the function expression.voidremoveArguments(java.lang.String... argumentsNames)Removes first occurrences of the arguments associated with the function expression.voidremoveArguments(Argument... arguments)Removes first occurrences of the arguments associated with the function expression.voidremoveConstants(java.lang.String... constantsNames)Removes first occurrences of the constants associated with the function expression.voidremoveConstants(Constant... constants)Removes first occurrences of the constants associated with the function expressionvoidremoveDefinitions(PrimitiveElement... elements)Removes user defined elements (such as: Arguments, Constants, Functions) from the function expressions.voidremoveFunctions(java.lang.String... functionsNames)Removes first occurrences of the functions associated with the function expression.voidremoveFunctions(Function... functions)Removes first occurrences of the functions associated with the function expression.(package private) voidremoveRelatedExpression(Expression expression)Removes related expression.voidsetArgumentValue(int argumentIndex, double argumentValue)Sets value of function argument (function parameter).voidsetDescription(java.lang.String description)Sets function description.(package private) voidsetExpressionModifiedFlags()Set expression modified flags in the related expressions.voidsetFunction(java.lang.String functionDefinitionString, PrimitiveElement... elements)Deprecated.Planned to be removed, useaddFunctions(Function...),addDefinitions(PrimitiveElement...)insteadvoidsetFunctionName(java.lang.String functionName)Sets function name.voidsetParametersNumber(int parametersNumber)Set parameters number.voidsetSilentMode()Disables function verbose mode (sets default silent mode)voidsetVerboseMode()Enables verbose function mode-
Methods inherited from class org.mariuszgromada.math.mxparser.PrimitiveElement
getMyTypeId
-
-
-
-
Field Detail
-
serialClassID
private static final int serialClassID
- See Also:
- Constant Field Values
-
serialVersionUID
private static final long serialVersionUID
-
NO_SYNTAX_ERRORS
public static final boolean NO_SYNTAX_ERRORS
Status of the syntax - no syntax error- See Also:
- Constant Field Values
-
SYNTAX_ERROR
public static final boolean SYNTAX_ERROR
Status of the syntax - syntax error or syntax status unknown- See Also:
- Constant Field Values
-
SYNTAX_ERROR_OR_STATUS_UNKNOWN
@Deprecated public static final boolean SYNTAX_ERROR_OR_STATUS_UNKNOWN
Deprecated.Planned to be removed, useSYNTAX_ERRORinsteadStatus of the syntax - syntax error or syntax status unknown- See Also:
- Constant Field Values
-
SYNTAX_STATUS_UNKNOWN
private static final boolean SYNTAX_STATUS_UNKNOWN
- See Also:
- Constant Field Values
-
NOT_FOUND
public static final int NOT_FOUND
When function was not found- See Also:
- Constant Field Values
-
TYPE_ID
public static final int TYPE_ID
Function type id identifier- See Also:
- Constant Field Values
-
TYPE_DESC
public static java.lang.String TYPE_DESC
-
BODY_RUNTIME
public static final int BODY_RUNTIME
Function with body based on the expression string.- See Also:
getFunctionBodyType(), Constant Field Values
-
BODY_EXTENDED
public static final int BODY_EXTENDED
Function with body based on the extended code.
-
functionBodyType
private int functionBodyType
Function body type.- See Also:
BODY_RUNTIME,BODY_EXTENDED,getFunctionBodyType()
-
functionExpression
Expression functionExpression
function expression
-
functionName
private java.lang.String functionName
function name
-
syntaxStatusDefinition
private boolean syntaxStatusDefinition
Syntax status registered on argument definition: - constructor, set name, ...
-
errorMessageDefinition
private java.lang.String errorMessageDefinition
Error Message registered on function definition: - constructor, set name, ...
-
description
private java.lang.String description
function description
-
isVariadic
boolean isVariadic
Indicates whether UDF is variadic
-
parametersNumber
private int parametersNumber
The number of function parameters
-
functionExtension
private FunctionExtension functionExtension
Function extension (body based in code)
-
functionExtensionVariadic
private FunctionExtensionVariadic functionExtensionVariadic
Function extension variadic (body based in code)
-
computingTime
double computingTime
Keeps computing time
-
thisAlreadyAdded
private boolean thisAlreadyAdded
-
-
Constructor Detail
-
Function
public Function(java.lang.String functionName, java.lang.String functionExpressionString, PrimitiveElement... elements)Constructor - creates function from function name and function expression string.- Parameters:
functionName- the function namefunctionExpressionString- the function expression stringelements- Optional elements list (variadic - comma separated) of types: Argument, Constant, Function- See Also:
PrimitiveElement,Expression
-
Function
public Function(java.lang.String functionName, java.lang.String functionExpressionString, java.lang.String... argumentsNames)Constructor - creates function from function name, function expression string and argument names.- Parameters:
functionName- the function namefunctionExpressionString- the function expression stringargumentsNames- the arguments names (variadic parameters) comma separated list- See Also:
Expression
-
Function
public Function(java.lang.String functionDefinitionString, PrimitiveElement... elements)Constructor for function definition in natural math language, for instance providing on string "f(x,y) = sin(x) + cos(x)" is enough to define function "f" with parameters "x and y" and function body "sin(x) + cos(x)".- Parameters:
functionDefinitionString- Function definition in the form of one String, ie "f(x,y) = sin(x) + cos(x)"elements- Optional elements list (variadic - comma separated) of types: Argument, Constant, Function- See Also:
PrimitiveElement
-
Function
public Function(java.lang.String functionName, FunctionExtension functionExtension)Constructor for function definition based on your own source code - this is via implementation of FunctionExtension interface.- Parameters:
functionName- Function namefunctionExtension- Your own source code
-
Function
public Function(java.lang.String functionName, FunctionExtensionVariadic functionExtensionVariadic)Constructor for function definition based on your own source code - this is via implementation of FunctionExtensionVariadic interface.- Parameters:
functionName- Function namefunctionExtensionVariadic- Your own source code
-
Function
private Function(Function functionToClone, boolean isThreadSafeClone, CloneCache cloneCache)
Private constructor used for function cloning.- Parameters:
functionToClone- the function, which is going to be cloned.
-
-
Method Detail
-
buildErrorMessageInvalidFunctionName
private static java.lang.String buildErrorMessageInvalidFunctionName(java.lang.String functionName)
-
buildErrorMessageInvalidFunctionDefinitionString
private static java.lang.String buildErrorMessageInvalidFunctionDefinitionString(java.lang.String functionDefinitionString)
-
buildErrorMessageIncorrectNumberOfFunctionParameters
private static java.lang.String buildErrorMessageIncorrectNumberOfFunctionParameters(java.lang.String functionName, int expectedNumberOfParameters, int providedNumberOfParameters)
-
registerNoSyntaxErrorInDefinition
private void registerNoSyntaxErrorInDefinition()
-
registerSyntaxErrorInDefinition
private void registerSyntaxErrorInDefinition(java.lang.String errorMessage)
-
addHeadTokensArguments
private void addHeadTokensArguments(java.util.List<Token> headTokens)
-
setFunction
@Deprecated public void setFunction(java.lang.String functionDefinitionString, PrimitiveElement... elements)Deprecated.Planned to be removed, useaddFunctions(Function...),addDefinitions(PrimitiveElement...)insteadConstructor for function definition in natural math language, for instance providing on string "f(x,y) = sin(x) + cos(x)" is enough to define function "f" with parameters "x and y" and function body "sin(x) + cos(x)".- Parameters:
functionDefinitionString- Function definition in the form of one String, ie "f(x,y) = sin(x) + cos(x)"elements- Optional elements list (variadic - comma separated) of types: Argument, Constant, Function- See Also:
PrimitiveElement
-
setDescription
public void setDescription(java.lang.String description)
Sets function description.- Parameters:
description- the function description
-
getDescription
public java.lang.String getDescription()
Gets function description- Returns:
- Function description as string
-
getFunctionName
public java.lang.String getFunctionName()
Gets function name.- Returns:
- Function name as string.
-
getFunctionExpressionString
public java.lang.String getFunctionExpressionString()
Gets function expression string- Returns:
- Function expression as string.
-
setFunctionName
public void setFunctionName(java.lang.String functionName)
Sets function name.- Parameters:
functionName- the function name
-
setArgumentValue
public void setArgumentValue(int argumentIndex, double argumentValue)Sets value of function argument (function parameter).- Parameters:
argumentIndex- the argument index (in accordance to arguments declaration sequence)argumentValue- the argument value
-
getFunctionBodyType
public int getFunctionBodyType()
Returns function body type:BODY_RUNTIMEBODY_EXTENDED- Returns:
- Returns function body type:
BODY_RUNTIMEBODY_EXTENDED
-
checkSyntax
public boolean checkSyntax()
Checks function syntax- Returns:
- syntax status: Function.NO_SYNTAX_ERRORS, Function.SYNTAX_ERROR
-
getErrorMessage
public java.lang.String getErrorMessage()
Returns error message after checking the syntax.- Returns:
- Error message as string.
-
clone
protected Function clone()
clone method- Overrides:
clonein classjava.lang.Object
-
calculate
public double calculate()
Calculates function value- Returns:
- Function value as double.
-
calculate
public double calculate(CalcStepsRegister calcStepsRegister)
Calculates function value and registers all the calculation steps- Parameters:
calcStepsRegister- A collection to store list of calculation steps, steps registered as strings.- Returns:
- Function value as double.
-
calculate
public double calculate(double... parameters)
Calculates function value- Parameters:
parameters- the function parameters values (as doubles)- Returns:
- function value as double.
-
calculate
public double calculate(Argument... arguments)
Calculates function value- Parameters:
arguments- function parameters (as Arguments)- Returns:
- function value as double
-
addDefinitions
public void addDefinitions(PrimitiveElement... elements)
Adds user defined elements (such as: Arguments, Constants, Functions) to the function expressions.- Parameters:
elements- Elements list (variadic), where Argument, Constant, Function extend the same class PrimitiveElement- See Also:
PrimitiveElement
-
removeDefinitions
public void removeDefinitions(PrimitiveElement... elements)
Removes user defined elements (such as: Arguments, Constants, Functions) from the function expressions.- Parameters:
elements- Elements list (variadic), where Argument, Constant, Function extend the same class PrimitiveElement- See Also:
PrimitiveElement
-
countRecursiveArguments
private int countRecursiveArguments()
-
addArguments
public void addArguments(Argument... arguments)
Adds arguments (variadic) to the function expression definition.- Parameters:
arguments- the arguments list (comma separated list)- See Also:
Argument,RecursiveArgument
-
defineArguments
public void defineArguments(java.lang.String... argumentsNames)
Enables to define the arguments (associated with the function expression) based on the given arguments names.- Parameters:
argumentsNames- the arguments names (variadic) comma separated list- See Also:
Argument,RecursiveArgument
-
defineArgument
public void defineArgument(java.lang.String argumentName, double argumentValue)Enables to define the argument (associated with the function expression) based on the argument name and the argument value.- Parameters:
argumentName- the argument nameargumentValue- the argument value- See Also:
Argument,RecursiveArgument
-
getArgumentIndex
public int getArgumentIndex(java.lang.String argumentName)
Gets argument index from the function expression.- Parameters:
argumentName- the argument name- Returns:
- The argument index if the argument name was found, otherwise returns Argument.NOT_FOUND
- See Also:
Argument,RecursiveArgument
-
getArgument
public Argument getArgument(java.lang.String argumentName)
Gets argument from the function expression.- Parameters:
argumentName- the argument name- Returns:
- The argument if the argument name was found, otherwise returns null.
- See Also:
Argument,RecursiveArgument
-
getArgument
public Argument getArgument(int argumentIndex)
Gets argument from the function expression.- Parameters:
argumentIndex- the argument index- Returns:
- Argument if the argument index is between 0 and the last available argument index (getArgumentsNumber()-1), otherwise returns null.
- See Also:
Argument,RecursiveArgument
-
getParametersNumber
public int getParametersNumber()
Gets number of parameters associated with the function expression.- Returns:
- The number of function parameters (int >= 0)
- See Also:
Argument,RecursiveArgument
-
setParametersNumber
public void setParametersNumber(int parametersNumber)
Set parameters number.- Parameters:
parametersNumber- the number of function parameters (default = number of arguments (lower number might be specified).
-
getParameterName
public java.lang.String getParameterName(int parameterIndex)
Gets user defined function parameter name- Parameters:
parameterIndex- Parameter index between 0 and n-1- Returns:
- If parameter exists returns parameters name, otherwise empty string is returned.
-
getArgumentsNumber
public int getArgumentsNumber()
Gets number of arguments associated with the function expression.- Returns:
- The number of arguments (int >= 0)
- See Also:
Argument,RecursiveArgument
-
removeArguments
public void removeArguments(java.lang.String... argumentsNames)
Removes first occurrences of the arguments associated with the function expression.- Parameters:
argumentsNames- the arguments names (variadic parameters) comma separated list- See Also:
Argument,RecursiveArgument
-
removeArguments
public void removeArguments(Argument... arguments)
Removes first occurrences of the arguments associated with the function expression.- Parameters:
arguments- the arguments (variadic parameters) comma separated list- See Also:
Argument,RecursiveArgument
-
removeAllArguments
public void removeAllArguments()
Removes all arguments associated with the function expression.- See Also:
Argument,RecursiveArgument
-
addConstants
public void addConstants(Constant... constants)
Adds constants (variadic parameters) to the function expression definition.- Parameters:
constants- the constants (comma separated list)- See Also:
Constant
-
addConstants
public void addConstants(java.util.List<Constant> constantsList)
Adds constants to the function expression definition.- Parameters:
constantsList- the list of constants- See Also:
Constant
-
defineConstant
public void defineConstant(java.lang.String constantName, double constantValue)Enables to define the constant (associated with the function expression) based on the constant name and constant value.- Parameters:
constantName- the constant nameconstantValue- the constant value- See Also:
Constant
-
getConstantIndex
public int getConstantIndex(java.lang.String constantName)
Gets constant index associated with the function expression.- Parameters:
constantName- the constant name- Returns:
- Constant index if constant name was found, otherwise return Constant.NOT_FOUND.
- See Also:
Constant
-
getConstant
public Constant getConstant(java.lang.String constantName)
Gets constant associated with the function expression.- Parameters:
constantName- the constant name- Returns:
- Constant if constant name was found, otherwise return null.
- See Also:
Constant
-
getConstant
public Constant getConstant(int constantIndex)
Gets constant associated with the function expression.- Parameters:
constantIndex- the constant index- Returns:
- Constant if the constantIndex is between 0 and the last available constant index (getConstantsNumber() - 1), otherwise it returns null.
- See Also:
Constant
-
getConstantsNumber
public int getConstantsNumber()
Gets number of constants associated with the function expression.- Returns:
- number of constants (int >= 0)
- See Also:
Constant
-
removeConstants
public void removeConstants(java.lang.String... constantsNames)
Removes first occurrences of the constants associated with the function expression.- Parameters:
constantsNames- the constants names (variadic parameters) comma separated list- See Also:
Constant
-
removeConstants
public void removeConstants(Constant... constants)
Removes first occurrences of the constants associated with the function expression- Parameters:
constants- the constants (variadic parameters) comma separated list- See Also:
Constant
-
removeAllConstants
public void removeAllConstants()
Removes all constants associated with the function expression- See Also:
Constant
-
addFunctions
public void addFunctions(Function... functions)
Adds functions (variadic parameters) to the function expression definition.- Parameters:
functions- the functions (variadic parameters) comma separated list- See Also:
Function
-
defineFunction
public void defineFunction(java.lang.String functionName, java.lang.String functionExpressionString, java.lang.String... argumentsNames)Enables to define the function (associated with the function expression) based on the function name, function expression string and arguments names (variadic parameters).- Parameters:
functionName- the function namefunctionExpressionString- the expression stringargumentsNames- the function arguments names (variadic parameters) comma separated list- See Also:
Function
-
getFunctionIndex
public int getFunctionIndex(java.lang.String functionName)
Gets index of function associated with the function expression.- Parameters:
functionName- the function name- Returns:
- Function index if function name was found, otherwise returns Function.NOT_FOUND
- See Also:
Function
-
getFunction
public Function getFunction(java.lang.String functionName)
Gets function associated with the function expression.- Parameters:
functionName- the function name- Returns:
- Function if function name was found, otherwise returns null.
- See Also:
Function
-
getFunction
public Function getFunction(int functionIndex)
Gets function associated with the function expression.- Parameters:
functionIndex- the function index- Returns:
- Function if function index is between 0 and the last available function index (getFunctionsNumber()-1), otherwise returns null.
- See Also:
Function
-
getFunctionsNumber
public int getFunctionsNumber()
Gets number of functions associated with the function expression.- Returns:
- number of functions (int >= 0)
- See Also:
Function
-
removeFunctions
public void removeFunctions(java.lang.String... functionsNames)
Removes first occurrences of the functions associated with the function expression.- Parameters:
functionsNames- the functions names (variadic parameters) comma separated list- See Also:
Function
-
removeFunctions
public void removeFunctions(Function... functions)
Removes first occurrences of the functions associated with the function expression.- Parameters:
functions- the functions (variadic parameters) comma separated list.- See Also:
Function
-
removeAllFunctions
public void removeAllFunctions()
Removes all functions associated with the function expression.- See Also:
Function
-
setVerboseMode
public void setVerboseMode()
Enables verbose function mode
-
setSilentMode
public void setSilentMode()
Disables function verbose mode (sets default silent mode)
-
getVerboseMode
public boolean getVerboseMode()
Returns verbose mode status- Returns:
- true if verbose mode is on, otherwise returns false
-
checkRecursiveMode
void checkRecursiveMode()
Checks whether function name appears in function body if yes the recursive mode is being set
-
getRecursiveMode
public boolean getRecursiveMode()
Gets recursive mode status- Returns:
- true if recursive mode is enabled, otherwise returns false
-
getComputingTime
public double getComputingTime()
Gets computing time- Returns:
- computing time in seconds.
-
addRelatedExpression
void addRelatedExpression(Expression expression)
Adds related expression.- Parameters:
expression- the related expression
-
removeRelatedExpression
void removeRelatedExpression(Expression expression)
Removes related expression.- Parameters:
expression- the related expression
-
setExpressionModifiedFlags
void setExpressionModifiedFlags()
Set expression modified flags in the related expressions.
-
cloneForThreadSafeInternal
Function cloneForThreadSafeInternal(CloneCache cloneCache)
-
cloneForThreadSafeInternal
Function cloneForThreadSafeInternal(Expression relatedExpressionThatInitiatedClone, CloneCache cloneCache)
-
cloneForThreadSafe
public Function cloneForThreadSafe()
Creates a completely independent 1-1 clone that can be safely used by a separate thread. If the cloned element contains references to other elements (e.g. arguments, functions, constants), then they will also be cloned and the newly created element will contain references to the corresponding clones. Important - the API allows you to extract all these clones.- Returns:
- Cloned object.
-
-