Class Expression
java.lang.Object
org.mariuszgromada.math.mxparser.PrimitiveElement
org.mariuszgromada.math.mxparser.Expression
- All Implemented Interfaces:
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionList of argumentsprivate booleanInternal indicator informing the parser whether to try to fix the expression String.private CompilationDetails(package private) doubleKeeps computing timeList of user defined constantsprivate StringExpression description(package private) static final boolean(package private) booleanInternal parameter for calculus expressions to avoid decrease in accuracy.private static final doubleprivate static final intprivate StringMessage after checking the syntaxprivate StringOptional message from calculate method(package private) StringExpression string (for example: "sin(x)+cos(y)")private StringExpression string after attempt to clean(package private) booleanif true then new tokenizing is required (the initialTokens list needs to be updated)private booleanAn indicator of whether an error message should be passed from the current expression to the expression that called it.(package private) static final intList of user defined functionsprivate static final doubleprivate booleanFires an error when impliedMultiplicationMode is on and there is a missing multiplication operatorprivate booleanImplied multiplication modeprivate CompilationDetailsList of expression tokens (words).(package private) static final booleanMarker for internal processingprivate booleanInternal 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 boolean(package private) static final booleanList of keywords known by the parserList of string tokens that should not be considered while seeking for optional implied multiplication.private static final booleanstatic final booleanStatus of the syntax - no syntax error(package private) static final intFOUND / NOT_FOUND used for matching purposesprivate intmXparser options changeset used in checkSyntax() methodprivate booleanInternal indicator for tokenization process if true, then keywords such as constants functions etc...private static final doubleprivate booleanLog used internally to mark started recursion call on the current object, necessary to avoid infinite loops while recursive syntax checking (i.e.private intInternal 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) booleanIf recursive mode is on the recursive calls are permitted.(package private) List<Expression> List of related expressions, for example when user defined function is used in the expression or dependent argument was defined.private static final intprivate static final longstatic final booleanStatus of the syntax - syntax error or syntax status unknownstatic final booleanDeprecated.private static final booleanprivate booleanStatus of the expression syntax Please referet to the: - NO_SYNTAX_ERRORS - SYNTAX_ERROR - SYNTAX_STATUS_UNKNOWNthe initialTokens list keeps unchanged information about found tokens.static Stringstatic final intExpression type id(package private) booleanIndicator whether expression was automatically built for user defined functions purposeList of parameters provided by the user at run-timeprivate booleanInternal indicator informing hte parser that unicode know keywords are enabled and will be recognized by the parser as built-in functions or operatorsprivate booleanVerbose mode prints processing info calls System.out.print* methodsprivate static final booleanFor verbose mode purposes -
Constructor Summary
ConstructorsModifierConstructorDescription(package private)Expression(String expressionString, boolean parserKeyWordsOnly) Constructor - creates new expression from expression string.(package private)Expression(String expressionString, List<Argument> argumentsList, List<Function> functionsList, List<Constant> constantsList, boolean internal, boolean UDFExpression, List<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(String expressionString, List<Token> initialTokens, List<Argument> argumentsList, List<Function> functionsList, List<Constant> constantsList, boolean disableUlpRounding, boolean UDFExpression, List<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(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
Modifier and TypeMethodDescriptionprivate 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(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 voidprivate voidAdds expression token Method is called by the tokenExpressionString() while parsing string expressionprivate voidprivate voidAND(int pos) Logical ANDprivate voidAND_VARIADIC(int pos) AND_VARIADICprivate intapplySequenceFromCompilation(CalcStepsRegister calcStepsRegister, 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.doubleCalculates the expression value and registers all the calculation stepsdoublecalculate(CalcStepsRegister calcStepsRegister) Calculates the expression valueprivate intcalculateFirstAndFullyCompile(CalcStepsRegister calcStepsRegister, 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 booleanMethod 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(String param) Checks syntax of the calculus parameterprivate booleancheckFraction(Token token) Checks whether unknown token represents fraction provided as fraction or mixed fractionbooleanGets attempt to fix expression string modebooleanGets implied multiplication statusprivate static booleanChecks if argument given in the function parameter is known in the expression.booleanGets unicode built-in parser keywords modeprivate static booleanChecks if token is uknownprivate booleancheckInternalSyntaxCalculusOperatorDerivative(String recursionInfoLevel, Token token, String tokenInfoMessage, Stack<SyntaxStackElement> syntaxStack, int paramsNumber, List<FunctionParameter> funParams) private booleancheckInternalSyntaxCalculusOperatorDerivativeNth(String recursionInfoLevel, Token token, String tokenInfoMessage, Stack<SyntaxStackElement> syntaxStack, int paramsNumber, List<FunctionParameter> funParams) private booleancheckInternalSyntaxCalculusOperatorForwardBackwardDiff(String recursionInfoLevel, Token token, String tokenInfoMessage, Stack<SyntaxStackElement> syntaxStack, int paramsNumber, List<FunctionParameter> funParams) private booleancheckInternalSyntaxCalculusOperatorIntegralSolve(String recursionInfoLevel, Token token, String tokenInfoMessage, Stack<SyntaxStackElement> syntaxStack, int paramsNumber, List<FunctionParameter> funParams) private booleancheckInternalSyntaxCalculusOperatorIterated(String recursionInfoLevel, Token token, String tokenInfoMessage, Stack<SyntaxStackElement> syntaxStack, int paramsNumber, List<FunctionParameter> funParams) booleanChecks 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(String recursionInfoLevel, int tokenIndex, Token token, String tokenInfoMessage) private booleancheckPartialSyntaxBuiltinConstant(String recursionInfoLevel, int tokenIndex, Token token, String tokenInfoMessage) private booleancheckPartialSyntaxCalculusOperator(String recursionInfoLevel, int tokenIndex, Token token, String tokenInfoMessage, Stack<SyntaxStackElement> syntaxStack) private booleancheckPartialSyntaxDuplicatedKeywords(String recursionInfoLevel) private booleancheckPartialSyntaxImpliedMultiplication(String recursionInfoLevel) private booleancheckPartialSyntaxInvalidToken(String recursionInfoLevel, Token token, String tokenInfoMessage, Stack<SyntaxStackElement> syntaxStack) private booleancheckPartialSyntaxTernaryFunction(String recursionInfoLevel, int tokenIndex, Token token, String tokenInfoMessage) private booleancheckPartialSyntaxUnaryFunction(String recursionInfoLevel, int tokenIndex, Token token, String tokenInfoMessage) private booleancheckPartialSyntaxUserDefinedArgument(String recursionInfoLevel, int tokenIndex, Token token, String tokenInfoMessage) private booleancheckPartialSyntaxUserDefinedConstant(String recursionInfoLevel, int tokenIndex, Token token, String tokenStr) private booleancheckPartialSyntaxUserDefinedFunction(String recursionInfoLevel, int tokenIndex, Token token, String tokenInfoMessage) private booleancheckPartialSyntaxUserDefinedRecursiveArgument(String recursionInfoLevel, int tokenIndex, Token token, String tokenInfoMessage) private booleancheckPartialSyntaxVariadicFunction(String recursionInfoLevel, int tokenIndex, Token token, String tokenInfoMessage) private booleancheckSpecialConstantName(Token token) Check whether we have a case of '[abc]'booleanChecks syntax of the expression string.private booleancheckSyntax(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 voidCleans blanks and other cases like "++', "+-", "-+"", "--"voidClears expression descriptionvoidClears expression stringprivate voidclearParamArgument(ArgumentParameter argParam) Clears argument parameter.protected Expressionclone()Expression cloning.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 commavoidPrints 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 voidcopy 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 tokencreateInitialTokens(int startPos, int endPos, 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(String argumentName, double argumentValue) Enables to define the argument (associated with the expression) based on the argument name and the argument value.voiddefineArguments(String... argumentsNames) Enables to define the arguments (associated with the expression) based on the given arguments names.voiddefineConstant(String constantName, double constantValue) Enables to define the constant (associated with the expression) based on the constant name and constant value.voiddefineFunction(String functionName, String functionExpressionString, 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 systemvoidDisables attempt to fix the expression String.voidDisables implied multiplication(package private) voidDisables recursive modevoidDisables 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.voidEnables attempt to fix the expression String.voidSets implied multiplicationvoidEnables 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 voidCommon elements while expression initializingprivate voidCommon 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 equalgetArgument(int argumentIndex) Gets argument from the expression.getArgument(String argumentName) Gets argument from the expression.intgetArgumentIndex(String argumentName) Gets argument index from the expression.intGets number of arguments associated with the expression.doublegetArgumentValue(String argumentName) Gets argument vale.Returns expression stringdoubleGets computing time.getConstant(int constantIndex) Gets constant associated with the expression.getConstant(String constantName) Gets constant associated with the expression.intgetConstantIndex(String constantName) Gets constant index associated with the expression.intGets number of constants associated with the expression.Tokenizes expression string and returns tokens list, including: string, type, level.Gets expression description.Method return error message after calling checkSyntax() method or calculate().Returns expression stringgetFunction(int functionIndex) Gets function associated with the expression.getFunction(String functionName) Gets function associated with the expression.intgetFunctionIndex(String functionName) Gets index of function associated with the expression.intGets number of functions associated with the expression.getHelp()Returns detailed user help on the syntax of mathematical expressions.Returns detailed user help on the syntax of mathematical expressions.Returns detailed user help on the syntax of mathematical expressions.Returns detailed user help on the syntax of mathematical expressions.Returns (as CSV) detailed user help on the syntax of mathematical expressions.getHelpAsCsv(String query) Returns (as CSV) detailed user help on the syntax of mathematical expressions.getHelpAsCsv(String quote, String delimiter, boolean addHeader) Returns (as CSV) detailed user help on the syntax of mathematical expressions.getHelpAsCsv(String query, String quote, String delimiter, boolean addHeader) Returns (as CSV) detailed user help on the syntax of mathematical expressions.Returns (as HTML table) detailed user help on the syntax of mathematical expressions.getHelpAsHtmlTable(boolean addHeader, boolean addCaption, boolean addFigure, String caption, String cssClass) Returns (as HTML table) detailed user help on the syntax of mathematical expressions.getHelpAsHtmlTable(String query) Returns (as HTML table) detailed user help on the syntax of mathematical expressions.getHelpAsHtmlTable(String query, boolean addHeader, boolean addCaption, boolean addFigure, String caption, String cssClass) Returns (as HTML table) detailed user help on the syntax of mathematical expressions.Returns (as Json) detailed user help on the syntax of mathematical expressions.getHelpAsJson(boolean addCaption, String caption) Returns (as Json) detailed user help on the syntax of mathematical expressions.getHelpAsJson(String query) Returns (as Json) detailed user help on the syntax of mathematical expressions.getHelpAsJson(String query, boolean addCaption, String caption) Returns (as Json) detailed user help on the syntax of mathematical expressions.Returns (as Markdown table) detailed user help on the syntax of mathematical expressions.getHelpAsMarkdownTable(boolean addHeader, boolean addCaption, String caption) Returns (as Markdown table) detailed user help on the syntax of mathematical expressions.getHelpAsMarkdownTable(String query) Returns (as Markdown table) detailed user help on the syntax of mathematical expressions.getHelpAsMarkdownTable(String query, boolean addHeader, boolean addCaption, String caption) Returns (as Markdown table) detailed user help on the syntax of mathematical expressions.Gets initial tokens and returns copied listReturns list of keywords known to the parsergetKeyWords(String query) Returns list of keywords known to the parser.String[]Returns missing user defined arguments names, i.e.String[]Returns missing user defined functions names, i.e.String[]Returns missing user defined units names, i.e.getNumbers(int pos) Creates ArraListcontaining function parameters private ArgumentParametergetParamArgument(String argumentName) Gets / returns argument representing given argument name.private intgetParametersNumber(int pos) Return number of functions parameters.booleanGets recursive mode statusbooleanGets syntax status of the expression.private doublegetTokenValue(int tokenIndex) Gets token valuebooleanReturns 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 voidCreates 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 String(package private) voidprivate 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 voidprivate 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, 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(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, String stepDescription) private voidregisterCalculationStepRecord(CalcStepsRegister calcStepsRegister, int stepsRegisteredCounter, String stepDescription, double result) private voidregisterCompiledElement(CompiledElement.ToCall toCall, int position) private voidregisterCompiledElement(CompiledElement.ToCall toCall, int position1, int position2) private voidregisterErrorWhileCalculate(String errorMessageToAdd) private voidregisterFinalSyntax(String recursionInfoLevel, boolean syntax) private voidregisterFinalSyntaxAlreadyCheckedNorErrors(String recursionInfoLevel) private voidregisterFinalSyntaxExpressionStringIsEmpty(String recursionInfoLevel) private voidregisterFinalSyntaxFunctionWithBodyExtNoErrors(String recursionInfoLevel) private voidregisterPartialSyntaxStartingSyntaxCheck(String recursionInfoLevel) private voidregisterSyntaxLexicalError(String recursionInfoLevel, Throwable e) voidRemoves all arguments associated with the expression.voidRemoves all constants associated with the expressionvoidRemoves all functions associated with the expression.voidremoveArguments(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(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(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(String argumentName, double argumentValue) Sets argument value.voidsetDescription(String description) Sets expression description.(package private) voidSets expression status to modified Calls setExpressionModifiedFlag() method to all related expressions.voidsetExpressionString(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) voidSets recursive modevoidDisables verbose mode (default silent mode).(package private) voidsetSyntaxStatus(boolean syntaxStatus, 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.voidEnables 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 void(package private) voidshows initial tokens(package private) voidshows known keywordsprivate voidshowParsing(int lPos, int rPos) Shows parsing (verbose mode purposes).(package private) voidPrints related expression list(package private) void(package private) static voidshowTokens(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 booleanprivate 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 voidTokenizing expression stringprivate booleantryAssignKnownKeyword(Token token) Tries to find known keyword for a given token via string matchingprivate KeyWordtryFindKnownKeyword(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(List<Token> tokens, 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 voidFinal 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_VARIADICMethods inherited from class PrimitiveElement
getMyTypeId
-
Field Details
-
serialClassID
private static final int serialClassID- See Also:
-
serialVersionUID
private static final long serialVersionUID -
TYPE_ID
public static final int TYPE_IDExpression type id- See Also:
-
TYPE_DESC
-
NOT_FOUND
static final int NOT_FOUNDFOUND / NOT_FOUND used for matching purposes- See Also:
-
FOUND
static final int FOUND- See Also:
-
INTERNAL
static final boolean INTERNALMarker for internal processing- See Also:
-
WITH_EXP_STR
private static final boolean WITH_EXP_STRFor verbose mode purposes- See Also:
-
NO_EXP_STR
private static final boolean NO_EXP_STR- See Also:
-
NO_SYNTAX_ERRORS
public static final boolean NO_SYNTAX_ERRORSStatus of the syntax - no syntax error- See Also:
-
SYNTAX_ERROR
public static final boolean SYNTAX_ERRORStatus of the syntax - syntax error or syntax status unknown- See Also:
-
SYNTAX_ERROR_OR_STATUS_UNKNOWN
Deprecated.Planned to be removed, useSYNTAX_ERRORinsteadStatus of the syntax - syntax error or syntax status unknown- See Also:
-
SYNTAX_STATUS_UNKNOWN
private static final boolean SYNTAX_STATUS_UNKNOWN- See Also:
-
expressionString
String expressionStringExpression string (for example: "sin(x)+cos(y)") -
expressionStringCleaned
Expression string after attempt to clean -
description
Expression description -
argumentsList
-
functionsList
-
constantsList
-
keyWordsList
-
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
-
neverParseForImpliedMultiplication
-
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
-
computingTime
double computingTimeKeeps computing time -
expressionWasModified
boolean expressionWasModifiedif true then new tokenizing is required (the initialTokens list needs to be updated) -
recursiveMode
boolean recursiveModeIf 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 verboseModeVerbose mode prints processing info calls System.out.print* methods -
impliedMultiplicationMode
private boolean impliedMultiplicationModeImplied multiplication mode -
impliedMultiplicationError
private boolean impliedMultiplicationErrorFires an error when impliedMultiplicationMode is on and there is a missing multiplication operator -
disableRounding
boolean disableRoundingInternal parameter for calculus expressions to avoid decrease in accuracy. -
DISABLE_ROUNDING
static final boolean DISABLE_ROUNDING- See Also:
-
KEEP_ROUNDING_SETTINGS
static final boolean KEEP_ROUNDING_SETTINGS- See Also:
-
syntaxStatus
private boolean syntaxStatusStatus of the expression syntax Please referet to the: - NO_SYNTAX_ERRORS - SYNTAX_ERROR - SYNTAX_STATUS_UNKNOWN -
isFullyCompiled
private boolean isFullyCompiled -
errorMessage
Message after checking the syntax -
errorMessageCalculate
Optional message from calculate method -
ERROR_MESSAGE_CALCULATE_MAXIMUM_LENGTH
private static final int ERROR_MESSAGE_CALCULATE_MAXIMUM_LENGTH- See Also:
-
recursionCallPending
private boolean recursionCallPendingLog 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:
-
recursionCallsCounter
private int recursionCallsCounterInternal 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 parserKeyWordsOnlyInternal indicator for tokenization process if true, then keywords such as constants functions etc... will not be recognized during tokenization -
unicodeKeyWordsEnabled
private boolean unicodeKeyWordsEnabledInternal 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 attemptToFixExpStrEnabledInternal 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 UDFExpressionIndicator whether expression was automatically built for user defined functions purpose- See Also:
-
UDFVariadicParamsAtRunTime
-
internalClone
private boolean internalCloneInternal 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 forwardErrorMessageAn indicator of whether an error message should be passed from the current expression to the expression that called it. -
optionsChangesetNumber
private int optionsChangesetNumbermXparser 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 Details
-
Expression
Default constructor - empty expression- Parameters:
elements- Optional elements list (variadic - comma separated) of types: Argument, Constant, Function- See Also:
-
Expression
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:
-
Expression
Expression(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(String expressionString, List<Token> initialTokens, List<Argument> argumentsList, List<Function> functionsList, List<Constant> constantsList, boolean disableUlpRounding, boolean UDFExpression, List<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(String expressionString, List<Argument> argumentsList, List<Function> functionsList, List<Constant> constantsList, boolean internal, boolean UDFExpression, List<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:
-
Expression
-
-
Method Details
-
addRelatedExpression
Adds related expression The same expression could be added more than once For example when- Parameters:
expression- the expression
-
removeRelatedExpression
Removes related expression- Parameters:
expression- the expression
-
showRelatedExpressions
void showRelatedExpressions()Prints related expression list -
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
Package level method for passing information about errors identified on the constructors level- Parameters:
syntaxStatus- Syntax statuserrorMessage- Error message- See Also:
-
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
Sets (modifies expression) expression string.- Parameters:
expressionString- the expression string
-
getExpressionString
Returns expression string- Returns:
- Expression string definition.
-
getCanonicalExpressionString
Returns expression string- Returns:
- Expression string definition.
-
clearExpressionString
public void clearExpressionString()Clears expression string -
setDescription
Sets expression description.- Parameters:
description- the description string
-
getDescription
-
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
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:
-
removeDefinitions
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:
-
addArguments
Adds arguments (variadic) to the expression definition.- Parameters:
arguments- the arguments list (comma separated list)- See Also:
-
defineArguments
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:
-
defineArgument
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:
-
getArgumentIndex
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:
-
getArgument
-
getArgument
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:
-
getArgumentsNumber
public int getArgumentsNumber()Gets number of arguments associated with the expression.- Returns:
- The number of arguments (int >= 0)
- See Also:
-
setArgumentValue
Sets argument value.- Parameters:
argumentName- the argument nameargumentValue- the argument value
-
getArgumentValue
Gets argument vale.- Parameters:
argumentName- the argument name- Returns:
- Argument value if argument name was found, otherwise return Double.NaN.
-
removeArguments
Removes first occurrences of the arguments associated with the expression.- Parameters:
argumentsNames- the arguments names (variadic parameters) comma separated list- See Also:
-
removeArguments
Removes first occurrences of the arguments associated with the expression.- Parameters:
arguments- the arguments (variadic parameters) comma separated list- See Also:
-
removeAllArguments
public void removeAllArguments()Removes all arguments associated with the expression.- See Also:
-
addConstants
Adds constants (variadic parameters) to the expression definition.- Parameters:
constants- the constants (comma separated list)- See Also:
-
addConstants
-
defineConstant
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:
-
getConstantIndex
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:
-
getConstant
-
getConstant
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:
-
getConstantsNumber
public int getConstantsNumber()Gets number of constants associated with the expression.- Returns:
- number of constants (int >= 0)
- See Also:
-
removeConstants
Removes first occurrences of the constants associated with the expression.- Parameters:
constantsNames- the constants names (variadic parameters) comma separated list- See Also:
-
removeConstants
Removes first occurrences of the constants associated with the expression- Parameters:
constants- the constants (variadic parameters) comma separated list- See Also:
-
removeAllConstants
public void removeAllConstants()Removes all constants associated with the expression- See Also:
-
addFunctions
Adds functions (variadic parameters) to the expression definition.- Parameters:
functions- the functions (variadic parameters) comma separated list- See Also:
-
defineFunction
public void defineFunction(String functionName, String functionExpressionString, 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:
-
getFunctionIndex
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:
-
getFunction
-
getFunction
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:
-
getFunctionsNumber
public int getFunctionsNumber()Gets number of functions associated with the expression.- Returns:
- number of functions (int >= 0)
- See Also:
-
removeFunctions
Removes first occurrences of the functions associated with the expression.- Parameters:
functionsNames- the functions names (variadic parameters) comma separated list- See Also:
-
removeFunctions
Removes first occurrences of the functions associated with the expression.- Parameters:
functions- the functions (variadic parameters) comma separated list.- See Also:
-
removeAllFunctions
public void removeAllFunctions()Removes all functions associated with the expression.- See Also:
-
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
-
getParametersNumber
private int getParametersNumber(int pos) Return number of functions parameters.- Parameters:
pos- the function position
-
getParamArgument
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:
-
clearParamArgument
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
Dependent Arguments handling.- Parameters:
pos- the token position
-
USER_FUNCTION
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
-
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(List<Token> tokens, 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
Checks syntax of the calculus parameter- Returns:
- true if syntax is ok
-
checkIfKnownArgument
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
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
-
registerFinalSyntaxFunctionWithBodyExtNoErrors
-
registerFinalSyntaxExpressionStringIsEmpty
-
registerSyntaxLexicalError
-
registerFinalSyntax
-
registerPartialSyntaxStartingSyntaxCheck
-
checkPartialSyntaxImpliedMultiplication
-
checkPartialSyntaxDuplicatedKeywords
-
checkPartialSyntaxUserDefinedArgument
-
checkPartialSyntaxUserDefinedRecursiveArgument
-
checkPartialSyntaxInvalidToken
private boolean checkPartialSyntaxInvalidToken(String recursionInfoLevel, Token token, String tokenInfoMessage, Stack<SyntaxStackElement> syntaxStack) -
checkPartialSyntaxUserDefinedFunction
-
checkPartialSyntaxBuiltinConstant
-
checkPartialSyntaxUserDefinedConstant
-
checkPartialSyntaxUnaryFunction
-
checkPartialSyntaxBinaryFunction
-
checkPartialSyntaxTernaryFunction
-
checkInternalSyntaxCalculusOperatorDerivative
private boolean checkInternalSyntaxCalculusOperatorDerivative(String recursionInfoLevel, Token token, String tokenInfoMessage, Stack<SyntaxStackElement> syntaxStack, int paramsNumber, List<FunctionParameter> funParams) -
checkInternalSyntaxCalculusOperatorDerivativeNth
private boolean checkInternalSyntaxCalculusOperatorDerivativeNth(String recursionInfoLevel, Token token, String tokenInfoMessage, Stack<SyntaxStackElement> syntaxStack, int paramsNumber, List<FunctionParameter> funParams) -
checkInternalSyntaxCalculusOperatorIntegralSolve
private boolean checkInternalSyntaxCalculusOperatorIntegralSolve(String recursionInfoLevel, Token token, String tokenInfoMessage, Stack<SyntaxStackElement> syntaxStack, int paramsNumber, List<FunctionParameter> funParams) -
checkInternalSyntaxCalculusOperatorIterated
private boolean checkInternalSyntaxCalculusOperatorIterated(String recursionInfoLevel, Token token, String tokenInfoMessage, Stack<SyntaxStackElement> syntaxStack, int paramsNumber, List<FunctionParameter> funParams) -
checkInternalSyntaxCalculusOperatorForwardBackwardDiff
private boolean checkInternalSyntaxCalculusOperatorForwardBackwardDiff(String recursionInfoLevel, Token token, String tokenInfoMessage, Stack<SyntaxStackElement> syntaxStack, int paramsNumber, List<FunctionParameter> funParams) -
checkPartialSyntaxVariadicFunction
-
checkPartialSyntaxCalculusOperator
private boolean checkPartialSyntaxCalculusOperator(String recursionInfoLevel, int tokenIndex, Token token, String tokenInfoMessage, Stack<SyntaxStackElement> syntaxStack) -
performSyntaxStackPopIfEndOfSectionLevel
private static void performSyntaxStackPopIfEndOfSectionLevel(Token token, Stack<SyntaxStackElement> syntaxStack) -
checkSyntax
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
-
calculate
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
-
registerCalculationStepRecord
private void registerCalculationStepRecord(CalcStepsRegister calcStepsRegister, int stepsRegisteredCounter, String stepDescription) -
registerCalculationStepRecord
private void registerCalculationStepRecord(CalcStepsRegister calcStepsRegister, int stepsRegisteredCounter, String stepDescription, double result) -
calculateFirstAndFullyCompile
private int calculateFirstAndFullyCompile(CalcStepsRegister calcStepsRegister, String stepDescription) -
applySequenceFromCompilation
private int applySequenceFromCompilation(CalcStepsRegister calcStepsRegister, String stepDescription) -
calculateInternal
-
registerCompiledElement
-
registerCompiledElement
-
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
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
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
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
Adds fraction token to the tokens list- Parameters:
token- The token
-
checkFraction
Checks whether unknown token represents fraction provided as fraction or mixed fraction- Parameters:
token- The token not know to the parser
-
initialTokensAdd
Handles implied multiplication while adding single token to the tokens list is checking preceding token- Parameters:
token- The token
-
assignKnownKeyword
-
tryFindKnownKeyword
-
tryAssignKnownKeyword
Tries to find known keyword for a given token via string matching- Parameters:
token- The token- Returns:
- true if keyword matched, otherwise false
-
initialTokensAddTokenPart
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
-
addToken
-
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
-
consolePrintCopyOfInitialTokens
public void consolePrintCopyOfInitialTokens()Prints to the console copy of initial tokens. Presents how expression string is interpreted by the parser.- See Also:
-
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
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
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
-
showParsing
private void showParsing(int lPos, int rPos) Shows parsing (verbose mode purposes). -
showKeyWords
void showKeyWords()shows known keywords -
getHelp
Returns detailed user help on the syntax of mathematical expressions.- Returns:
- One string value containing all the help.
-
getHelp
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
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
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
Returns (as CSV) detailed user help on the syntax of mathematical expressions.- Returns:
- One string value in CSV format containing all the help.
-
getHelpAsCsv
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
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
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
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
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 String getHelpAsHtmlTable(boolean addHeader, boolean addCaption, boolean addFigure, String caption, 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 String getHelpAsHtmlTable(String query, boolean addHeader, boolean addCaption, boolean addFigure, String caption, 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
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
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
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 String getHelpAsMarkdownTable(String query, boolean addHeader, boolean addCaption, 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
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
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
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
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
-
getKeyWords
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:
-
showTokens
void showTokens() -
showTokens
-
showInitialTokens
void showInitialTokens()shows initial tokens -
showArguments
private void showArguments() -
printSystemInfo
- Parameters:
info-withExpressionString-
-
clone
-
cloneForThreadSafeInternal
-
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.
-
SYNTAX_ERRORinstead