Package org.mariuszgromada.math.mxparser
Class Expression
- java.lang.Object
-
- org.mariuszgromada.math.mxparser.PrimitiveElement
-
- org.mariuszgromada.math.mxparser.Expression
-
- All Implemented Interfaces:
java.io.Serializable
public class Expression extends PrimitiveElement implements java.io.Serializable
Expression - base class for real expression definition. Examples:- '1+2'
- 'sin(x)+1'
- 'asin(3*x)^10-log(4,8)'
- in general 'f(x1,x2,...,xn)' where x1,...,xn are real arguments
Class provides easy way to define multivariate arithmetic expression.
- Version:
- 6.1.0
- See Also:
Argument,RecursiveArgument,Constant,Function, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.List<Argument>argumentsListList of argumentsprivate booleanattemptToFixExpStrEnabledInternal indicator informing the parser whether to try to fix the expression String.private CompilationDetailscompilationDetails(package private) doublecomputingTimeKeeps computing time(package private) java.util.List<Constant>constantsListList of user defined constantsprivate java.lang.StringdescriptionExpression description(package private) static booleanDISABLE_ROUNDING(package private) booleandisableRoundingInternal parameter for calculus expressions to avoid decrease in accuracy.private static doubleEEprivate static intERROR_MESSAGE_CALCULATE_MAXIMUM_LENGTHprivate java.lang.StringerrorMessageMessage after checking the syntaxprivate java.lang.StringerrorMessageCalculateOptional message from calculate method(package private) java.lang.StringexpressionStringExpression string (for example: "sin(x)+cos(y)")private java.lang.StringexpressionStringCleanedExpression string after attempt to clean(package private) booleanexpressionWasModifiedif true then new tokenizing is required (the initialTokens list needs to be updated)private booleanforwardErrorMessageAn indicator of whether an error message should be passed from the current expression to the expression that called it.(package private) static intFOUND(package private) java.util.List<Function>functionsListList of user defined functionsprivate static doubleGGprivate booleanimpliedMultiplicationErrorFires an error when impliedMultiplicationMode is on and there is a missing multiplication operatorprivate booleanimpliedMultiplicationModeImplied multiplication modeprivate CompilationDetailsinitialCompilationDetails(package private) java.util.List<Token>initialTokensList of expression tokens (words).(package private) static booleanINTERNALMarker for internal processingprivate booleaninternalCloneInternal indicator for calculation process Expression.Calculate() method It shows whether to build again tokens list if clone - build again if not clone - build only at the beginning Indicator helps to solve the problem with above definitions Function f = new Function("f(x) = 2*g(x)"); Function g = new Function("g(x) = 2*f(x)"); f.addDefinitions(g); g.addDefinitions(f);private booleanisFullyCompiled(package private) static booleanKEEP_ROUNDING_SETTINGSprivate java.util.List<KeyWord>keyWordsListList of keywords known by the parserprivate java.util.Set<java.lang.String>neverParseForImpliedMultiplicationList of string tokens that should not be considered while seeking for optional implied multiplication.private static booleanNO_EXP_STRstatic booleanNO_SYNTAX_ERRORSStatus of the syntax - no syntax error(package private) static intNOT_FOUNDFOUND / NOT_FOUND used for matching purposesprivate intoptionsChangesetNumbermXparser options changeset used in checkSyntax() methodprivate booleanparserKeyWordsOnlyInternal indicator for tokenization process if true, then keywords such as constants functions etc...private static doublePPprivate booleanrecursionCallPendingLog used internally to mark started recursion call on the current object, necessary to avoid infinite loops while recursive syntax checking (i.e.private intrecursionCallsCounterInternal counter to avoid infinite loops while calculating expression defined in the way showed by below examples Argument x = new Argument("x = 2*y"); Argument y = new Argument("y = 2*x"); x.addDefinitions(y); y.addDefinitions(x); Function f = new Function("f(x) = 2*g(x)"); Function g = new Function("g(x) = 2*f(x)"); f.addDefinitions(g); g.addDefinitions(f);(package private) booleanrecursiveModeIf recursive mode is on the recursive calls are permitted.(package private) java.util.List<Expression>relatedExpressionsListList of related expressions, for example when user defined function is used in the expression or dependent argument was defined.private 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 booleansyntaxStatusStatus of the expression syntax Please referet to the: - NO_SYNTAX_ERRORS - SYNTAX_ERROR - SYNTAX_STATUS_UNKNOWNprivate java.util.List<Token>tokensListthe initialTokens list keeps unchanged information about found tokens.static java.lang.StringTYPE_DESCstatic intTYPE_IDExpression type id(package private) booleanUDFExpressionIndicator whether expression was automatically built for user defined functions purpose(package private) java.util.List<java.lang.Double>UDFVariadicParamsAtRunTimeList of parameters provided by the user at run-timeprivate booleanunicodeKeyWordsEnabledInternal indicator informing hte parser that unicode know keywords are enabled and will be recognized by the parser as built-in functions or operatorsprivate booleanverboseModeVerbose mode prints processing info calls System.out.print* methodsprivate static booleanWITH_EXP_STRFor verbose mode purposes
-
Constructor Summary
Constructors Modifier Constructor Description (package private)Expression(java.lang.String expressionString, boolean parserKeyWordsOnly)Constructor - creates new expression from expression string.(package private)Expression(java.lang.String expressionString, java.util.List<Argument> argumentsList, java.util.List<Function> functionsList, java.util.List<Constant> constantsList, boolean internal, boolean UDFExpression, java.util.List<java.lang.Double> UDFVariadicParamsAtRunTime)Package level constructor - creates new expression from expression string, arguments list, functions list and constants list (used by the RecursiveArgument class).(package private)Expression(java.lang.String expressionString, java.util.List<Token> initialTokens, java.util.List<Argument> argumentsList, java.util.List<Function> functionsList, java.util.List<Constant> constantsList, boolean disableUlpRounding, boolean UDFExpression, java.util.List<java.lang.Double> UDFVariadicParamsAtRunTime)Package level constructor - creates new expression from subexpression (sublist of the tokens list), arguments list, functions list and constants list (used by the internal calculus operations, etc...).Expression(java.lang.String expressionString, PrimitiveElement... elements)Constructor - creates new expression from expression string.privateExpression(Expression expressionToClone, boolean isThreadSafeClone, CloneCache cloneCache)Expression(PrimitiveElement... elements)Default constructor - empty expression
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidABS(int pos)Absolut value Sets tokens to number tokenprivate voidACOS(int pos)Arcus cosine / Inverse trigonometric functions Sets tokens to number tokenprivate voidACTAN(int pos)Arcus cotangent / Inverse trigonometric functions Sets tokens to number tokenvoidaddArguments(Argument... arguments)Adds arguments (variadic) to the expression definition.voidaddConstants(java.util.List<Constant> constantsList)Adds constants to the expression definition.voidaddConstants(Constant... constants)Adds constants (variadic parameters) to the expression definition.voidaddDefinitions(PrimitiveElement... elements)Adds user defined elements (such as: Arguments, Constants, Functions) to the expressions.private voidaddFractionToken(Token token)Adds fraction token to the tokens listvoidaddFunctions(Function... functions)Adds functions (variadic parameters) to the expression definition.(package private) voidaddRelatedExpression(Expression expression)Adds related expression The same expression could be added more than once For example whenprivate voidaddToken(java.lang.String tokenStr, KeyWord keyWord)private voidaddToken(java.lang.String tokenStr, KeyWord keyWord, boolean parenthesisIsOnTheRight)Adds expression token Method is called by the tokenExpressionString() while parsing string expressionprivate voidaddUserDefinedKeyWords()private voidAND(int pos)Logical ANDprivate voidAND_VARIADIC(int pos)AND_VARIADICprivate intapplySequenceFromCompilation(CalcStepsRegister calcStepsRegister, java.lang.String stepDescription)private voidARCCSC(int pos)Arcuus cosecant Sets tokens to number tokenprivate voidARCOSH(int pos)Arcus hyperbolic cosine Sets tokens to number tokenprivate voidARCOTH(int pos)Arcus hyperbolic cotangent Sets tokens to number tokenprivate voidARCSCH(int pos)Arcus hyperbolic cosecant Sets tokens to number tokenprivate voidARCSEC(int pos)Arcuus secant Sets tokens to number tokenprivate voidARGMAX_VARIADIC(int pos)ARGMAX_VARIADICprivate voidARGMIN_VARIADIC(int pos)ARGMIN_VARIADICprivate voidARSECH(int pos)Arcus hyperbolic secant Sets tokens to number tokenprivate voidARSINH(int pos)Arcus hyperbolic sine Sets tokens to number tokenprivate voidARTANH(int pos)Arcus hyperbolic tangent Sets tokens to number tokenprivate voidASIN(int pos)Arcus sine / Inverse trigonometric functions Sets tokens to number tokenprivate voidassignKnownKeyword(Token token, KeyWord keyWord)Assign found known keyword to the tokenprivate voidATAN(int pos)Arcus tangent / Inverse trigonometric functions Sets tokens to number tokenprivate voidAVG(int pos)Average function value - iterative operator avg(i,m,n,f(i),b) --> avg f(i) from i=m to i=n by delta i - index (argument) m, n - numbers or expressions f(i) - function string by deltaprivate voidAVG_VARIADIC(int pos)Average variadic Sets tokens to number tokenprivate voidBACKWARD_DIFFERENCE(int pos)Backward diffrence operatorprivate voidBASE_VARIADIC(int pos)BASE_VARIADICprivate voidBELL_NUMBER(int pos)Bell numbersprivate voidBERNOULLI_NUMBER(int pos)Bernoulli Numberprivate voidBETA(int pos)Beta special functionprivate voidBINOM_COEFF(int pos)Binomial Coefficientprivate voidBITWISE_AND(int pos)Bitwise ANDprivate voidBITWISE_COMPL(int pos)Bitwise COMPLprivate voidBITWISE_LEFT_SHIFT(int pos)Bitwise LEFT SHIFTprivate voidBITWISE_NAND(int pos)Bitwise NANDprivate voidBITWISE_NOR(int pos)Bitwise NORprivate voidBITWISE_OR(int pos)Bitwise ORprivate voidBITWISE_RIGHT_SHIFT(int pos)Bitwise RIGHT SHIFTprivate voidBITWISE_XNOR(int pos)Bitwise NORprivate voidBITWISE_XOR(int pos)Bitwise XORprivate voidbitwiseCalc(int pos)Calculates Bitwise operatorsprivate voidbolCalc(int pos)Calculates boolean operatorsprivate voidcalcSetDecreaseRemove(int pos, double result)private voidcalcSetDecreaseRemove(int pos, double result, boolean ulpRound)SetDecreaseRemove for calculus operators.doublecalculate()Calculates the expression value and registers all the calculation stepsdoublecalculate(CalcStepsRegister calcStepsRegister)Calculates the expression valueprivate intcalculateFirstAndFullyCompile(CalcStepsRegister calcStepsRegister, java.lang.String stepDescription)private doublecalculateInternal(CalcStepsRegister calcStepsRegister)private voidcalculusCalc(int pos)Calculates calculus operatorsprivate voidCDF_CHI2(int pos)private voidCDF_F_SNEDECOR(int pos)Cumulative Distribution Function - Snedecor's F distributionprivate voidCDF_NORMAL(int pos)Cumulative Distribution Function - Normal distributionprivate voidCDF_STUDENT_T(int pos)private voidCDF_UNIFORM_CONT(int pos)Cumulative Distribution Function - Uniform Continuous distributionprivate voidCEIL(int pos)Ceil function Sets tokens to number tokenprivate booleancheckArgumentNameInCalculusOperator(Token token)Method used in case of implied multiplication, where x2x can be understood as x2*x sum( x2x, 1, 20, 2*x2x) x2x is not known and it will be prevented from split into x2*xprivate intcheckCalculusParameter(java.lang.String param)Checks syntax of the calculus parameterprivate booleancheckFraction(Token token)Checks whether unknown token represents fraction provided as fraction or mixed fractionbooleancheckIfAttemptToFixExpStrMode()Gets attempt to fix expression string modebooleancheckIfImpliedMultiplicationMode()Gets implied multiplication statusprivate static booleancheckIfKnownArgument(FunctionParameter param)Checks if argument given in the function parameter is known in the expression.booleancheckIfUnicodeBuiltinKeyWordsMode()Gets unicode built-in parser keywords modeprivate static booleancheckIfUnknownToken(FunctionParameter param)Checks if token is uknownprivate booleancheckInternalSyntaxCalculusOperatorDerivative(java.lang.String recursionInfoLevel, Token token, java.lang.String tokenInfoMessage, java.util.Stack<SyntaxStackElement> syntaxStack, int paramsNumber, java.util.List<FunctionParameter> funParams)private booleancheckInternalSyntaxCalculusOperatorDerivativeNth(java.lang.String recursionInfoLevel, Token token, java.lang.String tokenInfoMessage, java.util.Stack<SyntaxStackElement> syntaxStack, int paramsNumber, java.util.List<FunctionParameter> funParams)private booleancheckInternalSyntaxCalculusOperatorForwardBackwardDiff(java.lang.String recursionInfoLevel, Token token, java.lang.String tokenInfoMessage, java.util.Stack<SyntaxStackElement> syntaxStack, int paramsNumber, java.util.List<FunctionParameter> funParams)private booleancheckInternalSyntaxCalculusOperatorIntegralSolve(java.lang.String recursionInfoLevel, Token token, java.lang.String tokenInfoMessage, java.util.Stack<SyntaxStackElement> syntaxStack, int paramsNumber, java.util.List<FunctionParameter> funParams)private booleancheckInternalSyntaxCalculusOperatorIterated(java.lang.String recursionInfoLevel, Token token, java.lang.String tokenInfoMessage, java.util.Stack<SyntaxStackElement> syntaxStack, int paramsNumber, java.util.List<FunctionParameter> funParams)booleancheckLexSyntax()Checks syntax of the expression string.private booleancheckNumberNameManyImpliedMultiplication(Token token, boolean parenthesisIsOnTheRight)Handles implied multiplication logic in case of a single continuous string, e.g.private booleancheckOtherNumberBases(Token token)Checks whether unknown token represents number literal provided in different numeral base system, where base is between 1 and 36.private booleancheckPartialSyntaxBinaryFunction(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenInfoMessage)private booleancheckPartialSyntaxBuiltinConstant(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenInfoMessage)private booleancheckPartialSyntaxCalculusOperator(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenInfoMessage, java.util.Stack<SyntaxStackElement> syntaxStack)private booleancheckPartialSyntaxDuplicatedKeywords(java.lang.String recursionInfoLevel)private booleancheckPartialSyntaxImpliedMultiplication(java.lang.String recursionInfoLevel)private booleancheckPartialSyntaxInvalidToken(java.lang.String recursionInfoLevel, Token token, java.lang.String tokenInfoMessage, java.util.Stack<SyntaxStackElement> syntaxStack)private booleancheckPartialSyntaxTernaryFunction(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenInfoMessage)private booleancheckPartialSyntaxUnaryFunction(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenInfoMessage)private booleancheckPartialSyntaxUserDefinedArgument(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenInfoMessage)private booleancheckPartialSyntaxUserDefinedConstant(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenStr)private booleancheckPartialSyntaxUserDefinedFunction(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenInfoMessage)private booleancheckPartialSyntaxUserDefinedRecursiveArgument(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenInfoMessage)private booleancheckPartialSyntaxVariadicFunction(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenInfoMessage)private booleancheckSpecialConstantName(Token token)Check whether we have a case of '[abc]'booleancheckSyntax()Checks syntax of the expression string.private booleancheckSyntax(java.lang.String recursionInfoLevel, boolean functionWithBodyExt)Checking the syntax (recursively).private voidCHI(int pos)Characteristic function (a,b)private voidCHI_L(int pos)Characteristic function [a,b)private voidCHI_LR(int pos)Characteristic function [a,b]private voidCHI_R(int pos)Characteristic function (a,b]private voidCIMP(int pos)Logical CIMPprivate voidcleanExpressionString()Cleans blanks and other cases like "++', "+-", "-+"", "--"voidclearDescription()Clears expression descriptionvoidclearExpressionString()Clears expression stringprivate voidclearParamArgument(ArgumentParameter argParam)Clears argument parameter.protected Expressionclone()Expression cloning.ExpressioncloneForThreadSafe()Creates a completely independent 1-1 clone that can be safely used by a separate thread.(package private) ExpressioncloneForThreadSafeInternal(CloneCache cloneCache)private voidCNIMP(int pos)Logical CNIMPprivate voidCOALESCE(int pos)Coalesceprivate voidCOMMA(int pos)Parser symbols Removes commavoidconsolePrintCopyOfInitialTokens()Prints to the console copy of initial tokens.private voidCONSTANT(int pos)Constants handling.private voidCONTINUED_FRACTION(int pos)Continued fractionprivate voidCONTINUED_POLYNOMIAL(int pos)Continued polynomialprivate voidcopyInitialTokens()copy initial tokens list to tokens list and prepares initial compilation detailsprivate voidCOS(int pos)Cosine / Trigonometric functions Sets tokens to number tokenprivate voidCOSEC(int pos)Cosecant / Trigonometric functions Sets tokens to number tokenprivate voidCOSH(int pos)Hyperbolic cosine Sets tokens to number tokenprivate voidCOTH(int pos)Hyperbolic cotangent Sets tokens to number tokenprivate static java.util.List<Token>createInitialTokens(int startPos, int endPos, java.util.List<Token> tokensList)Creates string tokens list from the subexpression.private voidCSCH(int pos)Hyperbolic cosecant Sets tokens to number tokenprivate voidCTAN(int pos)Cotangent / Trigonometric functions Sets tokens to number tokenprivate voidCUBE_ROOT_OPERATOR(int pos)Cube root as unary left operatorvoiddefineArgument(java.lang.String argumentName, double argumentValue)Enables to define the argument (associated with the expression) based on the argument name and the argument value.voiddefineArguments(java.lang.String... argumentsNames)Enables to define the arguments (associated with the expression) based on the given arguments names.voiddefineConstant(java.lang.String constantName, double constantValue)Enables to define the constant (associated with the 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 expression) based on the function name, function expression string and arguments names (variadic parameters).private voidDEG(int pos)Converts radians to degrees Sets tokens to number tokenprivate voidDEPENDENT_ARGUMENT(int pos, CalcStepsRegister calcStepsRegister)Dependent Arguments handling.private voidDERIVATIVE(int pos, int derivativeType)Function derivativeprivate voidDERIVATIVE_NTH(int pos, int derivativeType)Function derivativeprivate voidDI_GAMMA(int pos)Digamma special function Sets tokens to number tokenprivate voidDIGIT(int pos)Digit at position - numeral system with given baseprivate voidDIGIT10(int pos)Digit at position - base 10 numeral systemvoiddisableAttemptToFixExpStrMode()Disables attempt to fix the expression String.voiddisableImpliedMultiplicationMode()Disables implied multiplication(package private) voiddisableRecursiveMode()Disables recursive modevoiddisableUnicodeBuiltinKeyWordsMode()Disables unicode built-in parser keywords, this flag informs the parser that built-in unicode keywords are not supported and will not be recognized as functions or operators.private voidDIVIDE(int pos)Division handling.private voidDIVIDE_QUOTIENT(int pos)Integer division handling.voidenableAttemptToFixExpStrMode()Enables attempt to fix the expression String.voidenableImpliedMultiplicationMode()Sets implied multiplicationvoidenableUnicodeBuiltinKeyWordsMode()Enables unicode built-in parser keywords, this flag informs the parser that built-in unicode keywords are supported and will be recognized as functions or operators.private voidEQ(int pos)Equality relation.private voidEQV(int pos)Logical EQVprivate voidEULER_NUMBER(int pos)Euler numberprivate voidEULER_POLYNOMIAL(int pos)Euler polynomialprivate voidevalFromToDeltaParameters(ArgumentParameter index, IterativeOperatorParameters iterParams)Evaluates ranges 'from', 'to', 'delta' for the iterative operatorprivate voidEXP(int pos)Exponential function Sets tokens to number tokenprivate voidEXP_INT(int pos)Exponential integral functionprivate voidexpressionInit()Common elements while expression initializingprivate voidexpressionInternalVarsInit()Common variables while expression initializingprivate voidf1ArgCalc(int pos)Calculates unary functionprivate voidf1SetDecreaseRemove(int pos, double result)private voidf1SetDecreaseRemove(int pos, double result, boolean ulpRound)SetDecreaseRemove for 1 arg functions SetDecreaseRemove like methods are called by the methods calculating values of the unary operation, binary relations and functions.private voidf2ArgCalc(int pos)Calculates binary functionprivate voidf2SetDecreaseRemove(int pos, double result)private voidf2SetDecreaseRemove(int pos, double result, boolean ulpRound)SetDecreaseRemove for 2-args functions For detailed specification refer to the f1SetDecreaseRemove()private voidf3ArgCalc(int pos)Calculates function with 3 argumentsprivate voidf3SetDecreaseRemove(int pos, double result)private voidf3SetDecreaseRemove(int pos, double result, boolean ulpRound)SetDecreaseRemove for 3-args functions For detailed specification refer to the f1SetDecreaseRemove()private voidFACT(int pos)Factorilal function Sets tokens to number tokenprivate voidFACTEXP(int pos)Prime factor value exponentprivate voidFACTVAL(int pos)Prime factor valueprivate voidFIBONACCI_NUMBER(int pos)Fibonacci numbersprivate voidFLOOR(int pos)Floor function Sets tokens to number tokenprivate voidFORWARD_DIFFERENCE(int pos)Forward difference operatorprivate voidFOURTH_ROOT_OPERATOR(int pos)Fourth root as unary left operatorprivate voidFREE_ARGUMENT(int pos)Free Arguments handling.private voidGAMMA(int pos)Gamma special function Sets tokens to number tokenprivate voidGAUSS_ERF(int pos)Gauss error functionprivate voidGAUSS_ERF_INV(int pos)Inverse of Gauss error functionprivate voidGAUSS_ERFC(int pos)Gauss complementary error functionprivate voidGAUSS_ERFC_INV(int pos)Inverse of Gauss complementary error functionprivate voidGCD(int pos)Greates Common Divisorprivate voidGEQ(int pos)Greater or equalArgumentgetArgument(int argumentIndex)Gets argument from the expression.ArgumentgetArgument(java.lang.String argumentName)Gets argument from the expression.intgetArgumentIndex(java.lang.String argumentName)Gets argument index from the expression.intgetArgumentsNumber()Gets number of arguments associated with the expression.doublegetArgumentValue(java.lang.String argumentName)Gets argument vale.java.lang.StringgetCanonicalExpressionString()Returns expression stringdoublegetComputingTime()Gets computing time.ConstantgetConstant(int constantIndex)Gets constant associated with the expression.ConstantgetConstant(java.lang.String constantName)Gets constant associated with the expression.intgetConstantIndex(java.lang.String constantName)Gets constant index associated with the expression.intgetConstantsNumber()Gets number of constants associated with the expression.java.util.List<Token>getCopyOfInitialTokens()Tokenizes expression string and returns tokens list, including: string, type, level.java.lang.StringgetDescription()Gets expression description.java.lang.StringgetErrorMessage()Method return error message after calling checkSyntax() method or calculate().java.lang.StringgetExpressionString()Returns expression stringFunctiongetFunction(int functionIndex)Gets function associated with the expression.FunctiongetFunction(java.lang.String functionName)Gets function associated with the expression.intgetFunctionIndex(java.lang.String functionName)Gets index of function associated with the expression.intgetFunctionsNumber()Gets number of functions associated with the expression.java.lang.StringgetHelp()Returns detailed user help on the syntax of mathematical expressions.java.lang.StringgetHelp(boolean addHeader, boolean addCaption, java.lang.String caption)Returns detailed user help on the syntax of mathematical expressions.java.lang.StringgetHelp(java.lang.String query)Returns detailed user help on the syntax of mathematical expressions.java.lang.StringgetHelp(java.lang.String query, boolean addHeader, boolean addCaption, java.lang.String caption)Returns detailed user help on the syntax of mathematical expressions.java.lang.StringgetHelpAsCsv()Returns (as CSV) detailed user help on the syntax of mathematical expressions.java.lang.StringgetHelpAsCsv(java.lang.String query)Returns (as CSV) detailed user help on the syntax of mathematical expressions.java.lang.StringgetHelpAsCsv(java.lang.String quote, java.lang.String delimiter, boolean addHeader)Returns (as CSV) detailed user help on the syntax of mathematical expressions.java.lang.StringgetHelpAsCsv(java.lang.String query, java.lang.String quote, java.lang.String delimiter, boolean addHeader)Returns (as CSV) detailed user help on the syntax of mathematical expressions.java.lang.StringgetHelpAsHtmlTable()Returns (as HTML table) detailed user help on the syntax of mathematical expressions.java.lang.StringgetHelpAsHtmlTable(boolean addHeader, boolean addCaption, boolean addFigure, java.lang.String caption, java.lang.String cssClass)Returns (as HTML table) detailed user help on the syntax of mathematical expressions.java.lang.StringgetHelpAsHtmlTable(java.lang.String query)Returns (as HTML table) detailed user help on the syntax of mathematical expressions.java.lang.StringgetHelpAsHtmlTable(java.lang.String query, boolean addHeader, boolean addCaption, boolean addFigure, java.lang.String caption, java.lang.String cssClass)Returns (as HTML table) detailed user help on the syntax of mathematical expressions.java.lang.StringgetHelpAsJson()Returns (as Json) detailed user help on the syntax of mathematical expressions.java.lang.StringgetHelpAsJson(boolean addCaption, java.lang.String caption)Returns (as Json) detailed user help on the syntax of mathematical expressions.java.lang.StringgetHelpAsJson(java.lang.String query)Returns (as Json) detailed user help on the syntax of mathematical expressions.java.lang.StringgetHelpAsJson(java.lang.String query, boolean addCaption, java.lang.String caption)Returns (as Json) detailed user help on the syntax of mathematical expressions.java.lang.StringgetHelpAsMarkdownTable()Returns (as Markdown table) detailed user help on the syntax of mathematical expressions.java.lang.StringgetHelpAsMarkdownTable(boolean addHeader, boolean addCaption, java.lang.String caption)Returns (as Markdown table) detailed user help on the syntax of mathematical expressions.java.lang.StringgetHelpAsMarkdownTable(java.lang.String query)Returns (as Markdown table) detailed user help on the syntax of mathematical expressions.java.lang.StringgetHelpAsMarkdownTable(java.lang.String query, boolean addHeader, boolean addCaption, java.lang.String caption)Returns (as Markdown table) detailed user help on the syntax of mathematical expressions.(package private) java.util.List<Token>getInitialTokens()Gets initial tokens and returns copied listjava.util.List<KeyWord>getKeyWords()Returns list of keywords known to the parserjava.util.List<KeyWord>getKeyWords(java.lang.String query)Returns list of keywords known to the parser.java.lang.String[]getMissingUserDefinedArguments()Returns missing user defined arguments names, i.e.java.lang.String[]getMissingUserDefinedFunctions()Returns missing user defined functions names, i.e.java.lang.String[]getMissingUserDefinedUnits()Returns missing user defined units names, i.e.private java.util.List<java.lang.Double>getNumbers(int pos)Creates ArraListcontaining function parameters private ArgumentParametergetParamArgument(java.lang.String argumentName)Gets / returns argument representing given argument name.private intgetParametersNumber(int pos)Return number of functions parameters.booleangetRecursiveMode()Gets recursive mode statusbooleangetSyntaxStatus()Gets syntax status of the expression.private doublegetTokenValue(int tokenIndex)Gets token valuebooleangetVerboseMode()Returns verbose mode status.private voidGT(int pos)Greater than.private voidHARMONIC_NUMBER(int pos)Harmonic numbersprivate voidHARMONIC2_NUMBER(int pos)Harmonic numbersprivate voidIF(int pos)IF Sets tokens to number tokenprivate voidIF_CONDITION(int pos)IF functionprivate voidIFF(int pos)IFF functionprivate voidifSetRemove(int pos, double ifCondition)private voidifSetRemove(int pos, double ifCondition, boolean ulpRound)If set remove method for the if function.private voidIMP(int pos)Logical IMPprivate voidINC_BETA(int pos)Incomplete beta special functionprivate voidINC_GAMMA_LOWER(int pos)Lower incomplete special Gamma functionprivate voidINC_GAMMA_UPPER(int pos)Upper incomplete special Gamma functionprivate voidinitialTokensAdd(Token token)Handles implied multiplication while adding single token to the tokens list is checking preceding tokenprivate voidinitialTokensAddTokenPart(TokenPart tokenPart)Handles adding token part after single token split in the proces of parsing implied multiplication.private voidinitParserKeyWords()Creates parser keywords listprivate voidINTEGRAL(int pos)Function integralprivate voidIS_PRIME(int pos)Prime testprivate voidISNAN(int pos)Is Not-a-Number Sets tokens to number tokenprivate voidKRONECKER_DELTA(int pos)Kronecker deltaprivate voidLAMBERT_W0(int pos)Lambert-W special function, principal branch 0 Sets tokens to number tokenprivate voidLAMBERT_W1(int pos)Lambert-W special function, branch = -1 Sets tokens to number tokenprivate voidLCM(int pos)Lowest Common Multiplyprivate voidLEQ(int pos)Lower or equal.private voidLN(int pos)Natural logarithm (base e) Sets tokens to number tokenprivate voidLOG(int pos)Logarithm Sets tokens to number tokenprivate voidLOG_BETA(int pos)Log beta special functionprivate voidLOG_GAMMA(int pos)Log Gamma special function Sets tokens to number tokenprivate voidLOG_INT(int pos)Logarithmic exponential integral functionprivate voidLOG10(int pos)Logarithm - base 10 Sets tokens to number tokenprivate voidLOG2(int pos)Logarithm - base 2 Sets tokens to number tokenprivate voidLT(int pos)Lower than.private voidLUCAS_NUMBER(int pos)Lucas numbersprivate java.lang.StringmakeStepDescription()(package private) voidmarkAsNotFullyCompiled()private voidMAX(int pos)Maximum value - iterative operator maxi(i,m,n,f(i),b) --> max f(i) from i=m to i=n by delta i - index (argument) m, n - numbers or expressions f(i) - function string by deltaprivate voidMAX_VARIADIC(int pos)Maximum variadic Sets tokens to number tokenprivate voidMEDIAN_VARIADIC(int pos)MEDIAN_VARIADICprivate voidMIN(int pos)Minimum value - iterative operator mini(i,m,n,f(i),b) --> min f(i) from i=m to i=n by delta i - index (argument) m, n - numbers or expressions f(i) - function string by deltaprivate voidMIN_VARIADIC(int pos)Minimum variadic Sets tokens to number tokenprivate voidMINUS(int pos)Subtraction handlingprivate voidMOD(int pos)Modulo Sets tokens to number tokenprivate voidMODE_VARIADIC(int pos)MODE_VARIADICprivate voidmodifyParserKeyWords()private voidMODULO(int pos)Modulo handling.private voidMULTIPLY(int pos)Multiplication handling.private voidNAND(int pos)Logical NANDprivate voidNDIG(int pos)Number of digits in given numeral systemprivate voidNDIG10(int pos)Number of digits in base 10 Sets tokens to number tokenprivate voidNDIST_VARIADIC(int pos)NDIST_VARIADICprivate voidNEG(int pos)Logical negationprivate voidNEQ(int pos)Not equals.private voidNFACT(int pos)Number of prime factors - distinct Sets tokens to number tokenprivate voidNIMP(int pos)Logical NIMPprivate voidNOR(int pos)Logical NORprivate voidNOT(int pos)Negation Sets tokens to number tokenprivate voidOFF_LOG_INT(int pos)Offset logarithmic exponential integral functionprivate voidopSetDecreaseRemove(int pos, double result)private voidopSetDecreaseRemove(int pos, double result, boolean ulpRound)SetDecreaseRemove for operators For detailed specification refer to the f1SetDecreaseRemove()private voidOR(int pos)Logical ORprivate voidOR_VARIADIC(int pos)OR_VARIADICprivate voidPARENTHESES(int lPos, int rPos)Parser symbols Removes parenthesisprivate voidPDF_CHI2(int pos)private voidPDF_F_SNEDECOR(int pos)Probability Distribution Function - Snedecor's F distributionprivate voidPDF_NORMAL(int pos)Probability Distribution Function - Normal distributionprivate voidPDF_STUDENT_T(int pos)private voidPDF_UNIFORM_CONT(int pos)Probability Distribution Function - Uniform Continuous distributionprivate voidPERC(int pos)Percentage Sets tokens to number tokenprivate static voidperformSyntaxStackPopIfEndOfSectionLevel(Token token, java.util.Stack<SyntaxStackElement> syntaxStack)private voidPERMUTATIONS(int pos)Number of permutationsprivate voidPLUS(int pos)Addition handling.private voidPOWER(int pos)Power handling.private voidPRIME_COUNT(int pos)Prime countingprivate voidprintSystemInfo(java.lang.String info, boolean withExpressionString)private voidPROD(int pos)Product operator (SIGMA by) pord(i,m,n,f(i),b) --> prod f(i) from i=m to i=n by delta i - index (argument) m, n - numbers or expressions f(i) - function string by deltaprivate voidPROD_VARIADIC(int pos)Sum variadic Sets tokens to number tokenprivate voidQNT_CHI2(int pos)private voidQNT_F_SNEDECOR(int pos)Quantile Function - Snedecor's F distributionprivate voidQNT_NORMAL(int pos)Quantile Function - Normal distributionprivate voidQNT_STUDENT_T(int pos)private voidQNT_UNIFORM_CONT(int pos)Quantile Function - Uniform Continuous distributionprivate voidRAD(int pos)Converts degrees to radius Sets tokens to number tokenprivate voidRANDOM_VARIABLE(int pos)Random Variables handling.private voidRECURSIVE_ARGUMENT(int pos)Recursive arguments handling.private voidREG_BETA(int pos)Regularized incomplete beta special functionprivate voidREG_GAMMA_LOWER(int pos)Lower regularized special Gamma functionprivate voidREG_GAMMA_UPPER(int pos)Lower regularized special Gamma functionprivate voidregisterCalculationStepRecord(CalcStepsRegister calcStepsRegister, int stepsRegisteredCounter, java.lang.String stepDescription)private voidregisterCalculationStepRecord(CalcStepsRegister calcStepsRegister, int stepsRegisteredCounter, java.lang.String stepDescription, double result)private voidregisterCompiledElement(CompiledElement.ToCall toCall, int position)private voidregisterCompiledElement(CompiledElement.ToCall toCall, int position1, int position2)private voidregisterErrorWhileCalculate(java.lang.String errorMessageToAdd)private voidregisterFinalSyntax(java.lang.String recursionInfoLevel, boolean syntax)private voidregisterFinalSyntaxAlreadyCheckedNorErrors(java.lang.String recursionInfoLevel)private voidregisterFinalSyntaxExpressionStringIsEmpty(java.lang.String recursionInfoLevel)private voidregisterFinalSyntaxFunctionWithBodyExtNoErrors(java.lang.String recursionInfoLevel)private voidregisterPartialSyntaxStartingSyntaxCheck(java.lang.String recursionInfoLevel)private voidregisterSyntaxLexicalError(java.lang.String recursionInfoLevel, java.lang.Throwable e)voidremoveAllArguments()Removes all arguments associated with the expression.voidremoveAllConstants()Removes all constants associated with the expressionvoidremoveAllFunctions()Removes all functions associated with the expression.voidremoveArguments(java.lang.String... argumentsNames)Removes first occurrences of the arguments associated with the expression.voidremoveArguments(Argument... arguments)Removes first occurrences of the arguments associated with the expression.voidremoveConstants(java.lang.String... constantsNames)Removes first occurrences of the constants associated with the expression.voidremoveConstants(Constant... constants)Removes first occurrences of the constants associated with the expressionvoidremoveDefinitions(PrimitiveElement... elements)Removes user defined elements (such as: Arguments, Constants, Functions) to the expressions.voidremoveFunctions(java.lang.String... functionsNames)Removes first occurrences of the functions associated with the expression.voidremoveFunctions(Function... functions)Removes first occurrences of the functions associated with the expression.(package private) voidremoveRelatedExpression(Expression expression)Removes related expressionprivate voidremoveTokens(int from, int to)private voidRND_CHI2(int pos)private voidRND_F_SNEDECOR(int pos)Random number - Snedecor's F distribution (F-distribution or F-ratio, also known as Fisher–Snedecor distribution)private voidRND_LIST(int pos)Random number from listprivate voidRND_NORMAL(int pos)Random number - Normal distributionprivate voidRND_STUDENT_T(int pos)private voidRND_VAR_UNIFORM_CONT(int pos)Random number - Uniform Continuous distributionprivate voidRND_VAR_UNIFORM_DISCR(int pos)Random number - Uniform Discrete distributionprivate voidROOT(int pos)Nth order rootprivate voidrootOperCalc(int pos)Unicode root operatorsprivate voidROUND(int pos)Decimal roundingprivate voidSA(int pos)SA / sinc normalizedprivate voidSEC(int pos)Secant / Trigonometric functions Sets tokens to number tokenprivate voidSECH(int pos)Hyperbolic secant Sets tokens to number tokenvoidsetArgumentValue(java.lang.String argumentName, double argumentValue)Sets argument value.voidsetDescription(java.lang.String description)Sets expression description.(package private) voidsetExpressionModifiedFlag()Sets expression status to modified Calls setExpressionModifiedFlag() method to all related expressions.voidsetExpressionString(java.lang.String expressionString)Sets (modifies expression) expression string.(package private) voidsetForwardErrorMessage(boolean forward)An indicator of whether an error message should be passed from the current expression to the expression that called it.(package private) voidsetRecursiveMode()Sets recursive modevoidsetSilentMode()Disables verbose mode (default silent mode).(package private) voidsetSyntaxStatus(boolean syntaxStatus, java.lang.String errorMessage)Package level method for passing information about errors identified on the constructors levelprivate voidsetToNumber(int pos, double number)private voidsetToNumber(int pos, double number, boolean ulpRound)Sets given token to the number type / value.voidsetVerboseMode()Enables verbose mode.private voidSGN(int pos)Signum function Sets tokens to number tokenprivate voidSGN_GAMMA(int pos)Signum of Gamma special function Sets tokens to number tokenprivate voidshowArguments()(package private) voidshowInitialTokens()shows initial tokens(package private) voidshowKeyWords()shows known keywordsprivate voidshowParsing(int lPos, int rPos)Shows parsing (verbose mode purposes).(package private) voidshowRelatedExpressions()Prints related expression list(package private) voidshowTokens()(package private) static voidshowTokens(java.util.List<Token> tokensList)private voidSIN(int pos)Sine functionprivate voidSINC(int pos)Sinc unnormalizedprivate voidSINH(int pos)Hyperbolic sine Sets tokens to number tokenprivate voidSOLVE(int pos)Function SOLVEprivate voidSQRT(int pos)Square root Sets tokens to number tokenprivate voidSQUARE_ROOT_OPERATOR(int pos)Square root as unary left operatorprivate voidSTD(int pos)Standard deviation from sample function values - iterative operator stdi(i,m,n,f(i),b) --> std f(i) from i=m to i=n by delta i - index (argument) m, n - numbers or expressions f(i) - function string by deltaprivate voidSTD_VARIADIC(int pos)Standard deviation variadic Sets tokens to number tokenprivate voidSTIRLING1_NUMBER(int pos)Stirling number of the first kindprivate voidSTIRLING2_NUMBER(int pos)Stirling number of the second kind.private voidSUM(int pos)Summation operator (SIGMA by) sum(i,m,n,f(i),b) --> sum f(i) from i=m to i=n by delta i - index (argument) m, n - numbers or expressions f(i) - function string by deltaprivate voidSUM_VARIADIC(int pos)Sum variadic Sets tokens to number tokenprivate booleansyntaxIsAlreadyCheckedNorErrors()private voidTAN(int pos)Tangent / Trigonometric functions Sets tokens to number tokenprivate voidTANH(int pos)Hyperbolic tangent Sets tokens to number tokenprivate voidTETRATION(int pos)Tetration handling.private voidtokenizeExpressionString()Tokenizing expression stringprivate booleantryAssignKnownKeyword(Token token)Tries to find known keyword for a given token via string matchingprivate KeyWordtryFindKnownKeyword(java.lang.String tokenStr)Tries to find known keyword for a given token via string matchingprivate voidUDF_PARAM(int pos)User Defined Variadic function param value Sets tokens to number tokenprivate voidULP(int pos)Unit in The Last Place Sets tokens to number tokenprivate voidUNIT(int pos)Constants handling.private static voidupdateMissingTokens(java.util.List<Token> tokens, java.lang.String keyWord, int tokenId, int tokenTypeId)Updating missing tokens (i.e.private static voidupdateMissingTokens(ArgumentParameter index, IterativeOperatorParameters iterParams)Update missing tokens in expression related to iterative operators.private voidUSER_CONSTANT(int pos)User constants handling.private voidUSER_FUNCTION(int pos, CalcStepsRegister calcStepsRegister)User functions handling.private voidvalidateParserKeyWords()Final validation of keywordsprivate voidVAR(int pos)Variance from sample function values - iterative operator vari(i,m,n,f(i),b) --> var f(i) from i=m to i=n by delta i - index (argument) m, n - numbers or expressions f(i) - function string by deltaprivate voidVAR_VARIADIC(int pos)Variance variadic Sets tokens to number tokenprivate voidvariadicFunCalc(int pos)Calculates Variadic functionprivate voidvariadicSetDecreaseRemove(int pos, double value, int length)private voidvariadicSetDecreaseRemove(int pos, double value, int length, boolean ulpRound)SetDecreaseRemove for special functions.private voidWORPITZKY_NUMBER(int pos)Worpitzky number.private voidXOR(int pos)Logical XORprivate voidXOR_VARIADIC(int pos)XOR_VARIADIC-
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
-
TYPE_ID
public static final int TYPE_ID
Expression type id- See Also:
- Constant Field Values
-
TYPE_DESC
public static java.lang.String TYPE_DESC
-
NOT_FOUND
static final int NOT_FOUND
FOUND / NOT_FOUND used for matching purposes- See Also:
- Constant Field Values
-
FOUND
static final int FOUND
- See Also:
- Constant Field Values
-
INTERNAL
static final boolean INTERNAL
Marker for internal processing- See Also:
- Constant Field Values
-
WITH_EXP_STR
private static final boolean WITH_EXP_STR
For verbose mode purposes- See Also:
- Constant Field Values
-
NO_EXP_STR
private static final boolean NO_EXP_STR
- See Also:
- Constant Field Values
-
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
-
expressionString
java.lang.String expressionString
Expression string (for example: "sin(x)+cos(y)")
-
expressionStringCleaned
private java.lang.String expressionStringCleaned
Expression string after attempt to clean
-
description
private java.lang.String description
Expression description
-
argumentsList
java.util.List<Argument> argumentsList
List of arguments- See Also:
Argument,RecursiveArgument
-
functionsList
java.util.List<Function> functionsList
List of user defined functions- See Also:
Function
-
constantsList
java.util.List<Constant> constantsList
List of user defined constants- See Also:
Constant
-
keyWordsList
private java.util.List<KeyWord> keyWordsList
List of keywords known by the parser
-
initialTokens
java.util.List<Token> initialTokens
List of expression tokens (words). Token class defines all needed attributes for recognizing the structure of arithmetic expression. This is the key result when initial parsing is finished (tokenizeExpressionString() - method). Token keeps information about: - token type (for example: function, operator, argument, number, etc...) - token identifier within given type (sin, cos, operaotr, etc...) - token value (if token is a number) - token level - key information regarding sequence (order) of further parsing
-
initialCompilationDetails
private CompilationDetails initialCompilationDetails
-
neverParseForImpliedMultiplication
private java.util.Set<java.lang.String> neverParseForImpliedMultiplication
List of string tokens that should not be considered while seeking for optional implied multiplication. Example: sum( x2y, 1, 10, 2*x2y) Here x2y should always stay as x2y
-
tokensList
private java.util.List<Token> tokensList
the initialTokens list keeps unchanged information about found tokens. While parsing the tokensList is used. The tokensList is the same as initialTokens list at the beginning of the calculation process. Each math operation changes tokens list - it means that tokens are parameters when performing math operation and the result is also presented as token (usually as a number token) At the end of the calculation the tokensList should contain only one element - the result of all calculations.
-
compilationDetails
private CompilationDetails compilationDetails
-
relatedExpressionsList
java.util.List<Expression> relatedExpressionsList
List of related expressions, for example when user defined function is used in the expression or dependent argument was defined. Modification of function expression calls the method expression modified flag method to all related expressions. Related expression usually are used for - dependent arguments - recursive arguments - user functions
-
computingTime
double computingTime
Keeps computing time
-
expressionWasModified
boolean expressionWasModified
if true then new tokenizing is required (the initialTokens list needs to be updated)
-
recursiveMode
boolean recursiveMode
If recursive mode is on the recursive calls are permitted. It means there will be no null pointer exceptions due to expression, and functions cloning.
-
verboseMode
private boolean verboseMode
Verbose mode prints processing info calls System.out.print* methods
-
impliedMultiplicationMode
private boolean impliedMultiplicationMode
Implied multiplication mode
-
impliedMultiplicationError
private boolean impliedMultiplicationError
Fires an error when impliedMultiplicationMode is on and there is a missing multiplication operator
-
disableRounding
boolean disableRounding
Internal parameter for calculus expressions to avoid decrease in accuracy.
-
DISABLE_ROUNDING
static final boolean DISABLE_ROUNDING
- See Also:
- Constant Field Values
-
KEEP_ROUNDING_SETTINGS
static final boolean KEEP_ROUNDING_SETTINGS
- See Also:
- Constant Field Values
-
syntaxStatus
private boolean syntaxStatus
Status of the expression syntax Please referet to the: - NO_SYNTAX_ERRORS - SYNTAX_ERROR - SYNTAX_STATUS_UNKNOWN
-
isFullyCompiled
private boolean isFullyCompiled
-
errorMessage
private java.lang.String errorMessage
Message after checking the syntax
-
errorMessageCalculate
private java.lang.String errorMessageCalculate
Optional message from calculate method
-
ERROR_MESSAGE_CALCULATE_MAXIMUM_LENGTH
private static final int ERROR_MESSAGE_CALCULATE_MAXIMUM_LENGTH
- See Also:
- Constant Field Values
-
recursionCallPending
private boolean recursionCallPending
Log used internally to mark started recursion call on the current object, necessary to avoid infinite loops while recursive syntax checking (i.e. f to g and g to f) or marking modified flags on the expressions related to this expression.- See Also:
setExpressionModifiedFlag(),checkSyntax()
-
recursionCallsCounter
private int recursionCallsCounter
Internal counter to avoid infinite loops while calculating expression defined in the way showed by below examples Argument x = new Argument("x = 2*y"); Argument y = new Argument("y = 2*x"); x.addDefinitions(y); y.addDefinitions(x); Function f = new Function("f(x) = 2*g(x)"); Function g = new Function("g(x) = 2*f(x)"); f.addDefinitions(g); g.addDefinitions(f);
-
parserKeyWordsOnly
private boolean parserKeyWordsOnly
Internal indicator for tokenization process if true, then keywords such as constants functions etc... will not be recognized during tokenization
-
unicodeKeyWordsEnabled
private boolean unicodeKeyWordsEnabled
Internal indicator informing hte parser that unicode know keywords are enabled and will be recognized by the parser as built-in functions or operators
-
attemptToFixExpStrEnabled
private boolean attemptToFixExpStrEnabled
Internal indicator informing the parser whether to try to fix the expression String. For example, situations such as: "++" change to "+", "+-" changed tro "-" "-+" changed tro "-" "--" changed tro "+"
-
UDFExpression
boolean UDFExpression
Indicator whether expression was automatically built for user defined functions purpose- See Also:
Function
-
UDFVariadicParamsAtRunTime
java.util.List<java.lang.Double> UDFVariadicParamsAtRunTime
List of parameters provided by the user at run-time- See Also:
Function
-
internalClone
private boolean internalClone
Internal indicator for calculation process Expression.Calculate() method It shows whether to build again tokens list if clone - build again if not clone - build only at the beginning Indicator helps to solve the problem with above definitions Function f = new Function("f(x) = 2*g(x)"); Function g = new Function("g(x) = 2*f(x)"); f.addDefinitions(g); g.addDefinitions(f);
-
forwardErrorMessage
private boolean forwardErrorMessage
An indicator of whether an error message should be passed from the current expression to the expression that called it.
-
optionsChangesetNumber
private int optionsChangesetNumber
mXparser options changeset used in checkSyntax() method
-
PP
private static final double PP
-
EE
private static final double EE
-
GG
private static final double GG
-
-
Constructor Detail
-
Expression
public Expression(PrimitiveElement... elements)
Default constructor - empty expression- Parameters:
elements- Optional elements list (variadic - comma separated) of types: Argument, Constant, Function- See Also:
PrimitiveElement
-
Expression
public Expression(java.lang.String expressionString, PrimitiveElement... elements)Constructor - creates new expression from expression string.- Parameters:
expressionString- definition of the expressionelements- Optional elements list (variadic - comma separated) of types: Argument, Constant, Function- See Also:
PrimitiveElement
-
Expression
Expression(java.lang.String expressionString, boolean parserKeyWordsOnly)Constructor - creates new expression from expression string.- Parameters:
expressionString- definition of the expressionparserKeyWordsOnly- if true then all keywords such as functions, constants, arguments will not be recognized.
-
Expression
Expression(java.lang.String expressionString, java.util.List<Token> initialTokens, java.util.List<Argument> argumentsList, java.util.List<Function> functionsList, java.util.List<Constant> constantsList, boolean disableUlpRounding, boolean UDFExpression, java.util.List<java.lang.Double> UDFVariadicParamsAtRunTime)Package level constructor - creates new expression from subexpression (sublist of the tokens list), arguments list, functions list and constants list (used by the internal calculus operations, etc...).- Parameters:
expressionString- the expression stringinitialTokens- the tokens list (starting point - no tokenizing, no syntax checking)argumentsList- the arguments listfunctionsList- the functions listconstantsList- the constants list
-
Expression
Expression(java.lang.String expressionString, java.util.List<Argument> argumentsList, java.util.List<Function> functionsList, java.util.List<Constant> constantsList, boolean internal, boolean UDFExpression, java.util.List<java.lang.Double> UDFVariadicParamsAtRunTime)Package level constructor - creates new expression from expression string, arguments list, functions list and constants list (used by the RecursiveArgument class). No related expressions at the beginning.- Parameters:
expressionString- the expression stringargumentsList- the arguments listfunctionsList- the functions listconstantsList- the constants listinternal- the marker for internal processing- See Also:
Argument,RecursiveArgument,Function,Constant
-
Expression
private Expression(Expression expressionToClone, boolean isThreadSafeClone, CloneCache cloneCache)
-
-
Method Detail
-
addRelatedExpression
void addRelatedExpression(Expression expression)
Adds related expression The same expression could be added more than once For example when- Parameters:
expression- the expression
-
removeRelatedExpression
void removeRelatedExpression(Expression expression)
Removes related expression- Parameters:
expression- the expression
-
showRelatedExpressions
void showRelatedExpressions()
Prints related expression list
-
getErrorMessage
public java.lang.String getErrorMessage()
Method return error message after calling checkSyntax() method or calculate().- Returns:
- Error message as string.
-
getSyntaxStatus
public boolean getSyntaxStatus()
Gets syntax status of the expression.- Returns:
- true if there are no syntax errors, false when syntax error was found or syntax status is unknown
-
setSyntaxStatus
void setSyntaxStatus(boolean syntaxStatus, java.lang.String errorMessage)Package level method for passing information about errors identified on the constructors level- Parameters:
syntaxStatus- Syntax statuserrorMessage- Error message- See Also:
Function
-
markAsNotFullyCompiled
void markAsNotFullyCompiled()
-
setExpressionModifiedFlag
void setExpressionModifiedFlag()
Sets expression status to modified Calls setExpressionModifiedFlag() method to all related expressions.
-
expressionInternalVarsInit
private void expressionInternalVarsInit()
Common variables while expression initializing
-
expressionInit
private void expressionInit()
Common elements while expression initializing
-
setExpressionString
public void setExpressionString(java.lang.String expressionString)
Sets (modifies expression) expression string.- Parameters:
expressionString- the expression string
-
getExpressionString
public java.lang.String getExpressionString()
Returns expression string- Returns:
- Expression string definition.
-
getCanonicalExpressionString
public java.lang.String getCanonicalExpressionString()
Returns expression string- Returns:
- Expression string definition.
-
clearExpressionString
public void clearExpressionString()
Clears expression string
-
setDescription
public void setDescription(java.lang.String description)
Sets expression description.- Parameters:
description- the description string
-
getDescription
public java.lang.String getDescription()
Gets expression description.- Returns:
- String description.
-
clearDescription
public void clearDescription()
Clears expression description
-
setVerboseMode
public void setVerboseMode()
Enables verbose mode.
-
setSilentMode
public void setSilentMode()
Disables verbose mode (default silent mode).
-
getVerboseMode
public boolean getVerboseMode()
Returns verbose mode status.- Returns:
- true if verbose mode is on, otherwise returns false.
-
enableImpliedMultiplicationMode
public void enableImpliedMultiplicationMode()
Sets implied multiplication
-
disableImpliedMultiplicationMode
public void disableImpliedMultiplicationMode()
Disables implied multiplication
-
checkIfImpliedMultiplicationMode
public boolean checkIfImpliedMultiplicationMode()
Gets implied multiplication status- Returns:
- true if implied multiplication is enabled, otherwise returns false.
-
enableUnicodeBuiltinKeyWordsMode
public void enableUnicodeBuiltinKeyWordsMode()
Enables unicode built-in parser keywords, this flag informs the parser that built-in unicode keywords are supported and will be recognized as functions or operators.
-
disableUnicodeBuiltinKeyWordsMode
public void disableUnicodeBuiltinKeyWordsMode()
Disables unicode built-in parser keywords, this flag informs the parser that built-in unicode keywords are not supported and will not be recognized as functions or operators.
-
checkIfUnicodeBuiltinKeyWordsMode
public boolean checkIfUnicodeBuiltinKeyWordsMode()
Gets unicode built-in parser keywords mode- Returns:
- true if unicode built-in parser keywords is enabled, otherwise returns false.
-
enableAttemptToFixExpStrMode
public void enableAttemptToFixExpStrMode()
Enables attempt to fix the expression String. For example, situations such as: "++" change to "+", "+-" changed to "-" "-+" changed to "-" "--" changed to "+"
-
disableAttemptToFixExpStrMode
public void disableAttemptToFixExpStrMode()
Disables attempt to fix the expression String. For example, situations such as: "++" change to "+", "+-" changed to "-" "-+" changed to "-" "--" changed ro "+"
-
checkIfAttemptToFixExpStrMode
public boolean checkIfAttemptToFixExpStrMode()
Gets attempt to fix expression string mode- Returns:
- true attempt to fix expression string mode is enabled, otherwise returns false.
-
setRecursiveMode
void setRecursiveMode()
Sets recursive mode
-
disableRecursiveMode
void disableRecursiveMode()
Disables recursive mode
-
getRecursiveMode
public boolean getRecursiveMode()
Gets recursive mode status- Returns:
- true if recursive mode is enabled, otherwise returns false.
-
setForwardErrorMessage
void setForwardErrorMessage(boolean forward)
An indicator of whether an error message should be passed from the current expression to the expression that called it.- Parameters:
forward- If true then message is being forwarded.
-
getComputingTime
public double getComputingTime()
Gets computing time.- Returns:
- computing time in seconds.
-
addDefinitions
public void addDefinitions(PrimitiveElement... elements)
Adds user defined elements (such as: Arguments, Constants, Functions) to the 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) to the expressions.- Parameters:
elements- Elements list (variadic), where Argument, Constant, Function extend the same class PrimitiveElement- See Also:
PrimitiveElement
-
addArguments
public void addArguments(Argument... arguments)
Adds arguments (variadic) to the 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 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 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 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 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 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
-
getArgumentsNumber
public int getArgumentsNumber()
Gets number of arguments associated with the expression.- Returns:
- The number of arguments (int >= 0)
- See Also:
Argument,RecursiveArgument
-
setArgumentValue
public void setArgumentValue(java.lang.String argumentName, double argumentValue)Sets argument value.- Parameters:
argumentName- the argument nameargumentValue- the argument value
-
getArgumentValue
public double getArgumentValue(java.lang.String argumentName)
Gets argument vale.- Parameters:
argumentName- the argument name- Returns:
- Argument value if argument name was found, otherwise return Double.NaN.
-
removeArguments
public void removeArguments(java.lang.String... argumentsNames)
Removes first occurrences of the arguments associated with the 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 expression.- Parameters:
arguments- the arguments (variadic parameters) comma separated list- See Also:
Argument,RecursiveArgument
-
removeAllArguments
public void removeAllArguments()
Removes all arguments associated with the expression.- See Also:
Argument,RecursiveArgument
-
addConstants
public void addConstants(Constant... constants)
Adds constants (variadic parameters) to the 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 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 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 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 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 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 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 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 expression- Parameters:
constants- the constants (variadic parameters) comma separated list- See Also:
Constant
-
removeAllConstants
public void removeAllConstants()
Removes all constants associated with the expression- See Also:
Constant
-
addFunctions
public void addFunctions(Function... functions)
Adds functions (variadic parameters) to the 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 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 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 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 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 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 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 expression.- Parameters:
functions- the functions (variadic parameters) comma separated list.- See Also:
Function
-
removeAllFunctions
public void removeAllFunctions()
Removes all functions associated with the expression.- See Also:
Function
-
setToNumber
private void setToNumber(int pos, double number, boolean ulpRound)Sets given token to the number type / value. Method should be called only by the SetDecreaseRemove like methods- Parameters:
pos- the position on which token should be updated to the given numbernumber- the numberulpRound- If true, then ifmXparser.ulpRounding= true intelligent ULP rounding is applied.
-
setToNumber
private void setToNumber(int pos, double number)
-
f1SetDecreaseRemove
private void f1SetDecreaseRemove(int pos, double result, boolean ulpRound)SetDecreaseRemove for 1 arg functions SetDecreaseRemove like methods are called by the methods calculating values of the unary operation, binary relations and functions. 3 things are done by this type of methods 1) Set token type to number type / value 2) Decrease level of the token 3) Remove no longer needed tokens For example: Expression string: 1+cos(0) will be tokened as follows: idx : 0 1 2 3 4 5 token : 1 + cos ( 0 ) level : 0 0 1 2 2 2 Partitions with the highest level will be handled first. In the case presented above, it means, that the parenthesis will be removed idx : 0 1 2 3 token : 1 + cos 0 level : 0 0 1 2 Next step is to calculate cos(0) = 1 SetDecreaseRemove like methods 1) Set cos token to 1 (pos=2, result=1): idx : 0 1 2 3 token : 1 + 1 0 level : 0 0 1 2 2) Decrease level (pos=2): idx : 0 1 2 3 token : 1 + 1 0 level : 0 0 0 2 3) Remove no longer needed tokens (pos+1=3): idx : 0 1 2 token : 1 + 1 level : 0 0 0- Parameters:
pos- the position on which token should be updated to the given numberresult- the numberulpRound- If true, then ifmXparser.ulpRounding= true intelligent ULP rounding is applied.
-
f1SetDecreaseRemove
private void f1SetDecreaseRemove(int pos, double result)
-
f2SetDecreaseRemove
private void f2SetDecreaseRemove(int pos, double result, boolean ulpRound)SetDecreaseRemove for 2-args functions For detailed specification refer to the f1SetDecreaseRemove()- Parameters:
pos- the position on which token should be updated to the given numberresult- the numberulpRound- If true, then ifmXparser.ulpRounding= true intelligent ULP rounding is applied.
-
f2SetDecreaseRemove
private void f2SetDecreaseRemove(int pos, double result)
-
f3SetDecreaseRemove
private void f3SetDecreaseRemove(int pos, double result, boolean ulpRound)SetDecreaseRemove for 3-args functions For detailed specification refer to the f1SetDecreaseRemove()- Parameters:
pos- the position on which token should be updated to the given numberresult- the numberulpRound- If true, then ifmXparser.ulpRounding= true intelligent ULP rounding is applied.
-
f3SetDecreaseRemove
private void f3SetDecreaseRemove(int pos, double result)
-
opSetDecreaseRemove
private void opSetDecreaseRemove(int pos, double result, boolean ulpRound)SetDecreaseRemove for operators For detailed specification refer to the f1SetDecreaseRemove()- Parameters:
pos- the position on which token should be updated to the given numberresult- the numberulpRound- If true, then ifmXparser.ulpRounding= true intelligent ULP rounding is applied.
-
opSetDecreaseRemove
private void opSetDecreaseRemove(int pos, double result)
-
calcSetDecreaseRemove
private void calcSetDecreaseRemove(int pos, double result, boolean ulpRound)SetDecreaseRemove for calculus operators. For detailed specification refer to the f1SetDecreaseRemove()- Parameters:
pos- the position on which token should be updated to the given numberresult- the numberulpRound- If true, then ifmXparser.ulpRounding= true intelligent ULP rounding is applied.
-
calcSetDecreaseRemove
private void calcSetDecreaseRemove(int pos, double result)
-
variadicSetDecreaseRemove
private void variadicSetDecreaseRemove(int pos, double value, int length, boolean ulpRound)SetDecreaseRemove for special functions. For detailed specification refer to the f1SetDecreaseRemove()- Parameters:
pos- the position on which token should be updated to the given numbervalue- the numberlength- the special function rangeulpRound- If true, then ifmXparser.ulpRounding= true intelligent ULP rounding is applied.
-
variadicSetDecreaseRemove
private void variadicSetDecreaseRemove(int pos, double value, int length)
-
ifSetRemove
private void ifSetRemove(int pos, double ifCondition, boolean ulpRound)If set remove method for the if function.- Parameters:
pos- the positionifCondition- the result of if conditionulpRound- If true, then ifmXparser.ulpRounding= true intelligent ULP rounding is applied.
-
removeTokens
private void removeTokens(int from, int to)
-
ifSetRemove
private void ifSetRemove(int pos, double ifCondition)
-
createInitialTokens
private static java.util.List<Token> createInitialTokens(int startPos, int endPos, java.util.List<Token> tokensList)
Creates string tokens list from the subexpression.- Parameters:
startPos- start position (index)endPos- end position (index)- Returns:
- tokens list representing requested subexpression.
-
getParametersNumber
private int getParametersNumber(int pos)
Return number of functions parameters.- Parameters:
pos- the function position
-
getParamArgument
private ArgumentParameter getParamArgument(java.lang.String argumentName)
Gets / returns argument representing given argument name. If argument name exists on the list of known arguments the initial status of the found argument is remembered, otherwise new argument will be created.- Parameters:
argumentName- the argument name- Returns:
- Argument parameter representing given argument name:
- See Also:
ArgumentParameter,Argument
-
clearParamArgument
private void clearParamArgument(ArgumentParameter argParam)
Clears argument parameter.- Parameters:
argParam- the argument parameter.
-
FREE_ARGUMENT
private void FREE_ARGUMENT(int pos)
Free Arguments handling.- Parameters:
pos- the token position
-
DEPENDENT_ARGUMENT
private void DEPENDENT_ARGUMENT(int pos, CalcStepsRegister calcStepsRegister)Dependent Arguments handling.- Parameters:
pos- the token position
-
USER_FUNCTION
private void USER_FUNCTION(int pos, CalcStepsRegister calcStepsRegister)User functions handling.- Parameters:
pos- the token position
-
USER_CONSTANT
private void USER_CONSTANT(int pos)
User constants handling.- Parameters:
pos- the token position
-
RECURSIVE_ARGUMENT
private void RECURSIVE_ARGUMENT(int pos)
Recursive arguments handling.- Parameters:
pos- the token position
-
CONSTANT
private void CONSTANT(int pos)
Constants handling.- Parameters:
pos- the token position
-
UNIT
private void UNIT(int pos)
Constants handling.- Parameters:
pos- the token position
-
RANDOM_VARIABLE
private void RANDOM_VARIABLE(int pos)
Random Variables handling.- Parameters:
pos- the token position
-
getTokenValue
private double getTokenValue(int tokenIndex)
Gets token value- Parameters:
tokenIndex- the token index- Returns:
- the token value
-
TETRATION
private void TETRATION(int pos)
Tetration handling.- Parameters:
pos- the token position
-
POWER
private void POWER(int pos)
Power handling.- Parameters:
pos- the token position
-
MODULO
private void MODULO(int pos)
Modulo handling.- Parameters:
pos- the token position
-
DIVIDE
private void DIVIDE(int pos)
Division handling.- Parameters:
pos- the token position
-
DIVIDE_QUOTIENT
private void DIVIDE_QUOTIENT(int pos)
Integer division handling.- Parameters:
pos- the token position
-
MULTIPLY
private void MULTIPLY(int pos)
Multiplication handling.- Parameters:
pos- the token position
-
PLUS
private void PLUS(int pos)
Addition handling.- Parameters:
pos- the token position
-
MINUS
private void MINUS(int pos)
Subtraction handling- Parameters:
pos- the token position
-
AND
private void AND(int pos)
Logical AND- Parameters:
pos- the token position
-
OR
private void OR(int pos)
Logical OR- Parameters:
pos- the token position
-
NAND
private void NAND(int pos)
Logical NAND- Parameters:
pos- the token position
-
NOR
private void NOR(int pos)
Logical NOR- Parameters:
pos- the token position
-
XOR
private void XOR(int pos)
Logical XOR- Parameters:
pos- the token position
-
IMP
private void IMP(int pos)
Logical IMP- Parameters:
pos- the token position
-
CIMP
private void CIMP(int pos)
Logical CIMP- Parameters:
pos- the token position
-
NIMP
private void NIMP(int pos)
Logical NIMP- Parameters:
pos- the token position
-
CNIMP
private void CNIMP(int pos)
Logical CNIMP- Parameters:
pos- the token position
-
EQV
private void EQV(int pos)
Logical EQV- Parameters:
pos- the token position
-
NEG
private void NEG(int pos)
Logical negation- Parameters:
pos- the token position
-
EQ
private void EQ(int pos)
Equality relation.- Parameters:
pos- the token position
-
NEQ
private void NEQ(int pos)
Not equals.- Parameters:
pos- the token position
-
LT
private void LT(int pos)
Lower than.- Parameters:
pos- the token position
-
GT
private void GT(int pos)
Greater than.- Parameters:
pos- the token position
-
LEQ
private void LEQ(int pos)
Lower or equal.- Parameters:
pos- the token position
-
GEQ
private void GEQ(int pos)
Greater or equal- Parameters:
pos- the token position
-
SQUARE_ROOT_OPERATOR
private void SQUARE_ROOT_OPERATOR(int pos)
Square root as unary left operator- Parameters:
pos- the token position
-
CUBE_ROOT_OPERATOR
private void CUBE_ROOT_OPERATOR(int pos)
Cube root as unary left operator- Parameters:
pos- the token position
-
FOURTH_ROOT_OPERATOR
private void FOURTH_ROOT_OPERATOR(int pos)
Fourth root as unary left operator- Parameters:
pos- the token position
-
BITWISE_COMPL
private void BITWISE_COMPL(int pos)
Bitwise COMPL- Parameters:
pos- the token position
-
BITWISE_AND
private void BITWISE_AND(int pos)
Bitwise AND- Parameters:
pos- the token position
-
BITWISE_OR
private void BITWISE_OR(int pos)
Bitwise OR- Parameters:
pos- the token position
-
BITWISE_XOR
private void BITWISE_XOR(int pos)
Bitwise XOR- Parameters:
pos- the token position
-
BITWISE_NAND
private void BITWISE_NAND(int pos)
Bitwise NAND- Parameters:
pos- the token position
-
BITWISE_NOR
private void BITWISE_NOR(int pos)
Bitwise NOR- Parameters:
pos- the token position
-
BITWISE_XNOR
private void BITWISE_XNOR(int pos)
Bitwise NOR- Parameters:
pos- the token position
-
BITWISE_LEFT_SHIFT
private void BITWISE_LEFT_SHIFT(int pos)
Bitwise LEFT SHIFT- Parameters:
pos- the token position
-
BITWISE_RIGHT_SHIFT
private void BITWISE_RIGHT_SHIFT(int pos)
Bitwise RIGHT SHIFT- Parameters:
pos- the token position
-
SIN
private void SIN(int pos)
Sine function- Parameters:
pos- the token position
-
COS
private void COS(int pos)
Cosine / Trigonometric functions Sets tokens to number token- Parameters:
pos- the token position
-
TAN
private void TAN(int pos)
Tangent / Trigonometric functions Sets tokens to number token- Parameters:
pos- the token position
-
CTAN
private void CTAN(int pos)
Cotangent / Trigonometric functions Sets tokens to number token- Parameters:
pos- the token position
-
SEC
private void SEC(int pos)
Secant / Trigonometric functions Sets tokens to number token- Parameters:
pos- the token position
-
COSEC
private void COSEC(int pos)
Cosecant / Trigonometric functions Sets tokens to number token- Parameters:
pos- the token position
-
ASIN
private void ASIN(int pos)
Arcus sine / Inverse trigonometric functions Sets tokens to number token- Parameters:
pos- the token position
-
ACOS
private void ACOS(int pos)
Arcus cosine / Inverse trigonometric functions Sets tokens to number token- Parameters:
pos- the token position
-
ATAN
private void ATAN(int pos)
Arcus tangent / Inverse trigonometric functions Sets tokens to number token- Parameters:
pos- the token position
-
ACTAN
private void ACTAN(int pos)
Arcus cotangent / Inverse trigonometric functions Sets tokens to number token- Parameters:
pos- the token position
-
LN
private void LN(int pos)
Natural logarithm (base e) Sets tokens to number token- Parameters:
pos- the token position
-
LOG2
private void LOG2(int pos)
Logarithm - base 2 Sets tokens to number token- Parameters:
pos- the token position
-
LOG10
private void LOG10(int pos)
Logarithm - base 10 Sets tokens to number token- Parameters:
pos- the token position
-
RAD
private void RAD(int pos)
Converts degrees to radius Sets tokens to number token- Parameters:
pos- the token position
-
EXP
private void EXP(int pos)
Exponential function Sets tokens to number token- Parameters:
pos- the token position
-
SQRT
private void SQRT(int pos)
Square root Sets tokens to number token- Parameters:
pos- the token position
-
SINH
private void SINH(int pos)
Hyperbolic sine Sets tokens to number token- Parameters:
pos- the token position
-
COSH
private void COSH(int pos)
Hyperbolic cosine Sets tokens to number token- Parameters:
pos- the token position
-
TANH
private void TANH(int pos)
Hyperbolic tangent Sets tokens to number token- Parameters:
pos- the token position
-
COTH
private void COTH(int pos)
Hyperbolic cotangent Sets tokens to number token- Parameters:
pos- the token position
-
SECH
private void SECH(int pos)
Hyperbolic secant Sets tokens to number token- Parameters:
pos- the token position
-
CSCH
private void CSCH(int pos)
Hyperbolic cosecant Sets tokens to number token- Parameters:
pos- the token position
-
DEG
private void DEG(int pos)
Converts radians to degrees Sets tokens to number token- Parameters:
pos- the token position
-
ABS
private void ABS(int pos)
Absolut value Sets tokens to number token- Parameters:
pos- the token position
-
SGN
private void SGN(int pos)
Signum function Sets tokens to number token- Parameters:
pos- the token position
-
FLOOR
private void FLOOR(int pos)
Floor function Sets tokens to number token- Parameters:
pos- the token position
-
CEIL
private void CEIL(int pos)
Ceil function Sets tokens to number token- Parameters:
pos- the token position
-
ARSINH
private void ARSINH(int pos)
Arcus hyperbolic sine Sets tokens to number token- Parameters:
pos- the token position
-
ARCOSH
private void ARCOSH(int pos)
Arcus hyperbolic cosine Sets tokens to number token- Parameters:
pos- the token position
-
ARTANH
private void ARTANH(int pos)
Arcus hyperbolic tangent Sets tokens to number token- Parameters:
pos- the token position
-
ARCOTH
private void ARCOTH(int pos)
Arcus hyperbolic cotangent Sets tokens to number token- Parameters:
pos- the token position
-
ARSECH
private void ARSECH(int pos)
Arcus hyperbolic secant Sets tokens to number token- Parameters:
pos- the token position
-
ARCSCH
private void ARCSCH(int pos)
Arcus hyperbolic cosecant Sets tokens to number token- Parameters:
pos- the token position
-
SA
private void SA(int pos)
SA / sinc normalized- Parameters:
pos- the token position
-
SINC
private void SINC(int pos)
Sinc unnormalized- Parameters:
pos- the token position
-
BELL_NUMBER
private void BELL_NUMBER(int pos)
Bell numbers- Parameters:
pos- the token position
-
LUCAS_NUMBER
private void LUCAS_NUMBER(int pos)
Lucas numbers- Parameters:
pos- the token position
-
FIBONACCI_NUMBER
private void FIBONACCI_NUMBER(int pos)
Fibonacci numbers- Parameters:
pos- the token position
-
HARMONIC_NUMBER
private void HARMONIC_NUMBER(int pos)
Harmonic numbers- Parameters:
pos- the token position
-
IS_PRIME
private void IS_PRIME(int pos)
Prime test- Parameters:
pos- the token position
-
PRIME_COUNT
private void PRIME_COUNT(int pos)
Prime counting- Parameters:
pos- the token position
-
EXP_INT
private void EXP_INT(int pos)
Exponential integral function- Parameters:
pos- the token position
-
LOG_INT
private void LOG_INT(int pos)
Logarithmic exponential integral function- Parameters:
pos- the token position
-
OFF_LOG_INT
private void OFF_LOG_INT(int pos)
Offset logarithmic exponential integral function- Parameters:
pos- the token position
-
FACT
private void FACT(int pos)
Factorilal function Sets tokens to number token- Parameters:
pos- the token position
-
PERC
private void PERC(int pos)
Percentage Sets tokens to number token- Parameters:
pos- the token position
-
NOT
private void NOT(int pos)
Negation Sets tokens to number token- Parameters:
pos- the token position
-
GAUSS_ERF
private void GAUSS_ERF(int pos)
Gauss error function- Parameters:
pos- the token position
-
GAUSS_ERFC
private void GAUSS_ERFC(int pos)
Gauss complementary error function- Parameters:
pos- the token position
-
GAUSS_ERF_INV
private void GAUSS_ERF_INV(int pos)
Inverse of Gauss error function- Parameters:
pos- the token position
-
GAUSS_ERFC_INV
private void GAUSS_ERFC_INV(int pos)
Inverse of Gauss complementary error function- Parameters:
pos- the token position
-
ULP
private void ULP(int pos)
Unit in The Last Place Sets tokens to number token- Parameters:
pos- the token position
-
ISNAN
private void ISNAN(int pos)
Is Not-a-Number Sets tokens to number token- Parameters:
pos- the token position
-
NDIG10
private void NDIG10(int pos)
Number of digits in base 10 Sets tokens to number token- Parameters:
pos- the token position
-
NFACT
private void NFACT(int pos)
Number of prime factors - distinct Sets tokens to number token- Parameters:
pos- the token position
-
ARCSEC
private void ARCSEC(int pos)
Arcuus secant Sets tokens to number token- Parameters:
pos- the token position
-
ARCCSC
private void ARCCSC(int pos)
Arcuus cosecant Sets tokens to number token- Parameters:
pos- the token position
-
GAMMA
private void GAMMA(int pos)
Gamma special function Sets tokens to number token- Parameters:
pos- the token position
-
LAMBERT_W0
private void LAMBERT_W0(int pos)
Lambert-W special function, principal branch 0 Sets tokens to number token- Parameters:
pos- the token position
-
LAMBERT_W1
private void LAMBERT_W1(int pos)
Lambert-W special function, branch = -1 Sets tokens to number token- Parameters:
pos- the token position
-
SGN_GAMMA
private void SGN_GAMMA(int pos)
Signum of Gamma special function Sets tokens to number token- Parameters:
pos- the token position
-
LOG_GAMMA
private void LOG_GAMMA(int pos)
Log Gamma special function Sets tokens to number token- Parameters:
pos- the token position
-
DI_GAMMA
private void DI_GAMMA(int pos)
Digamma special function Sets tokens to number token- Parameters:
pos- the token position
-
UDF_PARAM
private void UDF_PARAM(int pos)
User Defined Variadic function param value Sets tokens to number token- Parameters:
pos- the token position
-
RND_STUDENT_T
private void RND_STUDENT_T(int pos)
-
RND_CHI2
private void RND_CHI2(int pos)
-
LOG
private void LOG(int pos)
Logarithm Sets tokens to number token- Parameters:
pos- the token position
-
getNumbers
private java.util.List<java.lang.Double> getNumbers(int pos)
Creates ArraListcontaining function parameters - Parameters:
pos- the function position- Returns:
- List of function parameters.
-
MOD
private void MOD(int pos)
Modulo Sets tokens to number token- Parameters:
pos- the token position
-
BINOM_COEFF
private void BINOM_COEFF(int pos)
Binomial Coefficient- Parameters:
pos- the token position
-
PERMUTATIONS
private void PERMUTATIONS(int pos)
Number of permutations- Parameters:
pos- the token position
-
BETA
private void BETA(int pos)
Beta special function- Parameters:
pos- the token position
-
LOG_BETA
private void LOG_BETA(int pos)
Log beta special function- Parameters:
pos- the token position
-
PDF_STUDENT_T
private void PDF_STUDENT_T(int pos)
-
CDF_STUDENT_T
private void CDF_STUDENT_T(int pos)
-
QNT_STUDENT_T
private void QNT_STUDENT_T(int pos)
-
PDF_CHI2
private void PDF_CHI2(int pos)
-
CDF_CHI2
private void CDF_CHI2(int pos)
-
QNT_CHI2
private void QNT_CHI2(int pos)
-
BERNOULLI_NUMBER
private void BERNOULLI_NUMBER(int pos)
Bernoulli Number- Parameters:
pos- the token position
-
STIRLING1_NUMBER
private void STIRLING1_NUMBER(int pos)
Stirling number of the first kind- Parameters:
pos- the token position
-
STIRLING2_NUMBER
private void STIRLING2_NUMBER(int pos)
Stirling number of the second kind.- Parameters:
pos- the token position
-
WORPITZKY_NUMBER
private void WORPITZKY_NUMBER(int pos)
Worpitzky number.- Parameters:
pos- the token position
-
EULER_NUMBER
private void EULER_NUMBER(int pos)
Euler number- Parameters:
pos- the token position
-
KRONECKER_DELTA
private void KRONECKER_DELTA(int pos)
Kronecker delta- Parameters:
pos- the token position
-
EULER_POLYNOMIAL
private void EULER_POLYNOMIAL(int pos)
Euler polynomial- Parameters:
pos- the token position
-
HARMONIC2_NUMBER
private void HARMONIC2_NUMBER(int pos)
Harmonic numbers- Parameters:
pos- the token position
-
ROUND
private void ROUND(int pos)
Decimal rounding- Parameters:
pos- the token position
-
RND_VAR_UNIFORM_CONT
private void RND_VAR_UNIFORM_CONT(int pos)
Random number - Uniform Continuous distribution- Parameters:
pos- the token position
-
RND_VAR_UNIFORM_DISCR
private void RND_VAR_UNIFORM_DISCR(int pos)
Random number - Uniform Discrete distribution- Parameters:
pos- the token position
-
RND_NORMAL
private void RND_NORMAL(int pos)
Random number - Normal distribution- Parameters:
pos- the token position
-
RND_F_SNEDECOR
private void RND_F_SNEDECOR(int pos)
Random number - Snedecor's F distribution (F-distribution or F-ratio, also known as Fisher–Snedecor distribution)- Parameters:
pos- the token position
-
NDIG
private void NDIG(int pos)
Number of digits in given numeral system- Parameters:
pos- the token position
-
DIGIT10
private void DIGIT10(int pos)
Digit at position - base 10 numeral system- Parameters:
pos- the token position
-
FACTVAL
private void FACTVAL(int pos)
Prime factor value- Parameters:
pos- the token position
-
FACTEXP
private void FACTEXP(int pos)
Prime factor value exponent- Parameters:
pos- the token position
-
ROOT
private void ROOT(int pos)
Nth order root- Parameters:
pos- the token position
-
INC_GAMMA_LOWER
private void INC_GAMMA_LOWER(int pos)
Lower incomplete special Gamma function- Parameters:
pos- the token position
-
INC_GAMMA_UPPER
private void INC_GAMMA_UPPER(int pos)
Upper incomplete special Gamma function- Parameters:
pos- the token position
-
REG_GAMMA_LOWER
private void REG_GAMMA_LOWER(int pos)
Lower regularized special Gamma function- Parameters:
pos- the token position
-
REG_GAMMA_UPPER
private void REG_GAMMA_UPPER(int pos)
Lower regularized special Gamma function- Parameters:
pos- the token position
-
IF_CONDITION
private void IF_CONDITION(int pos)
IF function- Parameters:
pos- the token position
-
IFF
private void IFF(int pos)
IFF function- Parameters:
pos- the token position
-
IF
private void IF(int pos)
IF Sets tokens to number token- Parameters:
pos- token index (position)
-
CHI
private void CHI(int pos)
Characteristic function (a,b)- Parameters:
pos- the token position
-
CHI_LR
private void CHI_LR(int pos)
Characteristic function [a,b]- Parameters:
pos- the token position
-
CHI_L
private void CHI_L(int pos)
Characteristic function [a,b)- Parameters:
pos- the token position
-
CHI_R
private void CHI_R(int pos)
Characteristic function (a,b]- Parameters:
pos- the token position
-
PDF_UNIFORM_CONT
private void PDF_UNIFORM_CONT(int pos)
Probability Distribution Function - Uniform Continuous distribution- Parameters:
pos- the token position
-
CDF_UNIFORM_CONT
private void CDF_UNIFORM_CONT(int pos)
Cumulative Distribution Function - Uniform Continuous distribution- Parameters:
pos- the token position
-
QNT_UNIFORM_CONT
private void QNT_UNIFORM_CONT(int pos)
Quantile Function - Uniform Continuous distribution- Parameters:
pos- the token position
-
PDF_NORMAL
private void PDF_NORMAL(int pos)
Probability Distribution Function - Normal distribution- Parameters:
pos- the token position
-
CDF_NORMAL
private void CDF_NORMAL(int pos)
Cumulative Distribution Function - Normal distribution- Parameters:
pos- the token position
-
QNT_NORMAL
private void QNT_NORMAL(int pos)
Quantile Function - Normal distribution- Parameters:
pos- the token position
-
PDF_F_SNEDECOR
private void PDF_F_SNEDECOR(int pos)
Probability Distribution Function - Snedecor's F distribution- Parameters:
pos- the token position
-
CDF_F_SNEDECOR
private void CDF_F_SNEDECOR(int pos)
Cumulative Distribution Function - Snedecor's F distribution- Parameters:
pos- the token position
-
QNT_F_SNEDECOR
private void QNT_F_SNEDECOR(int pos)
Quantile Function - Snedecor's F distribution- Parameters:
pos- the token position
-
DIGIT
private void DIGIT(int pos)
Digit at position - numeral system with given base- Parameters:
pos- the token position
-
INC_BETA
private void INC_BETA(int pos)
Incomplete beta special function- Parameters:
pos- the token position
-
REG_BETA
private void REG_BETA(int pos)
Regularized incomplete beta special function- Parameters:
pos- the token position
-
updateMissingTokens
private static void updateMissingTokens(java.util.List<Token> tokens, java.lang.String keyWord, int tokenId, int tokenTypeId)
Updating missing tokens (i.e. indexes i sum operator). Used when creating internal expressions based on the sublist of tokens.- Parameters:
tokens- the tokens listkeyWord- missing keywordtokenId- missing token idtokenTypeId- missing token type id
-
updateMissingTokens
private static void updateMissingTokens(ArgumentParameter index, IterativeOperatorParameters iterParams)
Update missing tokens in expression related to iterative operators.- Parameters:
index- Index parameter of the iterative operatoriterParams- Parameters list of the iterative operator
-
evalFromToDeltaParameters
private void evalFromToDeltaParameters(ArgumentParameter index, IterativeOperatorParameters iterParams)
Evaluates ranges 'from', 'to', 'delta' for the iterative operator- Parameters:
index- Index parameter of the iterative operatoriterParams- Parameters list of the iterative operator
-
SUM
private void SUM(int pos)
Summation operator (SIGMA by) sum(i,m,n,f(i),b) --> sum f(i) from i=m to i=n by delta i - index (argument) m, n - numbers or expressions f(i) - function string by delta- Parameters:
pos- the token position
-
PROD
private void PROD(int pos)
Product operator (SIGMA by) pord(i,m,n,f(i),b) --> prod f(i) from i=m to i=n by delta i - index (argument) m, n - numbers or expressions f(i) - function string by delta- Parameters:
pos- the token position
-
MIN
private void MIN(int pos)
Minimum value - iterative operator mini(i,m,n,f(i),b) --> min f(i) from i=m to i=n by delta i - index (argument) m, n - numbers or expressions f(i) - function string by delta- Parameters:
pos- the token position
-
MAX
private void MAX(int pos)
Maximum value - iterative operator maxi(i,m,n,f(i),b) --> max f(i) from i=m to i=n by delta i - index (argument) m, n - numbers or expressions f(i) - function string by delta- Parameters:
pos- the token position
-
AVG
private void AVG(int pos)
Average function value - iterative operator avg(i,m,n,f(i),b) --> avg f(i) from i=m to i=n by delta i - index (argument) m, n - numbers or expressions f(i) - function string by delta- Parameters:
pos- the token position
-
VAR
private void VAR(int pos)
Variance from sample function values - iterative operator vari(i,m,n,f(i),b) --> var f(i) from i=m to i=n by delta i - index (argument) m, n - numbers or expressions f(i) - function string by delta- Parameters:
pos- the token position
-
STD
private void STD(int pos)
Standard deviation from sample function values - iterative operator stdi(i,m,n,f(i),b) --> std f(i) from i=m to i=n by delta i - index (argument) m, n - numbers or expressions f(i) - function string by delta- Parameters:
pos- the token position
-
DERIVATIVE
private void DERIVATIVE(int pos, int derivativeType)Function derivative- Parameters:
pos- the token positionderivativeType- the type of derivative (LEFT, RIGHT, ...)
-
DERIVATIVE_NTH
private void DERIVATIVE_NTH(int pos, int derivativeType)Function derivative- Parameters:
pos- the token positionderivativeType- the type of derivative (left, right, etc...)
-
INTEGRAL
private void INTEGRAL(int pos)
Function integral- Parameters:
pos- the token position
-
SOLVE
private void SOLVE(int pos)
Function SOLVE- Parameters:
pos- the token position
-
FORWARD_DIFFERENCE
private void FORWARD_DIFFERENCE(int pos)
Forward difference operator- Parameters:
pos- the token position
-
BACKWARD_DIFFERENCE
private void BACKWARD_DIFFERENCE(int pos)
Backward diffrence operator- Parameters:
pos- the token position
-
MIN_VARIADIC
private void MIN_VARIADIC(int pos)
Minimum variadic Sets tokens to number token- Parameters:
pos- the token position
-
MAX_VARIADIC
private void MAX_VARIADIC(int pos)
Maximum variadic Sets tokens to number token- Parameters:
pos- token index (position)
-
SUM_VARIADIC
private void SUM_VARIADIC(int pos)
Sum variadic Sets tokens to number token- Parameters:
pos- token index (position)
-
PROD_VARIADIC
private void PROD_VARIADIC(int pos)
Sum variadic Sets tokens to number token- Parameters:
pos- token index (position)
-
AVG_VARIADIC
private void AVG_VARIADIC(int pos)
Average variadic Sets tokens to number token- Parameters:
pos- token index (position)
-
VAR_VARIADIC
private void VAR_VARIADIC(int pos)
Variance variadic Sets tokens to number token- Parameters:
pos- token index (position)
-
STD_VARIADIC
private void STD_VARIADIC(int pos)
Standard deviation variadic Sets tokens to number token- Parameters:
pos- token index (position)
-
CONTINUED_FRACTION
private void CONTINUED_FRACTION(int pos)
Continued fraction- Parameters:
pos- the token position
-
CONTINUED_POLYNOMIAL
private void CONTINUED_POLYNOMIAL(int pos)
Continued polynomial- Parameters:
pos- the token position
-
GCD
private void GCD(int pos)
Greates Common Divisor- Parameters:
pos- the token position
-
LCM
private void LCM(int pos)
Lowest Common Multiply- Parameters:
pos- the token position
-
RND_LIST
private void RND_LIST(int pos)
Random number from list- Parameters:
pos- the token position
-
COALESCE
private void COALESCE(int pos)
Coalesce- Parameters:
pos- the token position
-
OR_VARIADIC
private void OR_VARIADIC(int pos)
OR_VARIADIC- Parameters:
pos- the token position
-
AND_VARIADIC
private void AND_VARIADIC(int pos)
AND_VARIADIC- Parameters:
pos- the token position
-
XOR_VARIADIC
private void XOR_VARIADIC(int pos)
XOR_VARIADIC- Parameters:
pos- the token position
-
ARGMIN_VARIADIC
private void ARGMIN_VARIADIC(int pos)
ARGMIN_VARIADIC- Parameters:
pos- the token position
-
ARGMAX_VARIADIC
private void ARGMAX_VARIADIC(int pos)
ARGMAX_VARIADIC- Parameters:
pos- the token position
-
MEDIAN_VARIADIC
private void MEDIAN_VARIADIC(int pos)
MEDIAN_VARIADIC- Parameters:
pos- the token position
-
MODE_VARIADIC
private void MODE_VARIADIC(int pos)
MODE_VARIADIC- Parameters:
pos- the token position
-
BASE_VARIADIC
private void BASE_VARIADIC(int pos)
BASE_VARIADIC- Parameters:
pos- the token position
-
NDIST_VARIADIC
private void NDIST_VARIADIC(int pos)
NDIST_VARIADIC- Parameters:
pos- the token position
-
COMMA
private void COMMA(int pos)
Parser symbols Removes comma- Parameters:
pos- token index (position)
-
PARENTHESES
private void PARENTHESES(int lPos, int rPos)Parser symbols Removes parenthesis- Parameters:
lPos- left token index (position)rPos- roght token index (position)
-
checkLexSyntax
public boolean checkLexSyntax()
Checks syntax of the expression string.- Returns:
- true if syntax is ok
-
cleanExpressionString
private void cleanExpressionString()
Cleans blanks and other cases like "++', "+-", "-+"", "--"
-
checkSyntax
public boolean checkSyntax()
Checks syntax of the expression string.- Returns:
- true if syntax is ok
-
checkCalculusParameter
private int checkCalculusParameter(java.lang.String param)
Checks syntax of the calculus parameter- Returns:
- true if syntax is ok
-
checkIfKnownArgument
private static boolean checkIfKnownArgument(FunctionParameter param)
Checks if argument given in the function parameter is known in the expression.- Parameters:
param- the function parameter- Returns:
- true if argument is known, otherwise returns false.
-
checkIfUnknownToken
private static boolean checkIfUnknownToken(FunctionParameter param)
Checks if token is uknown- Parameters:
param- the function parameter- Returns:
- true if there is only 1 token with unknown type, otherwise returns false.
-
syntaxIsAlreadyCheckedNorErrors
private boolean syntaxIsAlreadyCheckedNorErrors()
-
registerFinalSyntaxAlreadyCheckedNorErrors
private void registerFinalSyntaxAlreadyCheckedNorErrors(java.lang.String recursionInfoLevel)
-
registerFinalSyntaxFunctionWithBodyExtNoErrors
private void registerFinalSyntaxFunctionWithBodyExtNoErrors(java.lang.String recursionInfoLevel)
-
registerFinalSyntaxExpressionStringIsEmpty
private void registerFinalSyntaxExpressionStringIsEmpty(java.lang.String recursionInfoLevel)
-
registerSyntaxLexicalError
private void registerSyntaxLexicalError(java.lang.String recursionInfoLevel, java.lang.Throwable e)
-
registerFinalSyntax
private void registerFinalSyntax(java.lang.String recursionInfoLevel, boolean syntax)
-
registerPartialSyntaxStartingSyntaxCheck
private void registerPartialSyntaxStartingSyntaxCheck(java.lang.String recursionInfoLevel)
-
checkPartialSyntaxImpliedMultiplication
private boolean checkPartialSyntaxImpliedMultiplication(java.lang.String recursionInfoLevel)
-
checkPartialSyntaxDuplicatedKeywords
private boolean checkPartialSyntaxDuplicatedKeywords(java.lang.String recursionInfoLevel)
-
checkPartialSyntaxUserDefinedArgument
private boolean checkPartialSyntaxUserDefinedArgument(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenInfoMessage)
-
checkPartialSyntaxUserDefinedRecursiveArgument
private boolean checkPartialSyntaxUserDefinedRecursiveArgument(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenInfoMessage)
-
checkPartialSyntaxInvalidToken
private boolean checkPartialSyntaxInvalidToken(java.lang.String recursionInfoLevel, Token token, java.lang.String tokenInfoMessage, java.util.Stack<SyntaxStackElement> syntaxStack)
-
checkPartialSyntaxUserDefinedFunction
private boolean checkPartialSyntaxUserDefinedFunction(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenInfoMessage)
-
checkPartialSyntaxBuiltinConstant
private boolean checkPartialSyntaxBuiltinConstant(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenInfoMessage)
-
checkPartialSyntaxUserDefinedConstant
private boolean checkPartialSyntaxUserDefinedConstant(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenStr)
-
checkPartialSyntaxUnaryFunction
private boolean checkPartialSyntaxUnaryFunction(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenInfoMessage)
-
checkPartialSyntaxBinaryFunction
private boolean checkPartialSyntaxBinaryFunction(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenInfoMessage)
-
checkPartialSyntaxTernaryFunction
private boolean checkPartialSyntaxTernaryFunction(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenInfoMessage)
-
checkInternalSyntaxCalculusOperatorDerivative
private boolean checkInternalSyntaxCalculusOperatorDerivative(java.lang.String recursionInfoLevel, Token token, java.lang.String tokenInfoMessage, java.util.Stack<SyntaxStackElement> syntaxStack, int paramsNumber, java.util.List<FunctionParameter> funParams)
-
checkInternalSyntaxCalculusOperatorDerivativeNth
private boolean checkInternalSyntaxCalculusOperatorDerivativeNth(java.lang.String recursionInfoLevel, Token token, java.lang.String tokenInfoMessage, java.util.Stack<SyntaxStackElement> syntaxStack, int paramsNumber, java.util.List<FunctionParameter> funParams)
-
checkInternalSyntaxCalculusOperatorIntegralSolve
private boolean checkInternalSyntaxCalculusOperatorIntegralSolve(java.lang.String recursionInfoLevel, Token token, java.lang.String tokenInfoMessage, java.util.Stack<SyntaxStackElement> syntaxStack, int paramsNumber, java.util.List<FunctionParameter> funParams)
-
checkInternalSyntaxCalculusOperatorIterated
private boolean checkInternalSyntaxCalculusOperatorIterated(java.lang.String recursionInfoLevel, Token token, java.lang.String tokenInfoMessage, java.util.Stack<SyntaxStackElement> syntaxStack, int paramsNumber, java.util.List<FunctionParameter> funParams)
-
checkInternalSyntaxCalculusOperatorForwardBackwardDiff
private boolean checkInternalSyntaxCalculusOperatorForwardBackwardDiff(java.lang.String recursionInfoLevel, Token token, java.lang.String tokenInfoMessage, java.util.Stack<SyntaxStackElement> syntaxStack, int paramsNumber, java.util.List<FunctionParameter> funParams)
-
checkPartialSyntaxVariadicFunction
private boolean checkPartialSyntaxVariadicFunction(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenInfoMessage)
-
checkPartialSyntaxCalculusOperator
private boolean checkPartialSyntaxCalculusOperator(java.lang.String recursionInfoLevel, int tokenIndex, Token token, java.lang.String tokenInfoMessage, java.util.Stack<SyntaxStackElement> syntaxStack)
-
performSyntaxStackPopIfEndOfSectionLevel
private static void performSyntaxStackPopIfEndOfSectionLevel(Token token, java.util.Stack<SyntaxStackElement> syntaxStack)
-
checkSyntax
private boolean checkSyntax(java.lang.String recursionInfoLevel, boolean functionWithBodyExt)Checking the syntax (recursively).- Parameters:
recursionInfoLevel- string representing the recursion level.- Returns:
- true if syntax was correct, otherwise returns false.
-
calculate
public double calculate()
Calculates the expression value and registers all the calculation steps- Returns:
- The expression value if syntax was ok, otherwise returns Double.NaN.
-
registerErrorWhileCalculate
private void registerErrorWhileCalculate(java.lang.String errorMessageToAdd)
-
calculate
public double calculate(CalcStepsRegister calcStepsRegister)
Calculates the expression value- Parameters:
calcStepsRegister- A collection to store list of calculation steps, steps registered as strings.- Returns:
- The expression value if syntax was ok, otherwise returns Double.NaN.
-
makeStepDescription
private java.lang.String makeStepDescription()
-
registerCalculationStepRecord
private void registerCalculationStepRecord(CalcStepsRegister calcStepsRegister, int stepsRegisteredCounter, java.lang.String stepDescription)
-
registerCalculationStepRecord
private void registerCalculationStepRecord(CalcStepsRegister calcStepsRegister, int stepsRegisteredCounter, java.lang.String stepDescription, double result)
-
calculateFirstAndFullyCompile
private int calculateFirstAndFullyCompile(CalcStepsRegister calcStepsRegister, java.lang.String stepDescription)
-
applySequenceFromCompilation
private int applySequenceFromCompilation(CalcStepsRegister calcStepsRegister, java.lang.String stepDescription)
-
calculateInternal
private double calculateInternal(CalcStepsRegister calcStepsRegister)
-
registerCompiledElement
private void registerCompiledElement(CompiledElement.ToCall toCall, int position)
-
registerCompiledElement
private void registerCompiledElement(CompiledElement.ToCall toCall, int position1, int position2)
-
f1ArgCalc
private void f1ArgCalc(int pos)
Calculates unary function- Parameters:
pos- token position
-
f2ArgCalc
private void f2ArgCalc(int pos)
Calculates binary function- Parameters:
pos- Token position
-
f3ArgCalc
private void f3ArgCalc(int pos)
Calculates function with 3 arguments- Parameters:
pos- Token position
-
variadicFunCalc
private void variadicFunCalc(int pos)
Calculates Variadic function- Parameters:
pos- Token position
-
calculusCalc
private void calculusCalc(int pos)
Calculates calculus operators- Parameters:
pos-
-
rootOperCalc
private void rootOperCalc(int pos)
Unicode root operators- Parameters:
pos-
-
bolCalc
private void bolCalc(int pos)
Calculates boolean operators- Parameters:
pos-
-
bitwiseCalc
private void bitwiseCalc(int pos)
Calculates Bitwise operators- Parameters:
pos-
-
initParserKeyWords
private void initParserKeyWords()
Creates parser keywords list
-
modifyParserKeyWords
private void modifyParserKeyWords()
-
validateParserKeyWords
private void validateParserKeyWords()
Final validation of keywords
-
checkArgumentNameInCalculusOperator
private boolean checkArgumentNameInCalculusOperator(Token token)
Method used in case of implied multiplication, where x2x can be understood as x2*x sum( x2x, 1, 20, 2*x2x) x2x is not known and it will be prevented from split into x2*x- Parameters:
token- The token- Returns:
- Returns true in case calculus argument was found
-
checkSpecialConstantName
private boolean checkSpecialConstantName(Token token)
Check whether we have a case of '[abc]'- Parameters:
token- The token- Returns:
- Returns true in case token is in a form of '[abc]' otherwise returns false.
-
checkOtherNumberBases
private boolean checkOtherNumberBases(Token token)
Checks whether unknown token represents number literal provided in different numeral base system, where base is between 1 and 36.- Parameters:
token- The token not know to the parser
-
addFractionToken
private void addFractionToken(Token token)
Adds fraction token to the tokens list- Parameters:
token- The token
-
checkFraction
private boolean checkFraction(Token token)
Checks whether unknown token represents fraction provided as fraction or mixed fraction- Parameters:
token- The token not know to the parser
-
initialTokensAdd
private void initialTokensAdd(Token token)
Handles implied multiplication while adding single token to the tokens list is checking preceding token- Parameters:
token- The token
-
assignKnownKeyword
private void assignKnownKeyword(Token token, KeyWord keyWord)
Assign found known keyword to the token- Parameters:
token- The tokenkeyWord- The keyword
-
tryFindKnownKeyword
private KeyWord tryFindKnownKeyword(java.lang.String tokenStr)
Tries to find known keyword for a given token via string matching- Parameters:
tokenStr- Token string- Returns:
- known keyword if match found, otherwise not matched keyword
-
tryAssignKnownKeyword
private boolean tryAssignKnownKeyword(Token token)
Tries to find known keyword for a given token via string matching- Parameters:
token- The token- Returns:
- true if keyword matched, otherwise false
-
initialTokensAddTokenPart
private void initialTokensAddTokenPart(TokenPart tokenPart)
Handles adding token part after single token split in the proces of parsing implied multiplication.- Parameters:
tokenPart- The token part to be added to the token list
-
checkNumberNameManyImpliedMultiplication
private boolean checkNumberNameManyImpliedMultiplication(Token token, boolean parenthesisIsOnTheRight)
Handles implied multiplication logic in case of a single continuous string, e.g. no brackets- Parameters:
token- The token- Returns:
- returns true in case there was a reason to parse, otherwise returns false
-
addToken
private void addToken(java.lang.String tokenStr, KeyWord keyWord, boolean parenthesisIsOnTheRight)Adds expression token Method is called by the tokenExpressionString() while parsing string expression- Parameters:
tokenStr- the token stringkeyWord- the keyword
-
addToken
private void addToken(java.lang.String tokenStr, KeyWord keyWord)
-
addUserDefinedKeyWords
private void addUserDefinedKeyWords()
-
tokenizeExpressionString
private void tokenizeExpressionString()
Tokenizing expression string
-
copyInitialTokens
private void copyInitialTokens()
copy initial tokens list to tokens list and prepares initial compilation details
-
getCopyOfInitialTokens
public java.util.List<Token> getCopyOfInitialTokens()
Tokenizes expression string and returns tokens list, including: string, type, level.- Returns:
- Copy of initial tokens.
- See Also:
Token,mXparser.consolePrintTokens(List)
-
consolePrintCopyOfInitialTokens
public void consolePrintCopyOfInitialTokens()
Prints to the console copy of initial tokens. Presents how expression string is interpreted by the parser.- See Also:
getCopyOfInitialTokens()
-
getMissingUserDefinedArguments
public java.lang.String[] getMissingUserDefinedArguments()
Returns missing user defined arguments names, i.e. sin(x) + cos(y) where x and y are not defined function will return x and y.- Returns:
- Array of missing user defined arguments names - distinct strings.
-
getMissingUserDefinedUnits
public java.lang.String[] getMissingUserDefinedUnits()
Returns missing user defined units names, i.e. 2*[w] + [q] where [w] and [q] are not defined function will return [w] and [q].- Returns:
- Array of missing user defined units names - distinct strings.
-
getMissingUserDefinedFunctions
public java.lang.String[] getMissingUserDefinedFunctions()
Returns missing user defined functions names, i.e. sin(x) + fun(x,y) where fun is not defined function will return fun.- Returns:
- Array of missing user defined functions names - distinct strings.
-
getInitialTokens
java.util.List<Token> getInitialTokens()
Gets initial tokens and returns copied list- See Also:
Function
-
showParsing
private void showParsing(int lPos, int rPos)Shows parsing (verbose mode purposes).
-
showKeyWords
void showKeyWords()
shows known keywords
-
getHelp
public java.lang.String getHelp()
Returns detailed user help on the syntax of mathematical expressions.- Returns:
- One string value containing all the help.
-
getHelp
public java.lang.String getHelp(java.lang.String query)
Returns detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.- Returns:
- One string value containing all the help.
-
getHelp
public java.lang.String getHelp(boolean addHeader, boolean addCaption, java.lang.String caption)Returns detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
addHeader- Indicator whether to add a header.addCaption- Indicator whether to add caption.caption- If a non-standard caption is to be added, any string other than "" will replace the standard caption with the one specified by the user.- Returns:
- One string value containing all the help.
-
getHelp
public java.lang.String getHelp(java.lang.String query, boolean addHeader, boolean addCaption, java.lang.String caption)Returns detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.addHeader- Indicator whether to add a header.addCaption- Indicator whether to add caption.caption- If a non-standard caption is to be added, any string other than ""- Returns:
- One string value containing all the help.
-
getHelpAsCsv
public java.lang.String getHelpAsCsv()
Returns (as CSV) detailed user help on the syntax of mathematical expressions.- Returns:
- One string value in CSV format containing all the help.
-
getHelpAsCsv
public java.lang.String getHelpAsCsv(java.lang.String query)
Returns (as CSV) detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.- Returns:
- One string value in CSV format containing all the help.
-
getHelpAsCsv
public java.lang.String getHelpAsCsv(java.lang.String quote, java.lang.String delimiter, boolean addHeader)Returns (as CSV) detailed user help on the syntax of mathematical expressions.- Parameters:
quote- Text qualifier.delimiter- Delimiter.addHeader- Indicator whether to add a header.- Returns:
- One string value in CSV format containing all the help.
-
getHelpAsCsv
public java.lang.String getHelpAsCsv(java.lang.String query, java.lang.String quote, java.lang.String delimiter, boolean addHeader)Returns (as CSV) detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.quote- Text qualifier.delimiter- Delimiter.addHeader- Indicator whether to add a header.- Returns:
- One string value in CSV format containing all the help.
-
getHelpAsHtmlTable
public java.lang.String getHelpAsHtmlTable()
Returns (as HTML table) detailed user help on the syntax of mathematical expressions.- Returns:
- One string value containing all the help. String in HTML table format.
-
getHelpAsHtmlTable
public java.lang.String getHelpAsHtmlTable(java.lang.String query)
Returns (as HTML table) detailed user help on the syntax of mathematical expressions.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.- Returns:
- One string value containing all the help. String in HTML table format.
-
getHelpAsHtmlTable
public java.lang.String getHelpAsHtmlTable(boolean addHeader, boolean addCaption, boolean addFigure, java.lang.String caption, java.lang.String cssClass)Returns (as HTML table) detailed user help on the syntax of mathematical expressions.- Parameters:
addHeader- Indicator whether to add a header.addCaption- Indicator whether to add caption.addFigure- Indicator whether to add a FIGURE tag.caption- If a non-standard caption is to be added, use any string other than "".cssClass- If CSS class is to be added, use any string other than "".- Returns:
- One string value containing all the help. String in HTML table format.
-
getHelpAsHtmlTable
public java.lang.String getHelpAsHtmlTable(java.lang.String query, boolean addHeader, boolean addCaption, boolean addFigure, java.lang.String caption, java.lang.String cssClass)Returns (as HTML table) detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.addHeader- Indicator whether to add a header.addCaption- Indicator whether to add caption.addFigure- Indicator whether to add a FIGURE tag.caption- If a non-standard caption is to be added, use any string other than "".cssClass- If CSS class is to be added, use any string other than "".- Returns:
- One string value containing all the help. String in HTML table format.
-
getHelpAsMarkdownTable
public java.lang.String getHelpAsMarkdownTable()
Returns (as Markdown table) detailed user help on the syntax of mathematical expressions.- Returns:
- One string value containing all the help. String in Markdown table format.
-
getHelpAsMarkdownTable
public java.lang.String getHelpAsMarkdownTable(java.lang.String query)
Returns (as Markdown table) detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.- Returns:
- One string value containing all the help. String in Markdown table format.
-
getHelpAsMarkdownTable
public java.lang.String getHelpAsMarkdownTable(boolean addHeader, boolean addCaption, java.lang.String caption)Returns (as Markdown table) detailed user help on the syntax of mathematical expressions.- Parameters:
addHeader- Indicator whether to add a header.addCaption- Indicator whether to add caption.caption- If a non-standard caption is to be added, use any string other than "".- Returns:
- One string value containing all the help. String in Markdown table format.
-
getHelpAsMarkdownTable
public java.lang.String getHelpAsMarkdownTable(java.lang.String query, boolean addHeader, boolean addCaption, java.lang.String caption)Returns (as Markdown table) detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.addHeader- Indicator whether to add a header.addCaption- Indicator whether to add caption.caption- If a non-standard caption is to be added, use any string other than "".- Returns:
- One string value containing all the help. String in Markdown table format.
-
getHelpAsJson
public java.lang.String getHelpAsJson()
Returns (as Json) detailed user help on the syntax of mathematical expressions.- Returns:
- One string value containing all the help. String in Json format.
-
getHelpAsJson
public java.lang.String getHelpAsJson(java.lang.String query)
Returns (as Json) detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.- Returns:
- One string value containing all the help. String in Json format.
-
getHelpAsJson
public java.lang.String getHelpAsJson(boolean addCaption, java.lang.String caption)Returns (as Json) detailed user help on the syntax of mathematical expressions.- Parameters:
addCaption- Indicator whether to add caption.caption- If a non-standard caption is to be added, use any string other than "".- Returns:
- One string value containing all the help. String in Json format.
-
getHelpAsJson
public java.lang.String getHelpAsJson(java.lang.String query, boolean addCaption, java.lang.String caption)Returns (as Json) detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.addCaption- Indicator whether to add caption.caption- If a non-standard caption is to be added, use any string other than "".- Returns:
- One string value containing all the help. String in Json format.
-
getKeyWords
public java.util.List<KeyWord> getKeyWords()
Returns list of keywords known to the parser- Returns:
- List of keywords known to the parser.
- See Also:
KeyWord,KeyWord.wordTypeId,getHelp()
-
getKeyWords
public java.util.List<KeyWord> getKeyWords(java.lang.String query)
Returns list of keywords known to the parser. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.- Returns:
- List of keywords known to the parser filter against query string.
- See Also:
KeyWord,KeyWord.wordTypeId,getHelp(String)
-
showTokens
void showTokens()
-
showTokens
static void showTokens(java.util.List<Token> tokensList)
-
showInitialTokens
void showInitialTokens()
shows initial tokens
-
showArguments
private void showArguments()
-
printSystemInfo
private void printSystemInfo(java.lang.String info, boolean withExpressionString)- Parameters:
info-withExpressionString-
-
clone
protected Expression clone()
Expression cloning.- Overrides:
clonein classjava.lang.Object
-
cloneForThreadSafeInternal
Expression cloneForThreadSafeInternal(CloneCache cloneCache)
-
cloneForThreadSafe
public Expression 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.
-
-