Class Expression

java.lang.Object
org.mariuszgromada.math.mxparser.PrimitiveElement
org.mariuszgromada.math.mxparser.Expression
All Implemented Interfaces:
Serializable

public class Expression extends PrimitiveElement implements 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 Details

    • serialClassID

      private static final int serialClassID
      See Also:
    • serialVersionUID

      private static final long serialVersionUID
    • TYPE_ID

      public static final int TYPE_ID
      Expression type id
      See Also:
    • TYPE_DESC

      public static String TYPE_DESC
    • NOT_FOUND

      static final int NOT_FOUND
      FOUND / NOT_FOUND used for matching purposes
      See Also:
    • FOUND

      static final int FOUND
      See Also:
    • INTERNAL

      static final boolean INTERNAL
      Marker for internal processing
      See Also:
    • WITH_EXP_STR

      private static final boolean WITH_EXP_STR
      For 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_ERRORS
      Status of the syntax - no syntax error
      See Also:
    • SYNTAX_ERROR

      public static final boolean SYNTAX_ERROR
      Status of the syntax - syntax error or syntax status unknown
      See Also:
    • SYNTAX_ERROR_OR_STATUS_UNKNOWN

      @Deprecated public static final boolean SYNTAX_ERROR_OR_STATUS_UNKNOWN
      Deprecated.
      Planned to be removed, use SYNTAX_ERROR instead
      Status 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 expressionString
      Expression string (for example: "sin(x)+cos(y)")
    • expressionStringCleaned

      private String expressionStringCleaned
      Expression string after attempt to clean
    • description

      private String description
      Expression description
    • argumentsList

      List<Argument> argumentsList
      List of arguments
      See Also:
    • functionsList

      List<Function> functionsList
      List of user defined functions
      See Also:
    • constantsList

      List<Constant> constantsList
      List of user defined constants
      See Also:
    • keyWordsList

      private List<KeyWord> keyWordsList
      List of keywords known by the parser
    • initialTokens

      List<Token> initialTokens
      List of expression tokens (words). Token class defines all needed attributes for recognizing the structure of arithmetic expression. This is the key result when initial parsing is finished (tokenizeExpressionString() - method). Token keeps information about: - token type (for example: function, operator, argument, number, etc...) - token identifier within given type (sin, cos, operaotr, etc...) - token value (if token is a number) - token level - key information regarding sequence (order) of further parsing
    • initialCompilationDetails

      private CompilationDetails initialCompilationDetails
    • neverParseForImpliedMultiplication

      private Set<String> neverParseForImpliedMultiplication
      List of string tokens that should not be considered while seeking for optional implied multiplication. Example: sum( x2y, 1, 10, 2*x2y) Here x2y should always stay as x2y
    • tokensList

      private List<Token> tokensList
      the initialTokens list keeps unchanged information about found tokens. While parsing the tokensList is used. The tokensList is the same as initialTokens list at the beginning of the calculation process. Each math operation changes tokens list - it means that tokens are parameters when performing math operation and the result is also presented as token (usually as a number token) At the end of the calculation the tokensList should contain only one element - the result of all calculations.
    • compilationDetails

      private CompilationDetails compilationDetails
    • relatedExpressionsList

      List<Expression> relatedExpressionsList
      List of related expressions, for example when user defined function is used in the expression or dependent argument was defined. Modification of function expression calls the method expression modified flag method to all related expressions. Related expression usually are used for - dependent arguments - recursive arguments - user functions
    • computingTime

      double computingTime
      Keeps computing time
    • expressionWasModified

      boolean expressionWasModified
      if true then new tokenizing is required (the initialTokens list needs to be updated)
    • recursiveMode

      boolean recursiveMode
      If recursive mode is on the recursive calls are permitted. It means there will be no null pointer exceptions due to expression, and functions cloning.
    • verboseMode

      private boolean verboseMode
      Verbose mode prints processing info calls System.out.print* methods
    • impliedMultiplicationMode

      private boolean impliedMultiplicationMode
      Implied multiplication mode
    • impliedMultiplicationError

      private boolean impliedMultiplicationError
      Fires an error when impliedMultiplicationMode is on and there is a missing multiplication operator
    • disableRounding

      boolean disableRounding
      Internal parameter for calculus expressions to avoid decrease in accuracy.
    • DISABLE_ROUNDING

      static final boolean DISABLE_ROUNDING
      See Also:
    • KEEP_ROUNDING_SETTINGS

      static final boolean KEEP_ROUNDING_SETTINGS
      See Also:
    • syntaxStatus

      private boolean syntaxStatus
      Status of the expression syntax Please referet to the: - NO_SYNTAX_ERRORS - SYNTAX_ERROR - SYNTAX_STATUS_UNKNOWN
    • isFullyCompiled

      private boolean isFullyCompiled
    • errorMessage

      private String errorMessage
      Message after checking the syntax
    • errorMessageCalculate

      private String 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 recursionCallPending
      Log used internally to mark started recursion call on the current object, necessary to avoid infinite loops while recursive syntax checking (i.e. f to g and g to f) or marking modified flags on the expressions related to this expression.
      See Also:
    • recursionCallsCounter

      private int recursionCallsCounter
      Internal counter to avoid infinite loops while calculating expression defined in the way showed by below examples Argument x = new Argument("x = 2*y"); Argument y = new Argument("y = 2*x"); x.addDefinitions(y); y.addDefinitions(x); Function f = new Function("f(x) = 2*g(x)"); Function g = new Function("g(x) = 2*f(x)"); f.addDefinitions(g); g.addDefinitions(f);
    • parserKeyWordsOnly

      private boolean parserKeyWordsOnly
      Internal indicator for tokenization process if true, then keywords such as constants functions etc... will not be recognized during tokenization
    • unicodeKeyWordsEnabled

      private boolean unicodeKeyWordsEnabled
      Internal indicator informing hte parser that unicode know keywords are enabled and will be recognized by the parser as built-in functions or operators
    • attemptToFixExpStrEnabled

      private boolean attemptToFixExpStrEnabled
      Internal indicator informing the parser whether to try to fix the expression String. For example, situations such as: "++" change to "+", "+-" changed tro "-" "-+" changed tro "-" "--" changed tro "+"
    • UDFExpression

      boolean UDFExpression
      Indicator whether expression was automatically built for user defined functions purpose
      See Also:
    • UDFVariadicParamsAtRunTime

      List<Double> UDFVariadicParamsAtRunTime
      List of parameters provided by the user at run-time
      See Also:
    • internalClone

      private boolean internalClone
      Internal indicator for calculation process Expression.Calculate() method It shows whether to build again tokens list if clone - build again if not clone - build only at the beginning Indicator helps to solve the problem with above definitions Function f = new Function("f(x) = 2*g(x)"); Function g = new Function("g(x) = 2*f(x)"); f.addDefinitions(g); g.addDefinitions(f);
    • forwardErrorMessage

      private boolean forwardErrorMessage
      An indicator of whether an error message should be passed from the current expression to the expression that called it.
    • optionsChangesetNumber

      private int optionsChangesetNumber
      mXparser options changeset used in checkSyntax() method
    • PP

      private static final double PP
    • EE

      private static final double EE
    • GG

      private static final double GG
  • Constructor Details

    • Expression

      public Expression(PrimitiveElement... elements)
      Default constructor - empty expression
      Parameters:
      elements - Optional elements list (variadic - comma separated) of types: Argument, Constant, Function
      See Also:
    • Expression

      public Expression(String expressionString, PrimitiveElement... elements)
      Constructor - creates new expression from expression string.
      Parameters:
      expressionString - definition of the expression
      elements - 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 expression
      parserKeyWordsOnly - 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 string
      initialTokens - the tokens list (starting point - no tokenizing, no syntax checking)
      argumentsList - the arguments list
      functionsList - the functions list
      constantsList - 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 string
      argumentsList - the arguments list
      functionsList - the functions list
      constantsList - the constants list
      internal - the marker for internal processing
      See Also:
    • Expression

      private Expression(Expression expressionToClone, boolean isThreadSafeClone, CloneCache cloneCache)
  • Method Details

    • addRelatedExpression

      void addRelatedExpression(Expression expression)
      Adds related expression The same expression could be added more than once For example when
      Parameters:
      expression - the expression
    • removeRelatedExpression

      void removeRelatedExpression(Expression expression)
      Removes related expression
      Parameters:
      expression - the expression
    • showRelatedExpressions

      void showRelatedExpressions()
      Prints related expression list
    • getErrorMessage

      public String getErrorMessage()
      Method return error message after calling checkSyntax() method or calculate().
      Returns:
      Error message as string.
    • getSyntaxStatus

      public boolean getSyntaxStatus()
      Gets syntax status of the expression.
      Returns:
      true if there are no syntax errors, false when syntax error was found or syntax status is unknown
    • setSyntaxStatus

      void setSyntaxStatus(boolean syntaxStatus, String errorMessage)
      Package level method for passing information about errors identified on the constructors level
      Parameters:
      syntaxStatus - Syntax status
      errorMessage - 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

      public void setExpressionString(String expressionString)
      Sets (modifies expression) expression string.
      Parameters:
      expressionString - the expression string
    • getExpressionString

      public String getExpressionString()
      Returns expression string
      Returns:
      Expression string definition.
    • getCanonicalExpressionString

      public String getCanonicalExpressionString()
      Returns expression string
      Returns:
      Expression string definition.
    • clearExpressionString

      public void clearExpressionString()
      Clears expression string
    • setDescription

      public void setDescription(String description)
      Sets expression description.
      Parameters:
      description - the description string
    • getDescription

      public String getDescription()
      Gets expression description.
      Returns:
      String description.
    • clearDescription

      public void clearDescription()
      Clears expression description
    • setVerboseMode

      public void setVerboseMode()
      Enables verbose mode.
    • setSilentMode

      public void setSilentMode()
      Disables verbose mode (default silent mode).
    • getVerboseMode

      public boolean getVerboseMode()
      Returns verbose mode status.
      Returns:
      true if verbose mode is on, otherwise returns false.
    • enableImpliedMultiplicationMode

      public void enableImpliedMultiplicationMode()
      Sets implied multiplication
    • disableImpliedMultiplicationMode

      public void disableImpliedMultiplicationMode()
      Disables implied multiplication
    • checkIfImpliedMultiplicationMode

      public boolean checkIfImpliedMultiplicationMode()
      Gets implied multiplication status
      Returns:
      true if implied multiplication is enabled, otherwise returns false.
    • enableUnicodeBuiltinKeyWordsMode

      public void enableUnicodeBuiltinKeyWordsMode()
      Enables unicode built-in parser keywords, this flag informs the parser that built-in unicode keywords are supported and will be recognized as functions or operators.
    • disableUnicodeBuiltinKeyWordsMode

      public void disableUnicodeBuiltinKeyWordsMode()
      Disables unicode built-in parser keywords, this flag informs the parser that built-in unicode keywords are not supported and will not be recognized as functions or operators.
    • checkIfUnicodeBuiltinKeyWordsMode

      public boolean checkIfUnicodeBuiltinKeyWordsMode()
      Gets unicode built-in parser keywords mode
      Returns:
      true if unicode built-in parser keywords is enabled, otherwise returns false.
    • enableAttemptToFixExpStrMode

      public void enableAttemptToFixExpStrMode()
      Enables attempt to fix the expression String. For example, situations such as: "++" change to "+", "+-" changed to "-" "-+" changed to "-" "--" changed to "+"
    • disableAttemptToFixExpStrMode

      public void disableAttemptToFixExpStrMode()
      Disables attempt to fix the expression String. For example, situations such as: "++" change to "+", "+-" changed to "-" "-+" changed to "-" "--" changed ro "+"
    • checkIfAttemptToFixExpStrMode

      public boolean checkIfAttemptToFixExpStrMode()
      Gets attempt to fix expression string mode
      Returns:
      true attempt to fix expression string mode is enabled, otherwise returns false.
    • setRecursiveMode

      void setRecursiveMode()
      Sets recursive mode
    • disableRecursiveMode

      void disableRecursiveMode()
      Disables recursive mode
    • getRecursiveMode

      public boolean getRecursiveMode()
      Gets recursive mode status
      Returns:
      true if recursive mode is enabled, otherwise returns false.
    • setForwardErrorMessage

      void setForwardErrorMessage(boolean forward)
      An indicator of whether an error message should be passed from the current expression to the expression that called it.
      Parameters:
      forward - If true then message is being forwarded.
    • getComputingTime

      public double getComputingTime()
      Gets computing time.
      Returns:
      computing time in seconds.
    • addDefinitions

      public void addDefinitions(PrimitiveElement... elements)
      Adds user defined elements (such as: Arguments, Constants, Functions) to the expressions.
      Parameters:
      elements - Elements list (variadic), where Argument, Constant, Function extend the same class PrimitiveElement
      See Also:
    • removeDefinitions

      public void removeDefinitions(PrimitiveElement... elements)
      Removes user defined elements (such as: Arguments, Constants, Functions) to the expressions.
      Parameters:
      elements - Elements list (variadic), where Argument, Constant, Function extend the same class PrimitiveElement
      See Also:
    • addArguments

      public void addArguments(Argument... arguments)
      Adds arguments (variadic) to the expression definition.
      Parameters:
      arguments - the arguments list (comma separated list)
      See Also:
    • defineArguments

      public void defineArguments(String... argumentsNames)
      Enables to define the arguments (associated with the expression) based on the given arguments names.
      Parameters:
      argumentsNames - the arguments names (variadic) comma separated list
      See Also:
    • defineArgument

      public void defineArgument(String argumentName, double argumentValue)
      Enables to define the argument (associated with the expression) based on the argument name and the argument value.
      Parameters:
      argumentName - the argument name
      argumentValue - the argument value
      See Also:
    • getArgumentIndex

      public int getArgumentIndex(String argumentName)
      Gets argument index from the expression.
      Parameters:
      argumentName - the argument name
      Returns:
      The argument index if the argument name was found, otherwise returns Argument.NOT_FOUND
      See Also:
    • getArgument

      public Argument getArgument(String argumentName)
      Gets argument from the expression.
      Parameters:
      argumentName - the argument name
      Returns:
      The argument if the argument name was found, otherwise returns null.
      See Also:
    • getArgument

      public Argument getArgument(int argumentIndex)
      Gets argument from the expression.
      Parameters:
      argumentIndex - the argument index
      Returns:
      Argument if the argument index is between 0 and the last available argument index (getArgumentsNumber()-1), otherwise returns null.
      See Also:
    • getArgumentsNumber

      public int getArgumentsNumber()
      Gets number of arguments associated with the expression.
      Returns:
      The number of arguments (int >= 0)
      See Also:
    • setArgumentValue

      public void setArgumentValue(String argumentName, double argumentValue)
      Sets argument value.
      Parameters:
      argumentName - the argument name
      argumentValue - the argument value
    • getArgumentValue

      public double getArgumentValue(String argumentName)
      Gets argument vale.
      Parameters:
      argumentName - the argument name
      Returns:
      Argument value if argument name was found, otherwise return Double.NaN.
    • removeArguments

      public void removeArguments(String... argumentsNames)
      Removes first occurrences of the arguments associated with the expression.
      Parameters:
      argumentsNames - the arguments names (variadic parameters) comma separated list
      See Also:
    • removeArguments

      public void removeArguments(Argument... arguments)
      Removes first occurrences of the arguments associated with the expression.
      Parameters:
      arguments - the arguments (variadic parameters) comma separated list
      See Also:
    • removeAllArguments

      public void removeAllArguments()
      Removes all arguments associated with the expression.
      See Also:
    • addConstants

      public void addConstants(Constant... constants)
      Adds constants (variadic parameters) to the expression definition.
      Parameters:
      constants - the constants (comma separated list)
      See Also:
    • addConstants

      public void addConstants(List<Constant> constantsList)
      Adds constants to the expression definition.
      Parameters:
      constantsList - the list of constants
      See Also:
    • defineConstant

      public void defineConstant(String constantName, double constantValue)
      Enables to define the constant (associated with the expression) based on the constant name and constant value.
      Parameters:
      constantName - the constant name
      constantValue - the constant value
      See Also:
    • getConstantIndex

      public int getConstantIndex(String constantName)
      Gets constant index associated with the expression.
      Parameters:
      constantName - the constant name
      Returns:
      Constant index if constant name was found, otherwise return Constant.NOT_FOUND.
      See Also:
    • getConstant

      public Constant getConstant(String constantName)
      Gets constant associated with the expression.
      Parameters:
      constantName - the constant name
      Returns:
      Constant if constant name was found, otherwise return null.
      See Also:
    • getConstant

      public Constant getConstant(int constantIndex)
      Gets constant associated with the expression.
      Parameters:
      constantIndex - the constant index
      Returns:
      Constant if the constantIndex is between 0 and the last available constant index (getConstantsNumber() - 1), otherwise it returns null.
      See Also:
    • getConstantsNumber

      public int getConstantsNumber()
      Gets number of constants associated with the expression.
      Returns:
      number of constants (int >= 0)
      See Also:
    • removeConstants

      public void removeConstants(String... constantsNames)
      Removes first occurrences of the constants associated with the expression.
      Parameters:
      constantsNames - the constants names (variadic parameters) comma separated list
      See Also:
    • removeConstants

      public void removeConstants(Constant... constants)
      Removes first occurrences of the constants associated with the expression
      Parameters:
      constants - the constants (variadic parameters) comma separated list
      See Also:
    • removeAllConstants

      public void removeAllConstants()
      Removes all constants associated with the expression
      See Also:
    • addFunctions

      public void addFunctions(Function... functions)
      Adds functions (variadic parameters) to the expression definition.
      Parameters:
      functions - the functions (variadic parameters) comma separated list
      See Also:
    • 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 name
      functionExpressionString - the expression string
      argumentsNames - the function arguments names (variadic parameters) comma separated list
      See Also:
    • getFunctionIndex

      public int getFunctionIndex(String functionName)
      Gets index of function associated with the expression.
      Parameters:
      functionName - the function name
      Returns:
      Function index if function name was found, otherwise returns Function.NOT_FOUND
      See Also:
    • getFunction

      public Function getFunction(String functionName)
      Gets function associated with the expression.
      Parameters:
      functionName - the function name
      Returns:
      Function if function name was found, otherwise returns null.
      See Also:
    • getFunction

      public Function getFunction(int functionIndex)
      Gets function associated with the expression.
      Parameters:
      functionIndex - the function index
      Returns:
      Function if function index is between 0 and the last available function index (getFunctionsNumber()-1), otherwise returns null.
      See Also:
    • getFunctionsNumber

      public int getFunctionsNumber()
      Gets number of functions associated with the expression.
      Returns:
      number of functions (int >= 0)
      See Also:
    • removeFunctions

      public void removeFunctions(String... functionsNames)
      Removes first occurrences of the functions associated with the expression.
      Parameters:
      functionsNames - the functions names (variadic parameters) comma separated list
      See Also:
    • removeFunctions

      public void removeFunctions(Function... functions)
      Removes first occurrences of the functions associated with the expression.
      Parameters:
      functions - the functions (variadic parameters) comma separated list.
      See Also:
    • 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 number
      number - the number
      ulpRound - If true, then if mXparser.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 number
      result - the number
      ulpRound - If true, then if mXparser.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 number
      result - the number
      ulpRound - If true, then if mXparser.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 number
      result - the number
      ulpRound - If true, then if mXparser.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 number
      result - the number
      ulpRound - If true, then if mXparser.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 number
      result - the number
      ulpRound - If true, then if mXparser.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 number
      value - the number
      length - the special function range
      ulpRound - If true, then if mXparser.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 position
      ifCondition - the result of if condition
      ulpRound - If true, then if mXparser.ulpRounding = true intelligent ULP rounding is applied.
    • removeTokens

      private void removeTokens(int from, int to)
    • ifSetRemove

      private void ifSetRemove(int pos, double ifCondition)
    • createInitialTokens

      private static List<Token> createInitialTokens(int startPos, int endPos, List<Token> tokensList)
      Creates string tokens list from the subexpression.
      Parameters:
      startPos - start position (index)
      endPos - end position (index)
      Returns:
      tokens list representing requested subexpression.
    • getParametersNumber

      private int getParametersNumber(int pos)
      Return number of functions parameters.
      Parameters:
      pos - the function position
    • getParamArgument

      private ArgumentParameter getParamArgument(String argumentName)
      Gets / returns argument representing given argument name. If argument name exists on the list of known arguments the initial status of the found argument is remembered, otherwise new argument will be created.
      Parameters:
      argumentName - the argument name
      Returns:
      Argument parameter representing given argument name:
      See Also:
    • clearParamArgument

      private void clearParamArgument(ArgumentParameter argParam)
      Clears argument parameter.
      Parameters:
      argParam - the argument parameter.
    • FREE_ARGUMENT

      private void FREE_ARGUMENT(int pos)
      Free Arguments handling.
      Parameters:
      pos - the token position
    • DEPENDENT_ARGUMENT

      private void DEPENDENT_ARGUMENT(int pos, CalcStepsRegister calcStepsRegister)
      Dependent Arguments handling.
      Parameters:
      pos - the token position
    • USER_FUNCTION

      private void USER_FUNCTION(int pos, CalcStepsRegister calcStepsRegister)
      User functions handling.
      Parameters:
      pos - the token position
    • USER_CONSTANT

      private void USER_CONSTANT(int pos)
      User constants handling.
      Parameters:
      pos - the token position
    • RECURSIVE_ARGUMENT

      private void RECURSIVE_ARGUMENT(int pos)
      Recursive arguments handling.
      Parameters:
      pos - the token position
    • CONSTANT

      private void CONSTANT(int pos)
      Constants handling.
      Parameters:
      pos - the token position
    • UNIT

      private void UNIT(int pos)
      Constants handling.
      Parameters:
      pos - the token position
    • RANDOM_VARIABLE

      private void RANDOM_VARIABLE(int pos)
      Random Variables handling.
      Parameters:
      pos - the token position
    • getTokenValue

      private double getTokenValue(int tokenIndex)
      Gets token value
      Parameters:
      tokenIndex - the token index
      Returns:
      the token value
    • TETRATION

      private void TETRATION(int pos)
      Tetration handling.
      Parameters:
      pos - the token position
    • POWER

      private void POWER(int pos)
      Power handling.
      Parameters:
      pos - the token position
    • MODULO

      private void MODULO(int pos)
      Modulo handling.
      Parameters:
      pos - the token position
    • DIVIDE

      private void DIVIDE(int pos)
      Division handling.
      Parameters:
      pos - the token position
    • DIVIDE_QUOTIENT

      private void DIVIDE_QUOTIENT(int pos)
      Integer division handling.
      Parameters:
      pos - the token position
    • MULTIPLY

      private void MULTIPLY(int pos)
      Multiplication handling.
      Parameters:
      pos - the token position
    • PLUS

      private void PLUS(int pos)
      Addition handling.
      Parameters:
      pos - the token position
    • MINUS

      private void MINUS(int pos)
      Subtraction handling
      Parameters:
      pos - the token position
    • AND

      private void AND(int pos)
      Logical AND
      Parameters:
      pos - the token position
    • OR

      private void OR(int pos)
      Logical OR
      Parameters:
      pos - the token position
    • NAND

      private void NAND(int pos)
      Logical NAND
      Parameters:
      pos - the token position
    • NOR

      private void NOR(int pos)
      Logical NOR
      Parameters:
      pos - the token position
    • XOR

      private void XOR(int pos)
      Logical XOR
      Parameters:
      pos - the token position
    • IMP

      private void IMP(int pos)
      Logical IMP
      Parameters:
      pos - the token position
    • CIMP

      private void CIMP(int pos)
      Logical CIMP
      Parameters:
      pos - the token position
    • NIMP

      private void NIMP(int pos)
      Logical NIMP
      Parameters:
      pos - the token position
    • CNIMP

      private void CNIMP(int pos)
      Logical CNIMP
      Parameters:
      pos - the token position
    • EQV

      private void EQV(int pos)
      Logical EQV
      Parameters:
      pos - the token position
    • NEG

      private void NEG(int pos)
      Logical negation
      Parameters:
      pos - the token position
    • EQ

      private void EQ(int pos)
      Equality relation.
      Parameters:
      pos - the token position
    • NEQ

      private void NEQ(int pos)
      Not equals.
      Parameters:
      pos - the token position
    • LT

      private void LT(int pos)
      Lower than.
      Parameters:
      pos - the token position
    • GT

      private void GT(int pos)
      Greater than.
      Parameters:
      pos - the token position
    • LEQ

      private void LEQ(int pos)
      Lower or equal.
      Parameters:
      pos - the token position
    • GEQ

      private void GEQ(int pos)
      Greater or equal
      Parameters:
      pos - the token position
    • SQUARE_ROOT_OPERATOR

      private void SQUARE_ROOT_OPERATOR(int pos)
      Square root as unary left operator
      Parameters:
      pos - the token position
    • CUBE_ROOT_OPERATOR

      private void CUBE_ROOT_OPERATOR(int pos)
      Cube root as unary left operator
      Parameters:
      pos - the token position
    • FOURTH_ROOT_OPERATOR

      private void FOURTH_ROOT_OPERATOR(int pos)
      Fourth root as unary left operator
      Parameters:
      pos - the token position
    • BITWISE_COMPL

      private void BITWISE_COMPL(int pos)
      Bitwise COMPL
      Parameters:
      pos - the token position
    • BITWISE_AND

      private void BITWISE_AND(int pos)
      Bitwise AND
      Parameters:
      pos - the token position
    • BITWISE_OR

      private void BITWISE_OR(int pos)
      Bitwise OR
      Parameters:
      pos - the token position
    • BITWISE_XOR

      private void BITWISE_XOR(int pos)
      Bitwise XOR
      Parameters:
      pos - the token position
    • BITWISE_NAND

      private void BITWISE_NAND(int pos)
      Bitwise NAND
      Parameters:
      pos - the token position
    • BITWISE_NOR

      private void BITWISE_NOR(int pos)
      Bitwise NOR
      Parameters:
      pos - the token position
    • BITWISE_XNOR

      private void BITWISE_XNOR(int pos)
      Bitwise NOR
      Parameters:
      pos - the token position
    • BITWISE_LEFT_SHIFT

      private void BITWISE_LEFT_SHIFT(int pos)
      Bitwise LEFT SHIFT
      Parameters:
      pos - the token position
    • BITWISE_RIGHT_SHIFT

      private void BITWISE_RIGHT_SHIFT(int pos)
      Bitwise RIGHT SHIFT
      Parameters:
      pos - the token position
    • SIN

      private void SIN(int pos)
      Sine function
      Parameters:
      pos - the token position
    • COS

      private void COS(int pos)
      Cosine / Trigonometric functions Sets tokens to number token
      Parameters:
      pos - the token position
    • TAN

      private void TAN(int pos)
      Tangent / Trigonometric functions Sets tokens to number token
      Parameters:
      pos - the token position
    • CTAN

      private void CTAN(int pos)
      Cotangent / Trigonometric functions Sets tokens to number token
      Parameters:
      pos - the token position
    • SEC

      private void SEC(int pos)
      Secant / Trigonometric functions Sets tokens to number token
      Parameters:
      pos - the token position
    • COSEC

      private void COSEC(int pos)
      Cosecant / Trigonometric functions Sets tokens to number token
      Parameters:
      pos - the token position
    • ASIN

      private void ASIN(int pos)
      Arcus sine / Inverse trigonometric functions Sets tokens to number token
      Parameters:
      pos - the token position
    • ACOS

      private void ACOS(int pos)
      Arcus cosine / Inverse trigonometric functions Sets tokens to number token
      Parameters:
      pos - the token position
    • ATAN

      private void ATAN(int pos)
      Arcus tangent / Inverse trigonometric functions Sets tokens to number token
      Parameters:
      pos - the token position
    • ACTAN

      private void ACTAN(int pos)
      Arcus cotangent / Inverse trigonometric functions Sets tokens to number token
      Parameters:
      pos - the token position
    • LN

      private void LN(int pos)
      Natural logarithm (base e) Sets tokens to number token
      Parameters:
      pos - the token position
    • LOG2

      private void LOG2(int pos)
      Logarithm - base 2 Sets tokens to number token
      Parameters:
      pos - the token position
    • LOG10

      private void LOG10(int pos)
      Logarithm - base 10 Sets tokens to number token
      Parameters:
      pos - the token position
    • RAD

      private void RAD(int pos)
      Converts degrees to radius Sets tokens to number token
      Parameters:
      pos - the token position
    • EXP

      private void EXP(int pos)
      Exponential function Sets tokens to number token
      Parameters:
      pos - the token position
    • SQRT

      private void SQRT(int pos)
      Square root Sets tokens to number token
      Parameters:
      pos - the token position
    • SINH

      private void SINH(int pos)
      Hyperbolic sine Sets tokens to number token
      Parameters:
      pos - the token position
    • COSH

      private void COSH(int pos)
      Hyperbolic cosine Sets tokens to number token
      Parameters:
      pos - the token position
    • TANH

      private void TANH(int pos)
      Hyperbolic tangent Sets tokens to number token
      Parameters:
      pos - the token position
    • COTH

      private void COTH(int pos)
      Hyperbolic cotangent Sets tokens to number token
      Parameters:
      pos - the token position
    • SECH

      private void SECH(int pos)
      Hyperbolic secant Sets tokens to number token
      Parameters:
      pos - the token position
    • CSCH

      private void CSCH(int pos)
      Hyperbolic cosecant Sets tokens to number token
      Parameters:
      pos - the token position
    • DEG

      private void DEG(int pos)
      Converts radians to degrees Sets tokens to number token
      Parameters:
      pos - the token position
    • ABS

      private void ABS(int pos)
      Absolut value Sets tokens to number token
      Parameters:
      pos - the token position
    • SGN

      private void SGN(int pos)
      Signum function Sets tokens to number token
      Parameters:
      pos - the token position
    • FLOOR

      private void FLOOR(int pos)
      Floor function Sets tokens to number token
      Parameters:
      pos - the token position
    • CEIL

      private void CEIL(int pos)
      Ceil function Sets tokens to number token
      Parameters:
      pos - the token position
    • ARSINH

      private void ARSINH(int pos)
      Arcus hyperbolic sine Sets tokens to number token
      Parameters:
      pos - the token position
    • ARCOSH

      private void ARCOSH(int pos)
      Arcus hyperbolic cosine Sets tokens to number token
      Parameters:
      pos - the token position
    • ARTANH

      private void ARTANH(int pos)
      Arcus hyperbolic tangent Sets tokens to number token
      Parameters:
      pos - the token position
    • ARCOTH

      private void ARCOTH(int pos)
      Arcus hyperbolic cotangent Sets tokens to number token
      Parameters:
      pos - the token position
    • ARSECH

      private void ARSECH(int pos)
      Arcus hyperbolic secant Sets tokens to number token
      Parameters:
      pos - the token position
    • ARCSCH

      private void ARCSCH(int pos)
      Arcus hyperbolic cosecant Sets tokens to number token
      Parameters:
      pos - the token position
    • SA

      private void SA(int pos)
      SA / sinc normalized
      Parameters:
      pos - the token position
    • SINC

      private void SINC(int pos)
      Sinc unnormalized
      Parameters:
      pos - the token position
    • BELL_NUMBER

      private void BELL_NUMBER(int pos)
      Bell numbers
      Parameters:
      pos - the token position
    • LUCAS_NUMBER

      private void LUCAS_NUMBER(int pos)
      Lucas numbers
      Parameters:
      pos - the token position
    • FIBONACCI_NUMBER

      private void FIBONACCI_NUMBER(int pos)
      Fibonacci numbers
      Parameters:
      pos - the token position
    • HARMONIC_NUMBER

      private void HARMONIC_NUMBER(int pos)
      Harmonic numbers
      Parameters:
      pos - the token position
    • IS_PRIME

      private void IS_PRIME(int pos)
      Prime test
      Parameters:
      pos - the token position
    • PRIME_COUNT

      private void PRIME_COUNT(int pos)
      Prime counting
      Parameters:
      pos - the token position
    • EXP_INT

      private void EXP_INT(int pos)
      Exponential integral function
      Parameters:
      pos - the token position
    • LOG_INT

      private void LOG_INT(int pos)
      Logarithmic exponential integral function
      Parameters:
      pos - the token position
    • OFF_LOG_INT

      private void OFF_LOG_INT(int pos)
      Offset logarithmic exponential integral function
      Parameters:
      pos - the token position
    • FACT

      private void FACT(int pos)
      Factorilal function Sets tokens to number token
      Parameters:
      pos - the token position
    • PERC

      private void PERC(int pos)
      Percentage Sets tokens to number token
      Parameters:
      pos - the token position
    • NOT

      private void NOT(int pos)
      Negation Sets tokens to number token
      Parameters:
      pos - the token position
    • GAUSS_ERF

      private void GAUSS_ERF(int pos)
      Gauss error function
      Parameters:
      pos - the token position
    • GAUSS_ERFC

      private void GAUSS_ERFC(int pos)
      Gauss complementary error function
      Parameters:
      pos - the token position
    • GAUSS_ERF_INV

      private void GAUSS_ERF_INV(int pos)
      Inverse of Gauss error function
      Parameters:
      pos - the token position
    • GAUSS_ERFC_INV

      private void GAUSS_ERFC_INV(int pos)
      Inverse of Gauss complementary error function
      Parameters:
      pos - the token position
    • ULP

      private void ULP(int pos)
      Unit in The Last Place Sets tokens to number token
      Parameters:
      pos - the token position
    • ISNAN

      private void ISNAN(int pos)
      Is Not-a-Number Sets tokens to number token
      Parameters:
      pos - the token position
    • NDIG10

      private void NDIG10(int pos)
      Number of digits in base 10 Sets tokens to number token
      Parameters:
      pos - the token position
    • NFACT

      private void NFACT(int pos)
      Number of prime factors - distinct Sets tokens to number token
      Parameters:
      pos - the token position
    • ARCSEC

      private void ARCSEC(int pos)
      Arcuus secant Sets tokens to number token
      Parameters:
      pos - the token position
    • ARCCSC

      private void ARCCSC(int pos)
      Arcuus cosecant Sets tokens to number token
      Parameters:
      pos - the token position
    • GAMMA

      private void GAMMA(int pos)
      Gamma special function Sets tokens to number token
      Parameters:
      pos - the token position
    • LAMBERT_W0

      private void LAMBERT_W0(int pos)
      Lambert-W special function, principal branch 0 Sets tokens to number token
      Parameters:
      pos - the token position
    • LAMBERT_W1

      private void LAMBERT_W1(int pos)
      Lambert-W special function, branch = -1 Sets tokens to number token
      Parameters:
      pos - the token position
    • SGN_GAMMA

      private void SGN_GAMMA(int pos)
      Signum of Gamma special function Sets tokens to number token
      Parameters:
      pos - the token position
    • LOG_GAMMA

      private void LOG_GAMMA(int pos)
      Log Gamma special function Sets tokens to number token
      Parameters:
      pos - the token position
    • DI_GAMMA

      private void DI_GAMMA(int pos)
      Digamma special function Sets tokens to number token
      Parameters:
      pos - the token position
    • UDF_PARAM

      private void UDF_PARAM(int pos)
      User Defined Variadic function param value Sets tokens to number token
      Parameters:
      pos - the token position
    • RND_STUDENT_T

      private void RND_STUDENT_T(int pos)
    • RND_CHI2

      private void RND_CHI2(int pos)
    • LOG

      private void LOG(int pos)
      Logarithm Sets tokens to number token
      Parameters:
      pos - the token position
    • getNumbers

      private List<Double> getNumbers(int pos)
      Creates ArraList containing function parameters
      Parameters:
      pos - the function position
      Returns:
      List of function parameters.
    • MOD

      private void MOD(int pos)
      Modulo Sets tokens to number token
      Parameters:
      pos - the token position
    • BINOM_COEFF

      private void BINOM_COEFF(int pos)
      Binomial Coefficient
      Parameters:
      pos - the token position
    • PERMUTATIONS

      private void PERMUTATIONS(int pos)
      Number of permutations
      Parameters:
      pos - the token position
    • BETA

      private void BETA(int pos)
      Beta special function
      Parameters:
      pos - the token position
    • LOG_BETA

      private void LOG_BETA(int pos)
      Log beta special function
      Parameters:
      pos - the token position
    • PDF_STUDENT_T

      private void PDF_STUDENT_T(int pos)
    • CDF_STUDENT_T

      private void CDF_STUDENT_T(int pos)
    • QNT_STUDENT_T

      private void QNT_STUDENT_T(int pos)
    • PDF_CHI2

      private void PDF_CHI2(int pos)
    • CDF_CHI2

      private void CDF_CHI2(int pos)
    • QNT_CHI2

      private void QNT_CHI2(int pos)
    • BERNOULLI_NUMBER

      private void BERNOULLI_NUMBER(int pos)
      Bernoulli Number
      Parameters:
      pos - the token position
    • STIRLING1_NUMBER

      private void STIRLING1_NUMBER(int pos)
      Stirling number of the first kind
      Parameters:
      pos - the token position
    • STIRLING2_NUMBER

      private void STIRLING2_NUMBER(int pos)
      Stirling number of the second kind.
      Parameters:
      pos - the token position
    • WORPITZKY_NUMBER

      private void WORPITZKY_NUMBER(int pos)
      Worpitzky number.
      Parameters:
      pos - the token position
    • EULER_NUMBER

      private void EULER_NUMBER(int pos)
      Euler number
      Parameters:
      pos - the token position
    • KRONECKER_DELTA

      private void KRONECKER_DELTA(int pos)
      Kronecker delta
      Parameters:
      pos - the token position
    • EULER_POLYNOMIAL

      private void EULER_POLYNOMIAL(int pos)
      Euler polynomial
      Parameters:
      pos - the token position
    • HARMONIC2_NUMBER

      private void HARMONIC2_NUMBER(int pos)
      Harmonic numbers
      Parameters:
      pos - the token position
    • ROUND

      private void ROUND(int pos)
      Decimal rounding
      Parameters:
      pos - the token position
    • RND_VAR_UNIFORM_CONT

      private void RND_VAR_UNIFORM_CONT(int pos)
      Random number - Uniform Continuous distribution
      Parameters:
      pos - the token position
    • RND_VAR_UNIFORM_DISCR

      private void RND_VAR_UNIFORM_DISCR(int pos)
      Random number - Uniform Discrete distribution
      Parameters:
      pos - the token position
    • RND_NORMAL

      private void RND_NORMAL(int pos)
      Random number - Normal distribution
      Parameters:
      pos - the token position
    • RND_F_SNEDECOR

      private void RND_F_SNEDECOR(int pos)
      Random number - Snedecor's F distribution (F-distribution or F-ratio, also known as Fisher–Snedecor distribution)
      Parameters:
      pos - the token position
    • NDIG

      private void NDIG(int pos)
      Number of digits in given numeral system
      Parameters:
      pos - the token position
    • DIGIT10

      private void DIGIT10(int pos)
      Digit at position - base 10 numeral system
      Parameters:
      pos - the token position
    • FACTVAL

      private void FACTVAL(int pos)
      Prime factor value
      Parameters:
      pos - the token position
    • FACTEXP

      private void FACTEXP(int pos)
      Prime factor value exponent
      Parameters:
      pos - the token position
    • ROOT

      private void ROOT(int pos)
      Nth order root
      Parameters:
      pos - the token position
    • INC_GAMMA_LOWER

      private void INC_GAMMA_LOWER(int pos)
      Lower incomplete special Gamma function
      Parameters:
      pos - the token position
    • INC_GAMMA_UPPER

      private void INC_GAMMA_UPPER(int pos)
      Upper incomplete special Gamma function
      Parameters:
      pos - the token position
    • REG_GAMMA_LOWER

      private void REG_GAMMA_LOWER(int pos)
      Lower regularized special Gamma function
      Parameters:
      pos - the token position
    • REG_GAMMA_UPPER

      private void REG_GAMMA_UPPER(int pos)
      Lower regularized special Gamma function
      Parameters:
      pos - the token position
    • IF_CONDITION

      private void IF_CONDITION(int pos)
      IF function
      Parameters:
      pos - the token position
    • IFF

      private void IFF(int pos)
      IFF function
      Parameters:
      pos - the token position
    • IF

      private void IF(int pos)
      IF Sets tokens to number token
      Parameters:
      pos - token index (position)
    • CHI

      private void CHI(int pos)
      Characteristic function (a,b)
      Parameters:
      pos - the token position
    • CHI_LR

      private void CHI_LR(int pos)
      Characteristic function [a,b]
      Parameters:
      pos - the token position
    • CHI_L

      private void CHI_L(int pos)
      Characteristic function [a,b)
      Parameters:
      pos - the token position
    • CHI_R

      private void CHI_R(int pos)
      Characteristic function (a,b]
      Parameters:
      pos - the token position
    • PDF_UNIFORM_CONT

      private void PDF_UNIFORM_CONT(int pos)
      Probability Distribution Function - Uniform Continuous distribution
      Parameters:
      pos - the token position
    • CDF_UNIFORM_CONT

      private void CDF_UNIFORM_CONT(int pos)
      Cumulative Distribution Function - Uniform Continuous distribution
      Parameters:
      pos - the token position
    • QNT_UNIFORM_CONT

      private void QNT_UNIFORM_CONT(int pos)
      Quantile Function - Uniform Continuous distribution
      Parameters:
      pos - the token position
    • PDF_NORMAL

      private void PDF_NORMAL(int pos)
      Probability Distribution Function - Normal distribution
      Parameters:
      pos - the token position
    • CDF_NORMAL

      private void CDF_NORMAL(int pos)
      Cumulative Distribution Function - Normal distribution
      Parameters:
      pos - the token position
    • QNT_NORMAL

      private void QNT_NORMAL(int pos)
      Quantile Function - Normal distribution
      Parameters:
      pos - the token position
    • PDF_F_SNEDECOR

      private void PDF_F_SNEDECOR(int pos)
      Probability Distribution Function - Snedecor's F distribution
      Parameters:
      pos - the token position
    • CDF_F_SNEDECOR

      private void CDF_F_SNEDECOR(int pos)
      Cumulative Distribution Function - Snedecor's F distribution
      Parameters:
      pos - the token position
    • QNT_F_SNEDECOR

      private void QNT_F_SNEDECOR(int pos)
      Quantile Function - Snedecor's F distribution
      Parameters:
      pos - the token position
    • DIGIT

      private void DIGIT(int pos)
      Digit at position - numeral system with given base
      Parameters:
      pos - the token position
    • INC_BETA

      private void INC_BETA(int pos)
      Incomplete beta special function
      Parameters:
      pos - the token position
    • REG_BETA

      private void REG_BETA(int pos)
      Regularized incomplete beta special function
      Parameters:
      pos - the token position
    • updateMissingTokens

      private static void updateMissingTokens(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 list
      keyWord - missing keyword
      tokenId - missing token id
      tokenTypeId - 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 operator
      iterParams - 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 operator
      iterParams - 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 position
      derivativeType - the type of derivative (LEFT, RIGHT, ...)
    • DERIVATIVE_NTH

      private void DERIVATIVE_NTH(int pos, int derivativeType)
      Function derivative
      Parameters:
      pos - the token position
      derivativeType - the type of derivative (left, right, etc...)
    • INTEGRAL

      private void INTEGRAL(int pos)
      Function integral
      Parameters:
      pos - the token position
    • SOLVE

      private void SOLVE(int pos)
      Function SOLVE
      Parameters:
      pos - the token position
    • FORWARD_DIFFERENCE

      private void FORWARD_DIFFERENCE(int pos)
      Forward difference operator
      Parameters:
      pos - the token position
    • BACKWARD_DIFFERENCE

      private void BACKWARD_DIFFERENCE(int pos)
      Backward diffrence operator
      Parameters:
      pos - the token position
    • MIN_VARIADIC

      private void MIN_VARIADIC(int pos)
      Minimum variadic Sets tokens to number token
      Parameters:
      pos - the token position
    • MAX_VARIADIC

      private void MAX_VARIADIC(int pos)
      Maximum variadic Sets tokens to number token
      Parameters:
      pos - token index (position)
    • SUM_VARIADIC

      private void SUM_VARIADIC(int pos)
      Sum variadic Sets tokens to number token
      Parameters:
      pos - token index (position)
    • PROD_VARIADIC

      private void PROD_VARIADIC(int pos)
      Sum variadic Sets tokens to number token
      Parameters:
      pos - token index (position)
    • AVG_VARIADIC

      private void AVG_VARIADIC(int pos)
      Average variadic Sets tokens to number token
      Parameters:
      pos - token index (position)
    • VAR_VARIADIC

      private void VAR_VARIADIC(int pos)
      Variance variadic Sets tokens to number token
      Parameters:
      pos - token index (position)
    • STD_VARIADIC

      private void STD_VARIADIC(int pos)
      Standard deviation variadic Sets tokens to number token
      Parameters:
      pos - token index (position)
    • CONTINUED_FRACTION

      private void CONTINUED_FRACTION(int pos)
      Continued fraction
      Parameters:
      pos - the token position
    • CONTINUED_POLYNOMIAL

      private void CONTINUED_POLYNOMIAL(int pos)
      Continued polynomial
      Parameters:
      pos - the token position
    • GCD

      private void GCD(int pos)
      Greates Common Divisor
      Parameters:
      pos - the token position
    • LCM

      private void LCM(int pos)
      Lowest Common Multiply
      Parameters:
      pos - the token position
    • RND_LIST

      private void RND_LIST(int pos)
      Random number from list
      Parameters:
      pos - the token position
    • COALESCE

      private void COALESCE(int pos)
      Coalesce
      Parameters:
      pos - the token position
    • OR_VARIADIC

      private void OR_VARIADIC(int pos)
      OR_VARIADIC
      Parameters:
      pos - the token position
    • AND_VARIADIC

      private void AND_VARIADIC(int pos)
      AND_VARIADIC
      Parameters:
      pos - the token position
    • XOR_VARIADIC

      private void XOR_VARIADIC(int pos)
      XOR_VARIADIC
      Parameters:
      pos - the token position
    • ARGMIN_VARIADIC

      private void ARGMIN_VARIADIC(int pos)
      ARGMIN_VARIADIC
      Parameters:
      pos - the token position
    • ARGMAX_VARIADIC

      private void ARGMAX_VARIADIC(int pos)
      ARGMAX_VARIADIC
      Parameters:
      pos - the token position
    • MEDIAN_VARIADIC

      private void MEDIAN_VARIADIC(int pos)
      MEDIAN_VARIADIC
      Parameters:
      pos - the token position
    • MODE_VARIADIC

      private void MODE_VARIADIC(int pos)
      MODE_VARIADIC
      Parameters:
      pos - the token position
    • BASE_VARIADIC

      private void BASE_VARIADIC(int pos)
      BASE_VARIADIC
      Parameters:
      pos - the token position
    • NDIST_VARIADIC

      private void NDIST_VARIADIC(int pos)
      NDIST_VARIADIC
      Parameters:
      pos - the token position
    • COMMA

      private void COMMA(int pos)
      Parser symbols Removes comma
      Parameters:
      pos - token index (position)
    • PARENTHESES

      private void PARENTHESES(int lPos, int rPos)
      Parser symbols Removes parenthesis
      Parameters:
      lPos - left token index (position)
      rPos - roght token index (position)
    • checkLexSyntax

      public boolean checkLexSyntax()
      Checks syntax of the expression string.
      Returns:
      true if syntax is ok
    • cleanExpressionString

      private void cleanExpressionString()
      Cleans blanks and other cases like "++', "+-", "-+"", "--"
    • checkSyntax

      public boolean checkSyntax()
      Checks syntax of the expression string.
      Returns:
      true if syntax is ok
    • checkCalculusParameter

      private int checkCalculusParameter(String param)
      Checks syntax of the calculus parameter
      Returns:
      true if syntax is ok
    • checkIfKnownArgument

      private static boolean checkIfKnownArgument(FunctionParameter param)
      Checks if argument given in the function parameter is known in the expression.
      Parameters:
      param - the function parameter
      Returns:
      true if argument is known, otherwise returns false.
    • checkIfUnknownToken

      private static boolean checkIfUnknownToken(FunctionParameter param)
      Checks if token is uknown
      Parameters:
      param - the function parameter
      Returns:
      true if there is only 1 token with unknown type, otherwise returns false.
    • syntaxIsAlreadyCheckedNorErrors

      private boolean syntaxIsAlreadyCheckedNorErrors()
    • registerFinalSyntaxAlreadyCheckedNorErrors

      private void registerFinalSyntaxAlreadyCheckedNorErrors(String recursionInfoLevel)
    • registerFinalSyntaxFunctionWithBodyExtNoErrors

      private void registerFinalSyntaxFunctionWithBodyExtNoErrors(String recursionInfoLevel)
    • registerFinalSyntaxExpressionStringIsEmpty

      private void registerFinalSyntaxExpressionStringIsEmpty(String recursionInfoLevel)
    • registerSyntaxLexicalError

      private void registerSyntaxLexicalError(String recursionInfoLevel, Throwable e)
    • registerFinalSyntax

      private void registerFinalSyntax(String recursionInfoLevel, boolean syntax)
    • registerPartialSyntaxStartingSyntaxCheck

      private void registerPartialSyntaxStartingSyntaxCheck(String recursionInfoLevel)
    • checkPartialSyntaxImpliedMultiplication

      private boolean checkPartialSyntaxImpliedMultiplication(String recursionInfoLevel)
    • checkPartialSyntaxDuplicatedKeywords

      private boolean checkPartialSyntaxDuplicatedKeywords(String recursionInfoLevel)
    • checkPartialSyntaxUserDefinedArgument

      private boolean checkPartialSyntaxUserDefinedArgument(String recursionInfoLevel, int tokenIndex, Token token, String tokenInfoMessage)
    • checkPartialSyntaxUserDefinedRecursiveArgument

      private boolean checkPartialSyntaxUserDefinedRecursiveArgument(String recursionInfoLevel, int tokenIndex, Token token, String tokenInfoMessage)
    • checkPartialSyntaxInvalidToken

      private boolean checkPartialSyntaxInvalidToken(String recursionInfoLevel, Token token, String tokenInfoMessage, Stack<SyntaxStackElement> syntaxStack)
    • checkPartialSyntaxUserDefinedFunction

      private boolean checkPartialSyntaxUserDefinedFunction(String recursionInfoLevel, int tokenIndex, Token token, String tokenInfoMessage)
    • checkPartialSyntaxBuiltinConstant

      private boolean checkPartialSyntaxBuiltinConstant(String recursionInfoLevel, int tokenIndex, Token token, String tokenInfoMessage)
    • checkPartialSyntaxUserDefinedConstant

      private boolean checkPartialSyntaxUserDefinedConstant(String recursionInfoLevel, int tokenIndex, Token token, String tokenStr)
    • checkPartialSyntaxUnaryFunction

      private boolean checkPartialSyntaxUnaryFunction(String recursionInfoLevel, int tokenIndex, Token token, String tokenInfoMessage)
    • checkPartialSyntaxBinaryFunction

      private boolean checkPartialSyntaxBinaryFunction(String recursionInfoLevel, int tokenIndex, Token token, String tokenInfoMessage)
    • checkPartialSyntaxTernaryFunction

      private boolean checkPartialSyntaxTernaryFunction(String recursionInfoLevel, int tokenIndex, Token token, String tokenInfoMessage)
    • 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

      private boolean checkPartialSyntaxVariadicFunction(String recursionInfoLevel, int tokenIndex, Token token, String tokenInfoMessage)
    • 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

      private boolean checkSyntax(String recursionInfoLevel, boolean functionWithBodyExt)
      Checking the syntax (recursively).
      Parameters:
      recursionInfoLevel - string representing the recursion level.
      Returns:
      true if syntax was correct, otherwise returns false.
    • calculate

      public double calculate()
      Calculates the expression value and registers all the calculation steps
      Returns:
      The expression value if syntax was ok, otherwise returns Double.NaN.
    • registerErrorWhileCalculate

      private void registerErrorWhileCalculate(String errorMessageToAdd)
    • calculate

      public double calculate(CalcStepsRegister calcStepsRegister)
      Calculates the expression value
      Parameters:
      calcStepsRegister - A collection to store list of calculation steps, steps registered as strings.
      Returns:
      The expression value if syntax was ok, otherwise returns Double.NaN.
    • makeStepDescription

      private String 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

      private double calculateInternal(CalcStepsRegister calcStepsRegister)
    • registerCompiledElement

      private void registerCompiledElement(CompiledElement.ToCall toCall, int position)
    • registerCompiledElement

      private void registerCompiledElement(CompiledElement.ToCall toCall, int position1, int position2)
    • f1ArgCalc

      private void f1ArgCalc(int pos)
      Calculates unary function
      Parameters:
      pos - token position
    • f2ArgCalc

      private void f2ArgCalc(int pos)
      Calculates binary function
      Parameters:
      pos - Token position
    • f3ArgCalc

      private void f3ArgCalc(int pos)
      Calculates function with 3 arguments
      Parameters:
      pos - Token position
    • variadicFunCalc

      private void variadicFunCalc(int pos)
      Calculates Variadic function
      Parameters:
      pos - Token position
    • calculusCalc

      private void calculusCalc(int pos)
      Calculates calculus operators
      Parameters:
      pos -
    • rootOperCalc

      private void rootOperCalc(int pos)
      Unicode root operators
      Parameters:
      pos -
    • bolCalc

      private void bolCalc(int pos)
      Calculates boolean operators
      Parameters:
      pos -
    • bitwiseCalc

      private void bitwiseCalc(int pos)
      Calculates Bitwise operators
      Parameters:
      pos -
    • initParserKeyWords

      private void initParserKeyWords()
      Creates parser keywords list
    • modifyParserKeyWords

      private void modifyParserKeyWords()
    • validateParserKeyWords

      private void validateParserKeyWords()
      Final validation of keywords
    • checkArgumentNameInCalculusOperator

      private boolean checkArgumentNameInCalculusOperator(Token token)
      Method used in case of implied multiplication, where x2x can be understood as x2*x sum( x2x, 1, 20, 2*x2x) x2x is not known and it will be prevented from split into x2*x
      Parameters:
      token - The token
      Returns:
      Returns true in case calculus argument was found
    • checkSpecialConstantName

      private boolean checkSpecialConstantName(Token token)
      Check whether we have a case of '[abc]'
      Parameters:
      token - The token
      Returns:
      Returns true in case token is in a form of '[abc]' otherwise returns false.
    • checkOtherNumberBases

      private boolean checkOtherNumberBases(Token token)
      Checks whether unknown token represents number literal provided in different numeral base system, where base is between 1 and 36.
      Parameters:
      token - The token not know to the parser
    • addFractionToken

      private void addFractionToken(Token token)
      Adds fraction token to the tokens list
      Parameters:
      token - The token
    • checkFraction

      private boolean checkFraction(Token token)
      Checks whether unknown token represents fraction provided as fraction or mixed fraction
      Parameters:
      token - The token not know to the parser
    • initialTokensAdd

      private void initialTokensAdd(Token token)
      Handles implied multiplication while adding single token to the tokens list is checking preceding token
      Parameters:
      token - The token
    • assignKnownKeyword

      private void assignKnownKeyword(Token token, KeyWord keyWord)
      Assign found known keyword to the token
      Parameters:
      token - The token
      keyWord - The keyword
    • tryFindKnownKeyword

      private KeyWord tryFindKnownKeyword(String tokenStr)
      Tries to find known keyword for a given token via string matching
      Parameters:
      tokenStr - Token string
      Returns:
      known keyword if match found, otherwise not matched keyword
    • tryAssignKnownKeyword

      private boolean tryAssignKnownKeyword(Token token)
      Tries to find known keyword for a given token via string matching
      Parameters:
      token - The token
      Returns:
      true if keyword matched, otherwise false
    • initialTokensAddTokenPart

      private void initialTokensAddTokenPart(TokenPart tokenPart)
      Handles adding token part after single token split in the proces of parsing implied multiplication.
      Parameters:
      tokenPart - The token part to be added to the token list
    • checkNumberNameManyImpliedMultiplication

      private boolean checkNumberNameManyImpliedMultiplication(Token token, boolean parenthesisIsOnTheRight)
      Handles implied multiplication logic in case of a single continuous string, e.g. no brackets
      Parameters:
      token - The token
      Returns:
      returns true in case there was a reason to parse, otherwise returns false
    • addToken

      private void addToken(String tokenStr, KeyWord keyWord, boolean parenthesisIsOnTheRight)
      Adds expression token Method is called by the tokenExpressionString() while parsing string expression
      Parameters:
      tokenStr - the token string
      keyWord - the keyword
    • addToken

      private void addToken(String tokenStr, KeyWord keyWord)
    • addUserDefinedKeyWords

      private void addUserDefinedKeyWords()
    • tokenizeExpressionString

      private void tokenizeExpressionString()
      Tokenizing expression string
    • copyInitialTokens

      private void copyInitialTokens()
      copy initial tokens list to tokens list and prepares initial compilation details
    • getCopyOfInitialTokens

      public List<Token> getCopyOfInitialTokens()
      Tokenizes expression string and returns tokens list, including: string, type, level.
      Returns:
      Copy of initial tokens.
      See Also:
    • consolePrintCopyOfInitialTokens

      public void consolePrintCopyOfInitialTokens()
      Prints to the console copy of initial tokens. Presents how expression string is interpreted by the parser.
      See Also:
    • getMissingUserDefinedArguments

      public String[] getMissingUserDefinedArguments()
      Returns missing user defined arguments names, i.e. sin(x) + cos(y) where x and y are not defined function will return x and y.
      Returns:
      Array of missing user defined arguments names - distinct strings.
    • getMissingUserDefinedUnits

      public String[] getMissingUserDefinedUnits()
      Returns missing user defined units names, i.e. 2*[w] + [q] where [w] and [q] are not defined function will return [w] and [q].
      Returns:
      Array of missing user defined units names - distinct strings.
    • getMissingUserDefinedFunctions

      public String[] getMissingUserDefinedFunctions()
      Returns missing user defined functions names, i.e. sin(x) + fun(x,y) where fun is not defined function will return fun.
      Returns:
      Array of missing user defined functions names - distinct strings.
    • getInitialTokens

      List<Token> getInitialTokens()
      Gets initial tokens and returns copied list
      See Also:
    • showParsing

      private void showParsing(int lPos, int rPos)
      Shows parsing (verbose mode purposes).
    • showKeyWords

      void showKeyWords()
      shows known keywords
    • getHelp

      public String getHelp()
      Returns detailed user help on the syntax of mathematical expressions.
      Returns:
      One string value containing all the help.
    • getHelp

      public String getHelp(String query)
      Returns detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.
      Parameters:
      query - For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.
      Returns:
      One string value containing all the help.
    • getHelp

      public String getHelp(boolean addHeader, boolean addCaption, String caption)
      Returns detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.
      Parameters:
      addHeader - Indicator whether to add a header.
      addCaption - Indicator whether to add caption.
      caption - If a non-standard caption is to be added, any string other than "" will replace the standard caption with the one specified by the user.
      Returns:
      One string value containing all the help.
    • getHelp

      public String getHelp(String query, boolean addHeader, boolean addCaption, String caption)
      Returns detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.
      Parameters:
      query - For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.
      addHeader - Indicator whether to add a header.
      addCaption - Indicator whether to add caption.
      caption - If a non-standard caption is to be added, any string other than ""
      Returns:
      One string value containing all the help.
    • getHelpAsCsv

      public String getHelpAsCsv()
      Returns (as CSV) detailed user help on the syntax of mathematical expressions.
      Returns:
      One string value in CSV format containing all the help.
    • getHelpAsCsv

      public String getHelpAsCsv(String query)
      Returns (as CSV) detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.
      Parameters:
      query - For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.
      Returns:
      One string value in CSV format containing all the help.
    • getHelpAsCsv

      public String getHelpAsCsv(String quote, String delimiter, boolean addHeader)
      Returns (as CSV) detailed user help on the syntax of mathematical expressions.
      Parameters:
      quote - Text qualifier.
      delimiter - Delimiter.
      addHeader - Indicator whether to add a header.
      Returns:
      One string value in CSV format containing all the help.
    • getHelpAsCsv

      public String getHelpAsCsv(String query, String quote, String delimiter, boolean addHeader)
      Returns (as CSV) detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.
      Parameters:
      query - For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.
      quote - Text qualifier.
      delimiter - Delimiter.
      addHeader - Indicator whether to add a header.
      Returns:
      One string value in CSV format containing all the help.
    • getHelpAsHtmlTable

      public String getHelpAsHtmlTable()
      Returns (as HTML table) detailed user help on the syntax of mathematical expressions.
      Returns:
      One string value containing all the help. String in HTML table format.
    • getHelpAsHtmlTable

      public String getHelpAsHtmlTable(String query)
      Returns (as HTML table) detailed user help on the syntax of mathematical expressions.
      Parameters:
      query - For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.
      Returns:
      One string value containing all the help. String in HTML table format.
    • getHelpAsHtmlTable

      public 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

      public String getHelpAsMarkdownTable()
      Returns (as Markdown table) detailed user help on the syntax of mathematical expressions.
      Returns:
      One string value containing all the help. String in Markdown table format.
    • getHelpAsMarkdownTable

      public String getHelpAsMarkdownTable(String query)
      Returns (as Markdown table) detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.
      Parameters:
      query - For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.
      Returns:
      One string value containing all the help. String in Markdown table format.
    • getHelpAsMarkdownTable

      public String getHelpAsMarkdownTable(boolean addHeader, boolean addCaption, String caption)
      Returns (as Markdown table) detailed user help on the syntax of mathematical expressions.
      Parameters:
      addHeader - Indicator whether to add a header.
      addCaption - Indicator whether to add caption.
      caption - If a non-standard caption is to be added, use any string other than "".
      Returns:
      One string value containing all the help. String in Markdown table format.
    • getHelpAsMarkdownTable

      public 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

      public String getHelpAsJson()
      Returns (as Json) detailed user help on the syntax of mathematical expressions.
      Returns:
      One string value containing all the help. String in Json format.
    • getHelpAsJson

      public String getHelpAsJson(String query)
      Returns (as Json) detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.
      Parameters:
      query - For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.
      Returns:
      One string value containing all the help. String in Json format.
    • getHelpAsJson

      public String getHelpAsJson(boolean addCaption, String caption)
      Returns (as Json) detailed user help on the syntax of mathematical expressions.
      Parameters:
      addCaption - Indicator whether to add caption.
      caption - If a non-standard caption is to be added, use any string other than "".
      Returns:
      One string value containing all the help. String in Json format.
    • getHelpAsJson

      public String getHelpAsJson(String query, boolean addCaption, String caption)
      Returns (as Json) detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.
      Parameters:
      query - For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.
      addCaption - Indicator whether to add caption.
      caption - If a non-standard caption is to be added, use any string other than "".
      Returns:
      One string value containing all the help. String in Json format.
    • getKeyWords

      public List<KeyWord> getKeyWords()
      Returns list of keywords known to the parser
      Returns:
      List of keywords known to the parser.
      See Also:
    • getKeyWords

      public List<KeyWord> getKeyWords(String query)
      Returns list of keywords known to the parser. Allows simple and advanced searches.
      Parameters:
      query - For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.
      Returns:
      List of keywords known to the parser filter against query string.
      See Also:
    • showTokens

      void showTokens()
    • showTokens

      static void showTokens(List<Token> tokensList)
    • showInitialTokens

      void showInitialTokens()
      shows initial tokens
    • showArguments

      private void showArguments()
    • printSystemInfo

      private void printSystemInfo(String info, boolean withExpressionString)
      Parameters:
      info -
      withExpressionString -
    • clone

      protected Expression clone()
      Expression cloning.
      Overrides:
      clone in class Object
    • cloneForThreadSafeInternal

      Expression cloneForThreadSafeInternal(CloneCache cloneCache)
    • cloneForThreadSafe

      public Expression cloneForThreadSafe()
      Creates a completely independent 1-1 clone that can be safely used by a separate thread. If the cloned element contains references to other elements (e.g. arguments, functions, constants), then they will also be cloned and the newly created element will contain references to the corresponding clones. Important - the API allows you to extract all these clones.
      Returns:
      Cloned object.