From 8dfef4bc0afd295079c3ecb7e4f3236d262422f9 Mon Sep 17 00:00:00 2001 From: Adam Spofford Date: Mon, 19 Aug 2019 12:46:39 -0700 Subject: [PATCH 01/15] Document Argument.cs --- .../mariuszgromada/math/mxparser/Argument.cs | 1104 +++++++++-------- 1 file changed, 562 insertions(+), 542 deletions(-) diff --git a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Argument.cs b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Argument.cs index e5c386dd..26686c80 100644 --- a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Argument.cs +++ b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Argument.cs @@ -57,145 +57,131 @@ using System; namespace org.mariuszgromada.math.mxparser { - /** - * Argument class enables to declare the argument - * (variable) which can be used in further processing - * (in expressions, functions and dependent / recursive arguments). - *

- * - * For example: - * - *

- * Using Argument class you can define two argument types: - *

- *

- * When creating an argument you should avoid names reserved as - * parser keywords, in general words known in mathematical language - * as function names, operators (for example: - * sin, cos, +, -, etc...). Please be informed that after associating - * the argument with the expression, function or dependent/recursive argument - * its name will be recognized by the parser as reserved key word. - * It means that it could not be the same as any other key word known - * by the parser for this particular expression. Parser is case sensitive. - * - * - * @author Mariusz Gromada
- * mariuszgromada.org@gmail.com
- * MathSpace.pl
- * MathParser.org - mXparser project page
- * mXparser on GitHub
- * mXparser on SourceForge
- * mXparser on Bitbucket
- * mXparser on CodePlex
- * Janet Sudoku - project web page
- * Janet Sudoku on GitHub
- * Janet Sudoku on CodePlex
- * Janet Sudoku on SourceForge
- * Janet Sudoku on BitBucket
- * Scalar Free
- * Scalar Pro
- * ScalarMath.org
- * - * @version 4.3.0 - * - * @see RecursiveArgument - * @see Expression - * @see Function - * @see Constant - */ + + ///

+ /// Argument class enables to declare the argument + /// (variable) which can be used in further processing + /// (in expressions, functions and dependent / recursive arguments). + /// + /// For example: + /// + /// 'x' - argument in expression 'sin(x)' + /// 'x' and 'y' - arguments in expression 'sin(x)+cos(y)'. + /// 'x=2*t' - dependent argument (dependent from 't') in expression 'cos(x)' + /// + /// + /// Using Argument class you can define two argument types: + /// + /// free argument - when value of argument 'x' is directly given + /// by a number (for example 'x=5') + /// dependent argument - when value of argument 'x' is given by + /// expression (for example: 'x=2*a+b' - argument 'x' depends from + /// argument/constant 'a' and argument/constant 'b' or any other + /// possible option like function, etc...) + /// + /// + /// + /// + /// When creating an argument you should avoid names reserved as + /// parser keywords, in general words known in mathematical language + /// as function names, operators (for example: + /// sin, cos, +, -, etc...). Please be informed that after associating + /// the argument with the expression, function or dependent/recursive argument + /// its name will be recognized by the parser as reserved key word. + /// It means that it could not be the same as any other key word known + /// by the parser for this particular expression. Parser is case sensitive. + /// + /// + /// Authors:
+ /// Mariusz Gromada
+ /// mariuszgromada.org@gmail.com
+ /// MathSpace.pl
+ /// MathParser.org - mXparser project page
+ /// mXparser on GitHub
+ /// mXparser on SourceForge
+ /// mXparser on Bitbucket
+ /// mXparser on CodePlex
+ /// Janet Sudoku - project web page
+ /// Janet Sudoku on GitHub
+ /// Janet Sudoku on CodePlex
+ /// Janet Sudoku on SourceForge
+ /// Janet Sudoku on BitBucket
+ /// Scalar Free
+ /// Scalar Pro
+ /// ScalarMath.org
+ ///
[CLSCompliant(true)] public class Argument : PrimitiveElement { - /** - * No syntax errors in the dependent argument definition. - */ + + ///No syntax errors in the dependent argument definition. public const bool NO_SYNTAX_ERRORS = Expression.NO_SYNTAX_ERRORS; - /** - * Syntax error in the dependent argument definition. - */ + + /// Syntax error in the dependent argument definition. public const bool SYNTAX_ERROR_OR_STATUS_UNKNOWN = Expression.SYNTAX_ERROR_OR_STATUS_UNKNOWN; - /** - * Double.NaN as initial value of the argument. - */ + + /// as initial value of the argument. public const double ARGUMENT_INITIAL_VALUE = Double.NaN; - /** - * When argument was not not found - */ + + /// When argument was not not found public const int NOT_FOUND = Expression.NOT_FOUND; - /** - * Type indicator for free argument. - */ + + /// Type indicator for free argument. public const int FREE_ARGUMENT = 1; - /** - * Type indicator for dependent argument. - */ + + /// Type indicator for dependent argument. public const int DEPENDENT_ARGUMENT = 2; - /** - * Type indicator for recursive argument. - */ + + /// Type indicator for recursive argument. public const int RECURSIVE_ARGUMENT = 3; - /** - * Argument type id for the definition of key words - * known by the parser. - */ + + /// Argument type id for the definition of key words + /// known by the parser. public const int TYPE_ID = 101; public const String TYPE_DESC = "User defined argument"; - /** - * Description of the argument. - */ + /// Description of the argument. private String description; - /** - * Argument expression for dependent and recursive - * arguments. - */ + + /// + /// Argument expression for dependent and recursive + /// arguments. + /// internal Expression argumentExpression; - /** - * Argument name (x, y, arg1, my_argument, etc...) - */ + /// Argument name (x, y, arg1, my_argument, etc...) private String argumentName; - /** - * Argument type (free, dependent) - */ + /// Argument type (free, dependent) internal int argumentType; - /** - * Argument value (for free arguments). - */ + /// Argument value (for free arguments). internal double argumentValue; - /** - * Index argument. - * - * @see RecursiveArgument - */ + + /// Index argument. + /// + /// + protected Argument n; + /*================================================= * * Constructors * *================================================= */ - /** - * Default constructor - creates argument based on the argument definition string. - * - * @param argumentDefinitionString Argument definition string, i.e.: - * - * - * @param elements Optional parameters (comma separated) such as Arguments, Constants, Functions - */ + + /// Default constructor - creates argument based on the argument definition string. + /// + /// + /// Argument definition string, i.e.: + /// + /// 'x' - only argument name + /// 'x=5' - argument name and argument value + /// 'x=2*5' - argument name and argument value given as simple expression + /// 'x=2*y' - argument name and argument expression (dependent argument 'x' on argument 'y') + /// + /// + /// + /// + /// Optional parameters (comma separated) such as Arguments, + /// Constants, Functions + /// public Argument(String argumentDefinitionString, params PrimitiveElement[] elements) : base(Argument.TYPE_ID) { if (mXparser.regexMatch(argumentDefinitionString, ParserSymbol.nameOnlyTokenRegExp)) { @@ -238,20 +224,24 @@ public Argument(String argumentDefinitionString, params PrimitiveElement[] eleme setSilentMode(); description = ""; } - /** - * Default constructor - creates argument based on the argument definition string. - * - * @param argumentDefinitionString Argument definition string, i.e.: - * - * - * @param forceDependent If true parser will try to create dependent argument - * @param elements Optional parameters (comma separated) such as Arguments, Constants, Functions - */ + + /// Default constructor - creates argument based on the argument definition string. + /// + /// + /// Argument definition string, i.e.: + /// + /// 'x' - only argument name + /// 'x=5' - argument name and argument value + /// 'x=2*5' - argument name and argument value given as simple expression + /// 'x=2*y' - argument name and argument expression (dependent argument 'x' on argument 'y') + /// + /// + /// + /// If true parser will try to create dependent argument + /// + /// Optional parameters (comma separated) such as Arguments, + /// Constants, Functions + /// public Argument(String argumentDefinitionString, bool forceDependent, params PrimitiveElement[] elements) : base(Argument.TYPE_ID) { if ( mXparser.regexMatch(argumentDefinitionString, ParserSymbol.nameOnlyTokenRegExp) ) { argumentName = argumentDefinitionString; @@ -295,12 +285,11 @@ public Argument(String argumentDefinitionString, bool forceDependent, params Pri setSilentMode(); description = ""; } - /** - * Constructor - creates free argument. - * - * @param argumentName the argument name - * @param argumentValue the argument value - */ + + /// Constructor - creates free argument. + /// + /// the argument name + /// the argument value public Argument(String argumentName, double argumentValue) : base(Argument.TYPE_ID) { argumentExpression = new Expression(); if (mXparser.regexMatch(argumentName, ParserSymbol.nameOnlyTokenRegExp)) { @@ -315,18 +304,21 @@ public Argument(String argumentName, double argumentValue) : base(Argument.TYPE_ setSilentMode(); description = ""; } - /** - * Constructor - creates dependent argument(with hidden - * argument expression). - * - * @param argumentName the argument name - * @param argumentExpressionString the argument expression string - * @param elements Optional parameters (comma separated) - * such as Arguments, Constants, Functions - * - * @see Expression - * @see PrimitiveElement - */ + + /// + /// Constructor - creates dependent argument(with hidden + /// argument expression). + /// + /// + /// the argument name + /// the argument expression string + /// + /// Optional parameters (comma separated) such as Arguments, + /// Constants, Functions + /// + /// + /// + /// public Argument(String argumentName, String argumentExpressionString, params PrimitiveElement[] elements) : base(Argument.TYPE_ID) { if (mXparser.regexMatch(argumentName, ParserSymbol.nameOnlyTokenRegExp)) { this.argumentName="" + argumentName; @@ -343,68 +335,58 @@ public Argument(String argumentName, String argumentExpressionString, params Pri setSilentMode(); description = ""; } - /** - * Sets argument description. - * - * @param description the argument description. - */ + + /// Sets argument description. + /// + /// the argument description. public void setDescription(String description) { this.description = description; } - /** - * Gets argument description. - * - * @return The argument description string. - */ + + /// Gets argument description. + /// + /// The argument description string. public String getDescription() { return description; } - /** - * Enables argument verbose mode - */ + /// Enables argument verbose mode public void setVerboseMode() { argumentExpression.setVerboseMode(); } - /** - * Disables argument verbose mode (sets default silent mode) - */ + /// Disables argument verbose mode (sets default silent mode) public void setSilentMode() { argumentExpression.setSilentMode(); } - /** - * Returns verbose mode status - * - * @return true if verbose mode is on, - * otherwise returns false. - */ + + /// Returns verbose mode status + /// + /// true if verbose mode is on, otherwise returns false. public bool getVerboseMode() { return argumentExpression.getVerboseMode(); } - /** - * Gets recursive mode status - * - * @return true if recursive mode is enabled, - * otherwise returns false - */ + + /// Gets recursive mode status + /// + /// true if recursive mode is enabled, otherwise returns false public bool getRecursiveMode() { return argumentExpression.getRecursiveMode(); } - /** - * Gets computing time - * - * @return Computing time in seconds. - */ + + /// Gets computing time + /// + /// Computing time in seconds. public double getComputingTime() { return argumentExpression.getComputingTime(); } - /** - * Sets (modifies) argument name. - * Each expression / function / dependent argument associated - * with this argument will be marked as modified - * (requires new syntax checking). - * - * @param argumentName the argument name - */ + + /// + /// Sets (modifies) argument name. + /// Each expression / function / dependent argument associated + /// with this argument will be marked as modified + /// (requires new syntax checking). + /// + /// + /// the argument name public void setArgumentName(String argumentName) { if ((mXparser.regexMatch(argumentName, ParserSymbol.nameOnlyTokenRegExp))) { this.argumentName = argumentName; @@ -413,53 +395,54 @@ public void setArgumentName(String argumentName) { else if (argumentExpression != null) argumentExpression.setSyntaxStatus(SYNTAX_ERROR_OR_STATUS_UNKNOWN, "[" + argumentName + "] " + "Invalid argument name, pattern not match: " + ParserSymbol.nameOnlyTokenRegExp); } - /** - * Sets argument expression string. - * Each expression / function / dependent argument associated - * with this argument will be marked as modified - * (requires new syntax checking). - * - * @param argumentExpressionString the argument expression string - * - * @see Expression - */ + + /// + /// Sets argument expression string. + /// Each expression / function / dependent argument associated + /// with this argument will be marked as modified + /// (requires new syntax checking). + /// + /// + /// the argument expression string + /// + /// public void setArgumentExpressionString(String argumentExpressionString) { argumentExpression.setExpressionString(argumentExpressionString); if (argumentType == FREE_ARGUMENT) argumentType = DEPENDENT_ARGUMENT; } - /** - * Gets argument name - * - * @return the argument name as string - */ + + /// Gets argument name + /// + /// the argument name as string public String getArgumentName() { return argumentName; } - /** - * Gets argument expression string - * - * @return the argument expression string - */ + + /// Gets argument expression string + /// + /// the argument expression string public String getArgumentExpressionString() { return argumentExpression.getExpressionString(); } - /** - * Gets argument type - * - * @return Argument type: Argument.FREE_ARGUMENT, - * Argument.DEPENDENT_ARGUMENT, - * Argument.RECURSIVE_ARGUMENT - */ + + /// Gets argument type + /// + /// + /// Argument type: , + /// , + /// + /// public int getArgumentType() { return argumentType; } - /** - * Sets argument value, if DEPENDENT_ARGUMENT then argument type - * is set to FREE_ARGUMENT - * - * @param argumentValue the value of argument - */ + + /// + /// Sets argument value, if then argument type + /// is set to + /// + /// + /// the value of argument public void setArgumentValue(double argumentValue) { if (argumentType == DEPENDENT_ARGUMENT) { argumentType = FREE_ARGUMENT; @@ -473,58 +456,68 @@ public void setArgumentValue(double argumentValue) { * *================================================= */ - /** - * Checks argument syntax - * - * @return syntax status: Argument.NO_SYNTAX_ERRORS, - * Argument.SYNTAX_ERROR_OR_STATUS_UNKNOWN - */ + + /// Checks argument syntax + /// + /// + /// syntax status: , + /// + /// public bool checkSyntax() { if (argumentType == FREE_ARGUMENT) return Argument.NO_SYNTAX_ERRORS; else return argumentExpression.checkSyntax(); } - /** - * Returns error message after checking the syntax - * - * @return Error message as string. - */ + + /// Returns error message after checking the syntax + /// + /// Error message as string. public String getErrorMessage() { return argumentExpression.getErrorMessage(); } - /** - * Gets argument value. - * - * @return direct argument value for free argument, - * otherwise returns calculated argument value - * based on the argument expression. - */ + + /// Gets argument value. + /// + /// + /// direct argument value for free argument, + /// otherwise returns calculated argument value + /// based on the argument expression. + /// public double getArgumentValue() { if (argumentType == FREE_ARGUMENT) return argumentValue; else return argumentExpression.calculate(); } - /** - * Adds user defined elements (such as: Arguments, Constants, Functions) - * to the argument expressions. - * - * @param elements Elements list (variadic - comma separated) of types: Argument, Constant, Function - * - * @see PrimitiveElement - */ + + /// + /// Adds user defined elements (such as: Arguments, Constants, Functions) + /// to the argument expressions. + /// + /// + /// + /// Elements list (variadic - comma separated) of types: , + /// , + /// + /// + /// public void addDefinitions(params PrimitiveElement[] elements) { argumentExpression.addDefinitions(elements); } - /** - * Removes user defined elements (such as: Arguments, Constants, Functions) - * from the argument expressions. - * - * @param elements Elements list (variadic - comma separated) of types: Argument, Constant, Function - * - * @see PrimitiveElement - */ + + /// + /// Removes user defined elements (such as: Arguments, Constants, Functions) + /// from the argument expressions. + /// + /// + /// + /// Elements list (variadic - comma separated) of types: + /// Arguments, Constants, + /// Functions + /// + /// + /// public void removeDefinitions(params PrimitiveElement[] elements) { argumentExpression.removeDefinitions(elements); } @@ -535,131 +528,141 @@ public void removeDefinitions(params PrimitiveElement[] elements) { * *================================================= */ - /** - * Adds arguments (variadic) to the argument expression definition. - * - * @param arguments the arguments list - * (comma separated list) - * @see Argument - * @see RecursiveArgument - */ + + /// + /// Adds arguments (variadic) to the argument expression definition. + /// + /// + /// the arguments list (comma separated list) + /// + /// + /// public void addArguments(params Argument[] arguments) { argumentExpression.addArguments(arguments); } - /** - * Enables to define the arguments (associated with - * the argument expression) based on the given arguments names. - * - * @param argumentsNames the arguments names (variadic) - * comma separated list - * - * @see Argument - * @see RecursiveArgument - */ + + /// + /// Enables to define the arguments (associated with + /// the argument expression) based on the given arguments names. + /// + /// + /// + /// the arguments names (variadic) + /// comma separated list + /// + /// + /// + /// public void defineArguments(params String[] argumentsNames) { argumentExpression.defineArguments(argumentsNames); } - /** - * Enables to define the argument (associated with the argument expression) - * based on the argument name and the argument value. - * - * @param argumentName the argument name - * @param argumentValue the the argument value - * - * @see Argument - * @see RecursiveArgument - */ + + /// + /// Enables to define the argument (associated with the argument expression) + /// based on the argument name and the argument value. + /// + /// + /// the argument name + /// the the argument value + /// + /// + /// public void defineArgument(String argumentName, double argumentValue) { argumentExpression.defineArgument(argumentName, argumentValue); } - /** - * Gets argument index from the argument expression. - * - * @param argumentName the argument name - * - * @return The argument index if the argument name was found, - * otherwise returns Argument.NOT_FOUND - * - * @see Argument - * @see RecursiveArgument - */ + + /// Gets argument index from the argument expression. + /// + /// the argument name + /// + /// + /// The argument index if the argument name was found, + /// otherwise returns + /// + /// + /// + /// public int getArgumentIndex(String argumentName) { return argumentExpression.getArgumentIndex(argumentName); } - /** - * Gets argument from the argument expression. - * - * - * @param argumentName the argument name - * - * @return The argument if the argument name was found, - * otherwise returns null. - * - * @see Argument - * @see RecursiveArgument - */ + + /// Gets argument from the argument expression. + /// + /// the argument name + /// + /// + /// The argument if the argument name was found, + /// otherwise returns null. + /// + /// + /// + /// public Argument getArgument(String argumentName) { return argumentExpression.getArgument(argumentName); } - /** - * Gets argument from the argument expression. - * - * @param argumentIndex the argument index - * - * @return Argument if the argument index is between 0 and - * the last available argument index (getArgumentsNumber()-1), - * otherwise returns null. - * - * @see Argument - * @see RecursiveArgument - */ + + /// Gets argument from the argument expression. + /// + /// the argument index + /// + /// + /// Argument if the argument index is between 0 and + /// the last available argument index (-1), + /// otherwise returns null. + /// + /// + /// + /// public Argument getArgument(int argumentIndex) { return argumentExpression.getArgument(argumentIndex); } - /** - * Gets number of arguments associated with the argument expression. - * - * @return The number of arguments (int >= 0) - * - * @see Argument - * @see RecursiveArgument - */ + + /// Gets number of arguments associated with the argument expression. + /// + /// The number of arguments (int >= 0) + /// + /// + /// public int getArgumentsNumber() { return argumentExpression.getArgumentsNumber(); } - /** - * Removes first occurrences of the arguments - * associated with the argument expression. - * - * @param argumentsNames the arguments names - * (variadic parameters) comma separated - * list - * - * @see Argument - * @see RecursiveArgument - */ + + /// + /// Removes first occurrences of the arguments + /// associated with the argument expression. + /// + /// + /// + /// the arguments names + /// (variadic parameters) comma separated list + /// + /// + /// + /// public void removeArguments(params String[] argumentsNames) { argumentExpression.removeArguments(argumentsNames); } - /** - * Removes first occurrences of the arguments - * associated with the argument expression. - * - * @param arguments the arguments (variadic parameters) - * comma separated list - * - * @see Argument - * @see RecursiveArgument - */ + + /// + /// Removes first occurrences of the arguments + /// associated with the argument expression. + /// + /// + /// + /// the arguments (variadic parameters) + /// comma separated list + /// + /// + /// + /// public void removeArguments(params Argument[] arguments) { argumentExpression.removeArguments(arguments); } - /** - * Removes all arguments associated with the argument expression. - * - * @see Argument - * @see RecursiveArgument - */ + + /// Removes all arguments associated with the argument expression. + /// + /// + /// public void removeAllArguments() { argumentExpression.removeAllArguments(); } @@ -670,111 +673,118 @@ public void removeAllArguments() { * *================================================= */ - /** - * Adds constants (variadic parameters) to the argument expression definition. - * - * @param constants the constants - * (comma separated list) - * - * @see Constant - */ + /// Adds constants (variadic parameters) to the argument expression definition. + /// + /// the constants (comma separated list) + /// + /// public void addConstants(params Constant[] constants) { argumentExpression.addConstants(constants); } - /** - * Enables to define the constant (associated with - * the argument expression) based on the constant name and - * constant value. - * - * @param constantName the constant name - * @param constantValue the constant value - * - * @see Constant - */ + + /// + /// Enables to define the constant (associated with + /// the argument expression) based on the constant name and + /// constant value. + /// + /// + /// the constant name + /// the constant value + /// + /// public void defineConstant(String constantName, double constantValue) { argumentExpression.defineConstant(constantName, constantValue); } - /** - * Gets constant index associated with the argument expression. - * - * @param constantName the constant name - * - * @return Constant index if constant name was found, - * otherwise return Constant.NOT_FOUND. - * - * @see Constant - */ + + /// Gets constant index associated with the argument expression. + /// + /// the constant name + /// + /// + /// Constant index if constant name was found, + /// otherwise return . + /// + /// + /// public int getConstantIndex(String constantName) { return argumentExpression.getConstantIndex(constantName); } - /** - * Gets constant associated with the argument expression. - * - * @param constantName the constant name - * - * @return Constant if constant name was found, - * otherwise return null. - * - * @see Constant - */ + + /// Gets constant associated with the argument expression. + /// + /// the constant name + /// + /// + /// Constant if constant name was found, + /// otherwise return null. + /// + /// + /// public Constant getConstant(String constantName) { return argumentExpression.getConstant(constantName); } - /** - * Gets constant associated with the argument expression. - * - * @param constantIndex the constant index - * - * @return Constant if the constantIndex is between - * 0 and the last available constant index - * (getConstantsNumber() - 1), - * otherwise it returns null. - * - * @see Constant - */ + + /// Gets constant associated with the argument expression. + /// + /// the constant index + /// + /// + /// Constant if the is between + /// 0 and the last available constant index + /// ( - 1), + /// otherwise it returns null. + /// + /// + /// public Constant getConstant(int constantIndex) { return argumentExpression.getConstant(constantIndex); } - /** - * Gets number of constants associated with the argument expression. - * - * @return number of constants (int >= 0) - * - * @see Constant - */ + + /// Gets number of constants associated with the argument expression. + /// + /// number of constants (int >= 0) + /// + /// public int getConstantsNumber() { return argumentExpression.getConstantsNumber(); } - /** - * Removes first occurrences of the constants - * associated with the argument expression. - * - * @param constantsNames the constants names (variadic parameters) - * comma separated list - * - * @see Constant - */ + + /// + /// Removes first occurrences of the constants + /// associated with the argument expression. + /// + /// + /// + /// the constants names (variadic parameters) + /// comma separated list + /// + /// + /// public void removeConstants(params String[] constantsNames) { argumentExpression.removeConstants(constantsNames); } - /** - * Removes first occurrences of the constants - * associated with the argument expression - * - * @param constants the constants (variadic parameters) - * comma separated list - * - * @see Constant - */ + + /// + /// Removes first occurrences of the constants + /// associated with the argument expression + /// + /// + /// + /// the constants (variadic parameters) + /// comma separated list + /// + /// + /// public void removeConstants(params Constant[] constants) { argumentExpression.removeConstants(constants); } - /** - * Removes all constants - * associated with the argument expression - * - * @see Constant - */ + + /// + /// Removes all constants + /// associated with the argument expression + /// + /// + /// public void removeAllConstants() { argumentExpression.removeAllConstants(); } @@ -785,114 +795,126 @@ public void removeAllConstants() { * *================================================= */ - /** - * Adds functions (variadic parameters) to the argument expression definition. - * - * @param functions the functions - * (variadic parameters) comma separated list - * - * @see Function - */ + + /// Adds functions (variadic parameters) to the argument expression definition. + /// + /// + /// the functions (variadic parameters) + /// comma separated list + /// + /// + /// public void addFunctions(params Function[] functions) { argumentExpression.addFunctions(functions); } - /** - * Enables to define the function (associated with - * the argument expression) based on the function name, - * function expression string and arguments names (variadic parameters). - * - * @param functionName the function name - * @param functionExpressionString the expression string - * @param argumentsNames the function arguments names - * (variadic parameters) - * comma separated list - * - * @see Function - */ + + /// + /// Enables to define the function (associated with + /// the argument expression) based on the function name, + /// function expression string and arguments names (variadic parameters). + /// + /// + /// the function name + /// the expression string + /// + /// the function arguments names + /// (variadic parameters) comma separated list + /// + /// + /// public void defineFunction(String functionName, String functionExpressionString, params String[] argumentsNames) { argumentExpression.defineFunction(functionName, functionExpressionString, argumentsNames); } - /** - * Gets index of function associated with the argument expression. - * - * @param functionName the function name - * - * @return Function index if function name was found, - * otherwise returns Function.NOT_FOUND - * - * @see Function - */ + + /// Gets index of function associated with the argument expression. + /// + /// the function name + /// + /// + /// Function index if function name was found, + /// otherwise returns + /// + /// + /// public int getFunctionIndex(String functionName) { return argumentExpression.getFunctionIndex(functionName); } - /** - * Gets function associated with the argument expression. - * - * @param functionName the function name - * - * @return Function if function name was found, - * otherwise returns null. - * - * @see Function - */ + + /// Gets function associated with the argument expression. + /// + /// the function name + /// + /// + /// Function if function name was found, + /// otherwise returns null. + /// + /// + /// public Function getFunction(String functionName) { return argumentExpression.getFunction(functionName); } - /** - * Gets function associated with the argument expression. - * - * @param functionIndex the function index - * - * @return Function if function index is between 0 and - * the last available function index (getFunctionsNumber()-1), - * otherwise returns null. - * - * @see Function - */ + + /// Gets function associated with the argument expression. + /// + /// the function index + /// + /// + /// Function if function index is between 0 and + /// the last available function index (-1), + /// otherwise returns null. + /// + /// + /// public Function getFunction(int functionIndex) { return argumentExpression.getFunction(functionIndex); } - /** - * Gets number of functions associated with the argument expression. - * - * @return number of functions (int >= 0) - * - * @see Function - */ + + /// Gets number of functions associated with the argument expression. + /// + /// number of functions (int >= 0) + /// + /// public int getFunctionsNumber() { return argumentExpression.getFunctionsNumber(); } - /** - * Removes first occurrences of the functions - * associated with the argument expression. - * - * @param functionsNames the functions names (variadic parameters) - * comma separated list - * - * @see Function - */ + + /// + /// Removes first occurrences of the functions + /// associated with the argument expression. + /// + /// + /// + /// the functions names (variadic parameters) + /// comma separated list + /// + /// + /// public void removeFunctions(params String[] functionsNames) { argumentExpression.removeFunctions(functionsNames); } - /** - * Removes first occurrences of the functions - * associated with the argument expression. - * - * @param functions the functions (variadic parameters) - * comma separated list. - * - * @see Function - */ + + /// + /// Removes first occurrences of the functions + /// associated with the argument expression. + /// + /// + /// + /// the functions (variadic parameters) + /// comma separated list. + /// + /// + /// public void removeFunctions(params Function[] functions) { argumentExpression.removeFunctions(functions); } - /** - * Removes all functions - * associated with the argument expression. - * - * @see Function - */ + + /// + /// Removes all functions + /// associated with the argument expression. + /// + /// + /// public void removeAllFunctions() { argumentExpression.removeAllFunctions(); } @@ -902,39 +924,37 @@ public void removeAllFunctions() { * *================================================= */ - /** - * Adds related expression to the argumentExpression - * - * @param expression the related expression - * @see Expression - */ + + /// Adds related expression to the + /// + /// the related expression + /// internal void addRelatedExpression(Expression expression) { argumentExpression.addRelatedExpression(expression); } - /** - * Adds related expression form the argumentExpression - * - * @param expression related expression - * - * @see Expression - */ + + /// Adds related expression form the + /// + /// related expression + /// + /// internal void removeRelatedExpression(Expression expression) { argumentExpression.removeRelatedExpression(expression); } - /** - * Sets expression was modified flag to all related expressions - * to the argumentExpression. - * - * @see Expression - */ + + /// + /// Sets expression was modified flag to all related expressions + /// to the . + /// + /// + /// internal void setExpressionModifiedFlags() { argumentExpression.setExpressionModifiedFlag(); } - /** - * Creates cloned object of the this argument.'' - * - * @return clone of the argument. - */ + + /// Creates cloned object of the this argument.'' + /// + /// clone of the argument. public Argument clone() { Argument newArg = new Argument(this.argumentName); newArg.argumentExpression = this.argumentExpression; From 9308e66d6073ee53d4eda254d3620add585ea9b5 Mon Sep 17 00:00:00 2001 From: Adam Spofford Date: Mon, 19 Aug 2019 13:33:15 -0700 Subject: [PATCH 02/15] Document Constant.cs --- .../mariuszgromada/math/mxparser/Constant.cs | 282 ++++++++---------- 1 file changed, 132 insertions(+), 150 deletions(-) diff --git a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Constant.cs b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Constant.cs index 045c6db6..7e93573e 100644 --- a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Constant.cs +++ b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Constant.cs @@ -58,97 +58,78 @@ using System.Collections.Generic; namespace org.mariuszgromada.math.mxparser { - /** - * Constant class provides ability to declare constants. - * Constants can be used in further processing by any expression, - * dependent or recursive argument, function, etc... - *

- * When creating a constant you should avoid names reserved as - * parser keywords, in general words known in mathematical language - * as function names, operators (for example: - * sin, cos, +, -, pi, e, etc...). Please be informed that after associating - * the constant with the expression, function or dependent/recursive argument - * its name will be recognized by the parser as reserved key word. - * It means that it could not be the same as any other key word known - * by the parser for this particular expression. - * - * @author Mariusz Gromada
- * mariuszgromada.org@gmail.com
- * MathSpace.pl
- * MathParser.org - mXparser project page
- * mXparser on GitHub
- * mXparser on SourceForge
- * mXparser on Bitbucket
- * mXparser on CodePlex
- * Janet Sudoku - project web page
- * Janet Sudoku on GitHub
- * Janet Sudoku on CodePlex
- * Janet Sudoku on SourceForge
- * Janet Sudoku on BitBucket
- * Scalar Free
- * Scalar Pro
- * ScalarMath.org
- * - * @version 4.3.0 - * - * @see RecursiveArgument - * @see Expression - * @see Function - * @see Argument - * - */ + ///

+ /// Constant class provides ability to declare constants. + /// Constants can be used in further processing by any expression, + /// dependent or recursive argument, function, etc... + /// + /// + /// When creating a constant you should avoid names reserved as + /// parser keywords, in general words known in mathematical language + /// as function names, operators (for example: + /// sin, cos, +, -, pi, e, etc...). Please be informed that after associating + /// the constant with the expression, function or dependent/recursive argument + /// its name will be recognized by the parser as reserved key word. + /// It means that it could not be the same as any other key word known + /// by the parser for this particular expression. + /// + /// Author: Mariusz Gromada
+ /// mariuszgromada.org@gmail.com
+ /// MathSpace.pl
+ /// MathParser.org - mXparser project page
+ /// mXparser on GitHub
+ /// mXparser on SourceForge
+ /// mXparser on Bitbucket
+ /// mXparser on CodePlex
+ /// Janet Sudoku - project web page
+ /// Janet Sudoku on GitHub
+ /// Janet Sudoku on CodePlex
+ /// Janet Sudoku on SourceForge
+ /// Janet Sudoku on BitBucket
+ /// Scalar Free
+ /// Scalar Pro
+ /// ScalarMath.org
+ /// + /// Version: 4.3.0 + ///
+ /// + /// + /// + /// [CLSCompliant(true)] public class Constant : PrimitiveElement { - /** - * When constant could not be found - */ + /// When constant could not be found public const int NOT_FOUND = Expression.NOT_FOUND; - /** - * Type identifier for constants - */ + /// Type identifier for constants public const int TYPE_ID = 104; public const String TYPE_DESC = "User defined constant"; - /** - * Status of the Expression syntax - */ + /// Status of the Expression syntax public const bool NO_SYNTAX_ERRORS = Expression.NO_SYNTAX_ERRORS; public const bool SYNTAX_ERROR_OR_STATUS_UNKNOWN = Expression.SYNTAX_ERROR_OR_STATUS_UNKNOWN; private const String NO_SYNTAX_ERROR_MSG = "Constant - no syntax errors."; - /** - * Name of the constant - */ + /// Name of the constant private String constantName; - /** - * COnstant value - */ + /// COnstant value private double constantValue; - /** - * Constant description - */ + /// Constant description private String description; - /** - * Dependent expression list - */ + /// Dependent expression list private List relatedExpressionsList; - /** - * Status of the expression syntax - * - * Please referet to the: - * - NO_SYNTAX_ERRORS - * - SYNTAX_ERROR_OR_STATUS_UNKNOWN - */ + /// Status of the expression syntax + /// + /// + /// Please referet to the: + /// - + /// - + /// private bool syntaxStatus; - /** - * Message after checking the syntax - */ + /// Message after checking the syntax private String errorMessage; - /** - * Constructor - creates constant with a given name and given value - * - * - * @param constantName the constant name - * @param constantValue the constant value - */ + + /// Constructor - creates constant with a given name and given value + /// + /// the constant name + /// the constant value public Constant(String constantName, double constantValue) : base(Constant.TYPE_ID) { relatedExpressionsList = new List(); if (mXparser.regexMatch(constantName, ParserSymbol.nameOnlyTokenOptBracketsRegExp)) { @@ -162,14 +143,15 @@ public Constant(String constantName, double constantValue) : base(Constant.TYPE_ errorMessage = "[" + constantName + "] " + "--> invalid constant name, pattern not mathes: " + ParserSymbol.nameTokenRegExp; ; } } - /** - * Constructor - creates constant with a given name and given value. - * Additionally description is being set. - * - * @param constantName the constant name - * @param constantValue the constant value - * @param description the constant description - */ + + /// + /// Constructor - creates constant with a given name and given value. + /// Additionally description is being set. + /// + /// + /// the constant name + /// the constant value + /// the constant description public Constant(String constantName, double constantValue, String description) : base(Constant.TYPE_ID) { relatedExpressionsList = new List(); if (mXparser.regexMatch(constantName, ParserSymbol.nameOnlyTokenOptBracketsRegExp)) { @@ -184,16 +166,22 @@ public Constant(String constantName, double constantValue, String description) : errorMessage = "[" + constantName + "] " + "--> invalid constant name, pattern not mathes: " + ParserSymbol.nameTokenRegExp; ; } } - /** - * Constructor for function definition in natural math language, - * for instance providing on string "f(x,y) = sin(x) + cos(x)" - * is enough to define function "f" with parameters "x and y" - * and function body "sin(x) + cos(x)". - * - * @param constantDefinitionString Constant definition in the form - * of one String, ie "c = 2" or "c = 2*sin(pi/3)" - * @param elements Optional parameters (comma separated) such as Arguments, Constants, Functions - */ + + /// + /// Constructor for function definition in natural math language, + /// for instance providing on string "f(x,y) = sin(x) + cos(x)" + /// is enough to define function "f" with parameters "x and y" + /// and function body "sin(x) + cos(x)". + /// + /// + /// + /// Constant definition in the form + /// of one String, ie "c = 2" or "c = 2*sin(pi/3)" + /// + /// + /// Optional parameters (comma separated) such as Arguments, + /// Constants, Functions + /// public Constant(String constantDefinitionString, params PrimitiveElement[] elements) : base(Constant.TYPE_ID) { description = ""; syntaxStatus = SYNTAX_ERROR_OR_STATUS_UNKNOWN; @@ -209,20 +197,20 @@ public Constant(String constantDefinitionString, params PrimitiveElement[] eleme } else errorMessage = "[" + constantDefinitionString + "] " + "--> pattern not mathes: " + ParserSymbol.constArgDefStrRegExp; } - /** - * Gets constant name - * - * @return the constant name as string. - */ + + /// Gets constant name + /// + /// the constant name as string. public String getConstantName() { return constantName; } - /** - * Sets constant name. If constant is associated with any expression - * then this operation will set modified flag to each related expression. - * - * @param constantName the constant name - */ + + /// + /// Sets constant name. If constant is associated with any expression + /// then this operation will set modified flag to each related expression. + /// + /// + /// the constant name public void setConstantName(String constantName) { if (mXparser.regexMatch(constantName, ParserSymbol.nameOnlyTokenOptBracketsRegExp)) { this.constantName = constantName; @@ -233,77 +221,71 @@ public void setConstantName(String constantName) { errorMessage = "[" + constantName + "] " + "--> invalid constant name, pattern not mathes: " + ParserSymbol.nameTokenRegExp; ; } } - /** - * Sets constant value - * @param value constant value - */ + + /// Sets constant value + /// + /// constant value public void setConstantValue(double constantValue) { this.constantValue = constantValue; } - /** - * Gets constant value. - * - * @return constant value as double - */ + + /// Gets constant value. + /// + /// constant value as double public double getConstantValue() { return constantValue; } - /** - * Gets constant description. - * - * @return constant description as string. - */ + + /// Gets constant description. + /// + /// constant description as string. public String getDescription() { return description; } - /** - * Sets constant description. - * - * @param description the constant description - */ + + /// Sets constant description. + /// + /// the constant description public void setDescription(String description) { this.description = description; } - /** - * Method return error message after - * - * @return Error message as string. - */ + + /// Method return error message after + /// + /// Error message as string. public String getErrorMessage() { return errorMessage; } - /** - * Gets syntax status of the expression. - * - * @return Constant.NO_SYNTAX_ERRORS if there are no syntax errors, - * ConstantValue.SYNTAX_ERROR_OR_STATUS_UNKNOWN when syntax error was found or - * syntax status is unknown - */ + + /// Gets syntax status of the expression. + /// + /// + /// if there are no syntax errors, + /// when syntax error was found or + /// syntax status is unknown + /// public bool getSyntaxStatus() { return this.syntaxStatus; } - /** - * Adds related expression. - * - * @param expression the related expression. - */ + + /// Adds related expression. + /// + /// the related expression. internal void addRelatedExpression(Expression expression) { if (expression != null) if ( !relatedExpressionsList.Contains(expression) ) relatedExpressionsList.Add(expression); } - /** - * Removes related expression. - * - * @param expression the related expression. - */ + + /// Removes related expression. + /// + /// the related expression. internal void removeRelatedExpression(Expression expression) { if (expression != null) relatedExpressionsList.Remove(expression); } - /** - * Sets expression modified flag to each related expression. - */ + + /// Sets expression modified flag to each related expression. void setExpressionModifiedFlags() { foreach (Expression e in relatedExpressionsList) e.setExpressionModifiedFlag(); From 9f4754cb57386cb48f5cb851013d8f3961c68d57 Mon Sep 17 00:00:00 2001 From: Adam Spofford Date: Mon, 19 Aug 2019 13:33:37 -0700 Subject: [PATCH 03/15] Update .gitignore for working with Rider --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 20983dbd..f3bbeb6b 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ ipch/ *.csproj.user DTAR_*_DTAR/ /CURRENT/c-sharp/UpgradeLog.htm +/CURRENT/c-sharp/.idea From d40e9c0625dccf5c634a1a4000fb2d466aee7850 Mon Sep 17 00:00:00 2001 From: Adam Spofford Date: Mon, 19 Aug 2019 16:12:32 -0700 Subject: [PATCH 04/15] Document Expression.cs --- .../math/mxparser/Expression.cs | 4738 ++++++++--------- 1 file changed, 2176 insertions(+), 2562 deletions(-) diff --git a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Expression.cs b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Expression.cs index bb95b8ae..b858091d 100644 --- a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Expression.cs +++ b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Expression.cs @@ -64,241 +64,234 @@ using org.mariuszgromada.math.mxparser.parsertokens; namespace org.mariuszgromada.math.mxparser { - /** - * Expression - base class for real expressions 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. - * - * - * @author Mariusz Gromada
- * mariuszgromada.org@gmail.com
- * MathSpace.pl
- * MathParser.org - mXparser project page
- * mXparser on GitHub
- * mXparser on SourceForge
- * mXparser on Bitbucket
- * mXparser on CodePlex
- * Janet Sudoku - project web page
- * Janet Sudoku on GitHub
- * Janet Sudoku on CodePlex
- * Janet Sudoku on SourceForge
- * Janet Sudoku on BitBucket
- * Scalar Free
- * Scalar Pro
- * ScalarMath.org
- * - * @version 4.3.3 - * - * @see Argument - * @see RecursiveArgument - * @see Constant - * @see Function - */ + ///

+ /// Expression - base class for real expressions 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. + /// + /// Authors:
+ /// Mariusz Gromada
+ /// mariuszgromada.org@gmail.com
+ /// MathSpace.pl
+ /// MathParser.org - mXparser project page
+ /// mXparser on GitHub
+ /// mXparser on SourceForge
+ /// mXparser on Bitbucket
+ /// mXparser on CodePlex
+ /// Janet Sudoku - project web page
+ /// Janet Sudoku on GitHub
+ /// Janet Sudoku on CodePlex
+ /// Janet Sudoku on SourceForge
+ /// Janet Sudoku on BitBucket
+ /// Scalar Free
+ /// Scalar Pro
+ /// ScalarMath.org + /// + /// Version: 4.3.3 + ///
+ /// + /// + /// + /// + /// [CLSCompliant(true)] public class Expression { - /** - * FOUND / NOT_FOUND - * used for matching purposes - */ + /// + /// FOUND / NOT_FOUND + /// used for matching purposes + /// internal const int NOT_FOUND = mXparser.NOT_FOUND; internal const int FOUND = mXparser.FOUND; - /** - * Marker for internal processing - */ + + /// Marker for internal processing + internal const bool INTERNAL = true; - /** - * For verbose mode purposes - */ + /// For verbose mode purposes private const bool WITH_EXP_STR = true; private const bool NO_EXP_STR = false; - /** - * Status of the Expression syntax - */ + /// Status of the Expression syntax public const bool NO_SYNTAX_ERRORS = true; public const bool SYNTAX_ERROR_OR_STATUS_UNKNOWN = false; - /** - * Expression string (for example: "sin(x)+cos(y)") - */ + /// Expression string (for example: "sin(x)+cos(y)") internal String expressionString; private String description; - /** - * List of arguments - * - * @see Argument - * @see RecursiveArgument - */ + /// List of arguments + /// + /// + /// internal List argumentsList; - /** - * List of user defined functions - * - * @see Function - */ + /// List of user defined functions + /// + /// internal List functionsList; - /** - * List of user defined constants - * - * @see Constant - */ + /// List of user defined constants + /// + /// internal List constantsList; - /** - * List of key words known by the parser - */ - private List keyWordsList; - /** - * 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 - */ + /// List of key words known by the parser + private List keyWordsList; + /// + /// 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 ( - 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 + /// + /// private List initialTokens; - /** - * 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. - */ + /// + /// the initialTokens list keeps unchanged information about + /// found tokens. + /// + /// + /// While parsing the tokensList is used. The tokensList is the same + /// as 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. + /// private List tokensList; - /** - * 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 - */ + /// + /// 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 + /// + /// internal List relatedExpressionsList; - /** - * Keeps computing time - */ + /// Keeps computing time private double computingTime; - /** - * if true then new tokenizing is required - * (the initialTokens list needs to be updated) - */ + /// + /// if true then new tokenizing is required + /// (the list needs to be updated) + /// private bool expressionWasModified; - /** - * If recursive mode is on the recursive calls are permitted. - * It mean there will be no null pointer exceptions - * due to expression, and functions cloning. - */ + /// + /// If recursive mode is on the recursive calls are permitted. + /// It mean there will be no null pointer exceptions + /// due to expression, and functions cloning. + /// internal bool recursiveMode; - /** - * Verbose mode prints processing info - * calls System.out.print* methods - */ + /// + /// Verbose mode prints processing info + /// calls Console.Write* methods + /// private bool verboseMode; - /** - * Internal parameter for calculus expressions - * to avoid decrease in accuracy. - */ + /// + /// Internal parameter for calculus expressions + /// to avoid decrease in accuracy. + /// internal bool disableUlpRounding; internal const bool DISABLE_ULP_ROUNDING = true; internal const bool KEEP_ULP_ROUNDING_SETTINGS = false; - /** - * Status of the expression syntax - * - * Please referet to the: - * - NO_SYNTAX_ERRORS - * - SYNTAX_ERROR_OR_STATUS_UNKNOWN - */ + /// Status of the expression syntax + /// + /// Please referet to the: + /// + /// + /// + /// + /// private bool syntaxStatus; - /** - * Message after checking the syntax - */ + /// Message after checking the syntax private String errorMessage; - /** - * Flag used internally to mark started recursion - * call on the current object, necessary to - * avoid infinite loops while recursive syntax - * checking (i.e. f -> g and g -> f) - * or marking modified flags on the expressions - * related to this expression. - * - * @see setExpressionModifiedFlag() - * @see checkSyntax() - */ + /// + /// Flag used internally to mark started recursion + /// call on the current object, necessary to + /// avoid infinite loops while recursive syntax + /// checking (i.e. f -> g and g -> f) + /// or marking modified flags on the expressions + /// related to this expression. + /// + /// + /// + /// private bool recursionCallPending; - /** - * Internal counter to avoid infinite loops while calculating - * expression defined in the way shown 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); - */ + /// + /// Internal counter to avoid infinite loops while calculating + /// expression defined in the way shown 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); + /// + /// private int recursionCallsCounter; - /** - * Internal indicator for tokenization process - * if true, then keywords such as constants - * functions etc.. will not be recognized - * during tokenization - */ + /// + /// Internal indicator for tokenization process + /// if true, then keywords such as constants + /// functions etc.. will not be recognized + /// during tokenization + /// private bool parserKeyWordsOnly; - /** - * Indicator whether expression was - * automatically built for user defined - * functions purpose - * - * @see Function - */ + /// + /// Indicator whether expression was + /// automatically built for user defined + /// functions purpose + /// + /// + /// internal bool UDFExpression = false; - /** - * List of parameters provided by the user at run-time - * - * @see Function - */ + /// List of parameters provided by the user at run-time + /// + /// internal List UDFVariadicParamsAtRunTime; - /** - * Internal indicator for calculation process - * Expression.Calculate() method - * It show 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); - */ + /// + /// Internal indicator for calculation process + /// method + /// + /// It show whether to build again tokens list
+ /// if clone - build again
+ /// if not clone - build only at the beginning + /// + /// Indicator helps to solve the problem with + /// above definitions + /// + /// Function f = new Function("f(x) = 2*g(x)"); + /// Function g = new Function("g(x) = 2*f(x)"); + /// f.addDefinitions(g); + /// g.addDefinitions(f); + /// + ///
private bool internalClone; - /** - * mXparser options changeset - * used in checkSyntax() method - */ + /// mXparser options changeset + /// used in checkSyntax() method private int optionsChangesetNumber = -1; /*================================================= * @@ -306,75 +299,71 @@ public class Expression { * *================================================= */ - /** - * Adds related expression - * The same expression could be added more than once - * For example when - * - * @param expression the expression - */ + /// + /// Adds related expression + /// The same expression could be added more than once + /// For example when + /// + /// + /// the expression internal void addRelatedExpression(Expression expression) { if ((expression != null) && (expression != this)) if ( !relatedExpressionsList.Contains(expression)) relatedExpressionsList.Add(expression); } - /** - * Removes related expression - * - * @param expression the expression - */ + /// Removes related expression + /// + /// the expression internal void removeRelatedExpression(Expression expression) { relatedExpressionsList.Remove(expression); } - /** - * Prints related expression list - */ + /// Prints related expression list internal void showRelatedExpressions() { mXparser.consolePrintln(); mXparser.consolePrintln(this.description + " = " + this.expressionString + ":"); foreach (Expression e in relatedExpressionsList) mXparser.consolePrintln("-> " + e.description + " = " + e.expressionString); } - /** - * Method return error message after - * calling checkSyntax() method or - * calculate(). - * - * @return Error message as string. - */ + /// + /// Method return error message after + /// calling method or + /// . + /// + /// + /// Error message as string. public String getErrorMessage() { return errorMessage; } - /** - * Gets syntax status of the expression. - * - * @return true if there are no syntax errors, - * false when syntax error was found or - * syntax status is unknown - */ + /// Gets syntax status of the expression. + /// + /// + /// true if there are no syntax errors, + /// false when syntax error was found or + /// syntax status is unknown + /// public bool getSyntaxStatus() { return this.syntaxStatus; } - /** - * Package level method for passing - * information about errors identified - * on the constructors level - * - * @param syntaxStatus Syntax status - * @param errorMessage Error message - * - * @see Function - */ + /// + /// Package level method for passing + /// information about errors identified + /// on the constructors level + /// + /// + /// Syntax status + /// Error message + /// + /// internal void setSyntaxStatus(bool syntaxStatus, String errorMessage) { this.syntaxStatus = syntaxStatus; this.errorMessage = errorMessage; this.expressionWasModified = false; } - /** - * Sets expression status to modified - * Calls setExpressionModifiedFlag() method - * to all related expressions. - */ + /// + /// Sets expression status to modified + /// Calls setExpressionModifiedFlag() method + /// to all related expressions. + /// internal void setExpressionModifiedFlag() { if (recursionCallPending == false) { recursionCallPending = true; @@ -388,9 +377,7 @@ internal void setExpressionModifiedFlag() { recursionCallPending = false; } } - /** - * Common variables while expression initializing - */ + /// Common variables while expression initializing private void expressionInternalVarsInit() { description = ""; errorMessage = ""; @@ -401,9 +388,7 @@ private void expressionInternalVarsInit() { parserKeyWordsOnly = false; disableUlpRounding = KEEP_ULP_ROUNDING_SETTINGS; } - /** - * Common elements while expression initializing - */ + /// Common elements while expression initializing private void expressionInit() { /* * New lists @@ -427,58 +412,64 @@ private void expressionInit() { * *================================================= */ - /** - * Default constructor - empty expression - * - * @param elements Optional elements list (variadic - comma separated) of types: Argument, Constant, Function - * - * @see PrimitiveElement - */ + /// Default constructor - empty expression + /// + /// + /// Optional elements list (variadic - comma separated) + /// of types: , , + /// + /// + /// + /// public Expression(params PrimitiveElement[] elements) { expressionString = ""; expressionInit(); setExpressionModifiedFlag(); addDefinitions(elements); } - /** - * Constructor - creates new expression from expression string. - * - * @param expressionString definition of the expression - * @param elements Optional elements list (variadic - comma separated) of types: Argument, Constant, Function - * - * @see PrimitiveElement - * - */ + /// Constructor - creates new expression from expression string. + /// + /// definition of the expression + /// + /// Optional elements list (variadic - comma separated) + /// of types: , , + /// + /// + /// + /// + /// public Expression(String expressionString, params PrimitiveElement[] elements) { expressionInit(); this.expressionString = "" + expressionString; setExpressionModifiedFlag(); addDefinitions(elements); } - /** - * Constructor - creates new expression from expression string. - * @param expressionString definition of the expression - * @param parserKeyWordsOnly if true then all keywords such as functions, - * constants, arguments will not be recognized. - */ + /// Constructor - creates new expression from expression string. + /// definition of the expression + /// + /// if true then all keywords such as functions, + /// constants, arguments will not be recognized. + /// internal Expression(String expressionString, bool parserKeyWordsOnly) { expressionInit(); this.expressionString = "" + expressionString; setExpressionModifiedFlag(); this.parserKeyWordsOnly = parserKeyWordsOnly; } - /** - * 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...). - * - * @param expressionString the expression string - * @param initialTokens the tokens list (starting point - no tokenizing, - * no syntax checking) - * @param argumentsList the arguments list - * @param functionsList the functions list - * @param constantsList the constants list - */ + /// + /// 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...). + /// + /// + /// the expression string + /// + /// the tokens list (starting point - no tokenizing, + /// no syntax checking) + /// + /// the arguments list + /// the functions list + /// the constants list internal Expression(String expressionString, List initialTokens, List argumentsList, List functionsList, List constantsList, bool disableUlpRounding, bool UDFExpression, List UDFVariadicParamsAtRunTime) { @@ -503,24 +494,24 @@ internal Expression(String expressionString, List initialTokens, List + /// 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. + /// + /// the expression string + /// the arguments list + /// the functions list + /// the constants list + /// the marker for internal processing + /// + /// + /// + /// + /// internal Expression(String expressionString, List argumentsList, List functionsList, List constantsList ,bool i, bool UDFExpression, List UDFVariadicParamsAtRunTime) { @@ -536,11 +527,9 @@ List functionsList, List constantsList relatedExpressionsList = new List(); setExpressionModifiedFlag(); } - /** - * Private constructor - expression cloning. - * - * @param expression the base expression - */ + /// Private constructor - expression cloning. + /// + /// the base expression private Expression(Expression expression) { expressionString = "" + expression.expressionString; description = "" + expression.description; @@ -562,109 +551,93 @@ private Expression(Expression expression) { UDFVariadicParamsAtRunTime = expression.UDFVariadicParamsAtRunTime; internalClone = true; } - /** - * Sets (modifies expression) expression string. - * - * @param expressionString the expression string - */ + /// Sets (modifies expression) expression string. + /// + /// the expression string public void setExpressionString(String expressionString) { this.expressionString = expressionString; setExpressionModifiedFlag(); - } - /** - * Returns expression string - */ - public String getExpressionString() { - return expressionString; - } - /** - * Clears expression string - */ - public void clearExpressionString() { - this.expressionString = ""; - setExpressionModifiedFlag(); - } - /** - * Sets expression description. - * - * @param description the description string - */ - public void setDescription(String description) { - this.description = description; - } - /** - * Gets expression description. - * - * @return String description. - */ - public String getDescription() { - return description; - } - /** - * Clears expression description - */ - public void clearDescription() { - this.description = ""; - } - /** - * Enables verbose mode. - */ - public void setVerboseMode() { - verboseMode = true; - } - /** - * Disables verbose mode (default silent mode). - */ - public void setSilentMode() { - verboseMode = false; - } - /** - * Returns verbose mode status. - * - * @return true if verbose mode is on, - * otherwise returns false. - */ - public bool getVerboseMode() { - return verboseMode; - } - /** - * Sets recursive mode - */ - internal void setRecursiveMode() { - recursiveMode = true; - } - /** - * Disables recursive mode - */ - internal void disableRecursiveMode() { - recursiveMode = false; - } - /** - * Gets recursive mode status - * - * @return true if recursive mode is enabled, - * otherwise returns false. - */ - public bool getRecursiveMode() { - return recursiveMode; - } - /** - * Gets computing time. - * - * @return computing time in seconds. - */ - public double getComputingTime() { - return computingTime; - } - /** - * Adds user defined elements (such as: Arguments, Constants, Functions) - * to the expressions. - * - * @param elements Elements list (variadic), where Argument, Constant, Function - * extend the same class PrimitiveElement - * - * @see PrimitiveElement - */ + } + /// Returns expression string + public String getExpressionString() { + return expressionString; + } + /// Clears expression string + public void clearExpressionString() { + this.expressionString = ""; + setExpressionModifiedFlag(); + } + /// Sets expression description. + /// + /// the description string + public void setDescription(String description) { + this.description = description; + } + /// Gets expression description. + /// + /// String description. + public String getDescription() { + return description; + } + /// Clears expression description + public void clearDescription() { + this.description = ""; + } + /// Enables verbose mode. + public void setVerboseMode() { + verboseMode = true; + } + /// Disables verbose mode (default silent mode). + public void setSilentMode() { + verboseMode = false; + } + /// Returns verbose mode status. + /// + /// + /// true if verbose mode is on, + /// otherwise returns false. + /// + public bool getVerboseMode() { + return verboseMode; + } + /// Sets recursive mode + internal void setRecursiveMode() { + recursiveMode = true; + } + /// Disables recursive mode + internal void disableRecursiveMode() { + recursiveMode = false; + } + /// Gets recursive mode status + /// + /// + /// true if recursive mode is enabled, + /// otherwise returns false. + /// + public bool getRecursiveMode() { + return recursiveMode; + } + /// Gets computing time. + /// + /// computing time in seconds. + public double getComputingTime() { + return computingTime; + } + /// + /// Adds user defined elements (such as: + /// Arguments, + /// Constants, + /// Functions) + /// to the expressions. + /// + /// + /// + /// Elements list (variadic), where , + /// , + /// extend the same class + /// + /// + /// public void addDefinitions(params PrimitiveElement[] elements) { foreach (PrimitiveElement e in elements) { int elementTypeId = e.getMyTypeId(); @@ -676,15 +649,21 @@ public void addDefinitions(params PrimitiveElement[] elements) { } } } - /** - * Removes user defined elements (such as: Arguments, Constants, Functions) - * to the expressions. - * - * @param elements Elements list (variadic), where Argument, Constant, Function - * extend the same class PrimitiveElement - * - * @see PrimitiveElement - */ + /// + /// Removes user defined elements (such as: + /// Arguments, + /// Constants, + /// Functions) + /// to the expressions. + /// + /// + /// + /// Elements list (variadic), where , + /// , + /// extend the same class + /// + /// + /// public void removeDefinitions(params PrimitiveElement[] elements) { foreach (PrimitiveElement e in elements) { int elementTypeId = e.getMyTypeId(); @@ -702,559 +681,568 @@ public void removeDefinitions(params PrimitiveElement[] elements) { * *================================================= */ - /** - * Adds arguments (variadic) to the expression definition. - * - * @param arguments the arguments list - * (comma separated list) - * @see Argument - * @see RecursiveArgument - */ + /// Adds arguments (variadic) to the expression definition. + /// + /// + /// the arguments list + /// (comma separated list) + /// + /// + /// public void addArguments(params Argument[] arguments) { - foreach (Argument arg in arguments) { - if (arg != null) { - argumentsList.Add(arg); - arg.addRelatedExpression(this); - } - } - setExpressionModifiedFlag(); - } - /** - * Enables to define the arguments (associated with - * the expression) based on the given arguments names. - * - * @param argumentsNames the arguments names (variadic) - * comma separated list - * - * @see Argument - * @see RecursiveArgument - */ - public void defineArguments(params String[] argumentsNames) { - foreach (String argName in argumentsNames) { - Argument arg = new Argument(argName); - arg.addRelatedExpression(this); + foreach (Argument arg in arguments) { + if (arg != null) { argumentsList.Add(arg); + arg.addRelatedExpression(this); } - setExpressionModifiedFlag(); } - /** - * Enables to define the argument (associated with the expression) - * based on the argument name and the argument value. - * - * @param argumentName the argument name - * @param argumentValue the the argument value - * - * @see Argument - * @see RecursiveArgument - */ - public void defineArgument(String argumentName, double argumentValue) { - Argument arg = new Argument(argumentName, argumentValue); + setExpressionModifiedFlag(); + } + /// + /// Enables to define the arguments (associated with + /// the expression) based on the given arguments names. + /// + /// + /// + /// the arguments names (variadic) + /// comma separated list + /// + /// + /// + /// + public void defineArguments(params String[] argumentsNames) { + foreach (String argName in argumentsNames) { + Argument arg = new Argument(argName); arg.addRelatedExpression(this); argumentsList.Add(arg); - setExpressionModifiedFlag(); } - /** - * Gets argument index from the expression. - * - * @param argumentName the argument name - * - * @return The argument index if the argument name was found, - * otherwise returns Argument.NOT_FOUND - * - * @see Argument - * @see RecursiveArgument - */ - public int getArgumentIndex(String argumentName) { - int argumentsNumber = argumentsList.Count; - if (argumentsNumber > 0) { - int argumentIndex = 0; - int searchResult = NOT_FOUND; - while ((argumentIndex < argumentsNumber)&&(searchResult == NOT_FOUND)) { - if (argumentsList[argumentIndex].getArgumentName().Equals(argumentName)) - searchResult = FOUND; - else - argumentIndex++; - } - if (searchResult == FOUND) - return argumentIndex; + setExpressionModifiedFlag(); + } + /// + /// Enables to define the argument (associated with the expression) + /// based on the argument name and the argument value. + /// + /// + /// the argument name + /// the the argument value + /// + /// + /// + public void defineArgument(String argumentName, double argumentValue) { + Argument arg = new Argument(argumentName, argumentValue); + arg.addRelatedExpression(this); + argumentsList.Add(arg); + setExpressionModifiedFlag(); + } + /// Gets argument index from the expression. + /// + /// the argument name + /// + /// + /// The argument index if the argument name was found, + /// otherwise returns + /// + /// + /// + /// + public int getArgumentIndex(String argumentName) { + int argumentsNumber = argumentsList.Count; + if (argumentsNumber > 0) { + int argumentIndex = 0; + int searchResult = NOT_FOUND; + while ((argumentIndex < argumentsNumber)&&(searchResult == NOT_FOUND)) { + if (argumentsList[argumentIndex].getArgumentName().Equals(argumentName)) + searchResult = FOUND; else - return NOT_FOUND; - } else - return NOT_FOUND; - } - /** - * Gets argument from the expression. - * - * - * @param argumentName the argument name - * - * @return The argument if the argument name was found, - * otherwise returns null. - * - * @see Argument - * @see RecursiveArgument - */ - public Argument getArgument(String argumentName) { - int argumentIndex = getArgumentIndex(argumentName); - if (argumentIndex == NOT_FOUND) - return null; - else - return argumentsList[argumentIndex]; - } - /** - * Gets argument from the expression. - * - * @param argumentIndex the argument index - * - * @return Argument if the argument index is between 0 and - * the last available argument index (getArgumentsNumber()-1), - * otherwise returns null. - * - * @see Argument - * @see RecursiveArgument - */ - public Argument getArgument(int argumentIndex) { - if ( (argumentIndex < 0) || (argumentIndex >= argumentsList.Count) ) - return null; + argumentIndex++; + } + if (searchResult == FOUND) + return argumentIndex; else - return argumentsList[argumentIndex]; - } - /** - * Gets number of arguments associated with the expression. - * - * @return The number of arguments (int >= 0) - * - * @see Argument - * @see RecursiveArgument - */ - public int getArgumentsNumber() { - return argumentsList.Count; - } - /** - * Sets argument value. - * - * @param argumentName the argument name - * @param argumentValue the argument value - */ - public void setArgumentValue(String argumentName, double argumentValue) { - int argumentIndex = getArgumentIndex(argumentName); - if (argumentIndex != NOT_FOUND) - argumentsList[argumentIndex].setArgumentValue(argumentValue); - } - /** - * Gets argument vale. - * - * @param argumentName the argument name - * - * @return Argument value if argument name was found, - * otherwise return Double.NaN. - */ - public double getArgumentValue(String argumentName) { + return NOT_FOUND; + } else + return NOT_FOUND; + } + /// Gets argument from the expression. + /// + /// the argument name + /// + /// + /// The argument if the argument name was found, + /// otherwise returns null. + /// + /// + /// + /// + public Argument getArgument(String argumentName) { + int argumentIndex = getArgumentIndex(argumentName); + if (argumentIndex == NOT_FOUND) + return null; + else + return argumentsList[argumentIndex]; + } + /// Gets argument from the expression. + /// + /// the argument index + /// + /// + /// Argument if the argument index is between 0 and + /// the last available argument index (-1), + /// otherwise returns null. + /// + /// + /// + /// + public Argument getArgument(int argumentIndex) { + if ( (argumentIndex < 0) || (argumentIndex >= argumentsList.Count) ) + return null; + else + return argumentsList[argumentIndex]; + } + /// Gets number of arguments associated with the expression. + /// + /// The number of arguments (int >= 0) + /// + /// + /// + public int getArgumentsNumber() { + return argumentsList.Count; + } + /// Sets argument value. + /// + /// the argument name + /// the argument value + public void setArgumentValue(String argumentName, double argumentValue) { + int argumentIndex = getArgumentIndex(argumentName); + if (argumentIndex != NOT_FOUND) + argumentsList[argumentIndex].setArgumentValue(argumentValue); + } + /// Gets argument vale. + /// + /// the argument name + /// + /// + /// Argument value if argument name was found, + /// otherwise return . + /// + public double getArgumentValue(String argumentName) { + int argumentIndex = getArgumentIndex(argumentName); + if (argumentIndex != NOT_FOUND) + return argumentsList[argumentIndex].getArgumentValue(); + else + return Double.NaN; + } + /// + /// Removes first occurrences of the arguments + /// associated with the expression. + /// + /// + /// + /// the arguments names + /// (variadic parameters) comma separated + /// list + /// + /// + /// + /// + public void removeArguments(params String[] argumentsNames) { + foreach (String argumentName in argumentsNames) { int argumentIndex = getArgumentIndex(argumentName); - if (argumentIndex != NOT_FOUND) - return argumentsList[argumentIndex].getArgumentValue(); - else - return Double.NaN; - } - /** - * Removes first occurrences of the arguments - * associated with the expression. - * - * @param argumentsNames the arguments names - * (variadic parameters) comma separated - * list - * - * @see Argument - * @see RecursiveArgument - */ - public void removeArguments(params String[] argumentsNames) { - foreach (String argumentName in argumentsNames) { - int argumentIndex = getArgumentIndex(argumentName); - if (argumentIndex != NOT_FOUND) { - Argument arg = argumentsList[argumentIndex]; - arg.removeRelatedExpression(this); - argumentsList.RemoveAt(argumentIndex); - } + if (argumentIndex != NOT_FOUND) { + Argument arg = argumentsList[argumentIndex]; + arg.removeRelatedExpression(this); + argumentsList.RemoveAt(argumentIndex); } - setExpressionModifiedFlag(); } - /** - * Removes first occurrences of the arguments - * associated with the expression. - * - * @param arguments the arguments (variadic parameters) - * comma separated list - * - * @see Argument - * @see RecursiveArgument - */ - public void removeArguments(params Argument[] arguments) { - foreach (Argument argument in arguments) { - if (argument != null) { - argumentsList.Remove(argument); - argument.removeRelatedExpression(this); - } + setExpressionModifiedFlag(); + } + /// + /// Removes first occurrences of the arguments + /// associated with the expression. + /// + /// + /// + /// the arguments (variadic parameters) + /// comma separated list + /// + /// + /// + /// + public void removeArguments(params Argument[] arguments) { + foreach (Argument argument in arguments) { + if (argument != null) { + argumentsList.Remove(argument); + argument.removeRelatedExpression(this); } - setExpressionModifiedFlag(); } - /** - * Removes all arguments associated with the expression. - * - * @see Argument - * @see RecursiveArgument - */ - public void removeAllArguments() { - foreach (Argument arg in argumentsList) - arg.removeRelatedExpression(this); - argumentsList.Clear(); - setExpressionModifiedFlag(); - } - /*================================================= - * - * Constants handling API - * - *================================================= - */ - /** - * Adds constants (variadic parameters) to the expression definition. - * - * @param constants the constants - * (comma separated list) - * - * @see Constant - */ - public void addConstants(params Constant[] constants) { - foreach (Constant constant in constants) { - if (constant != null) { - constantsList.Add(constant); - constant.addRelatedExpression(this); - } + setExpressionModifiedFlag(); + } + /// emoves all arguments associated with the expression. + /// + /// + /// + public void removeAllArguments() { + foreach (Argument arg in argumentsList) + arg.removeRelatedExpression(this); + argumentsList.Clear(); + setExpressionModifiedFlag(); + } + /*================================================= + * + * Constants handling API + * + *================================================= + */ + /// Adds constants (variadic parameters) to the expression definition. + /// + /// + /// the constants + /// (comma separated list) + /// + /// + /// + public void addConstants(params Constant[] constants) { + foreach (Constant constant in constants) { + if (constant != null) { + constantsList.Add(constant); + constant.addRelatedExpression(this); } - setExpressionModifiedFlag(); } - /** - * Enables to define the constant (associated with - * the expression) based on the constant name and - * constant value. - * - * @param constantName the constant name - * @param constantValue the constant value - * - * @see Constant - */ - public void defineConstant(String constantName, double constantValue) { - Constant c = new Constant(constantName, constantValue); - c.addRelatedExpression(this); - constantsList.Add(c); - setExpressionModifiedFlag(); - } - /** - * Gets constant index associated with the expression. - * - * @param constantName the constant name - * - * @return Constant index if constant name was found, - * otherwise return Constant.NOT_FOUND. - * - * @see Constant - */ - public int getConstantIndex(String constantName) { - int constantsNumber = constantsList.Count; - if (constantsNumber > 0) { - int constantIndex = 0; - int searchResult = NOT_FOUND; - while ((constantIndex < constantsNumber)&&(searchResult == NOT_FOUND)) { - if (constantsList[constantIndex].getConstantName().Equals(constantName)) - searchResult = FOUND; - else - constantIndex++; - } - if (searchResult == FOUND) - return constantIndex; + setExpressionModifiedFlag(); + } + /// + /// Enables to define the constant (associated with + /// the expression) based on the constant name and + /// constant value. + /// + /// + /// the constant name + /// the constant value + /// + /// + public void defineConstant(String constantName, double constantValue) { + Constant c = new Constant(constantName, constantValue); + c.addRelatedExpression(this); + constantsList.Add(c); + setExpressionModifiedFlag(); + } + /// Gets constant index associated with the expression. + /// + /// the constant name + /// + /// + /// Constant index if constant name was found, + /// otherwise return . + /// + /// + /// + public int getConstantIndex(String constantName) { + int constantsNumber = constantsList.Count; + if (constantsNumber > 0) { + int constantIndex = 0; + int searchResult = NOT_FOUND; + while ((constantIndex < constantsNumber)&&(searchResult == NOT_FOUND)) { + if (constantsList[constantIndex].getConstantName().Equals(constantName)) + searchResult = FOUND; else - return NOT_FOUND; - } else + constantIndex++; + } + if (searchResult == FOUND) + return constantIndex; + else return NOT_FOUND; - } - /** - * Gets constant associated with the expression. - * - * @param constantName the constant name - * - * @return Constant if constant name was found, - * otherwise return null. - * - * @see Constant - */ - public Constant getConstant(String constantName) { + } else + return NOT_FOUND; + } + /// Gets constant associated with the expression. + /// + /// the constant name + /// + /// + /// Constant if constant name was found, + /// otherwise return null. + /// + /// + /// + public Constant getConstant(String constantName) { + int constantIndex = getConstantIndex(constantName); + if (constantIndex == NOT_FOUND) + return null; + else + return constantsList[constantIndex]; + } + /// Gets constant associated with the expression. + /// + /// the constant index + /// + /// + /// Constant if the is between + /// 0 and the last available constant index + /// ( - 1), + /// otherwise it returns null. + /// + /// + /// + public Constant getConstant(int constantIndex) { + if ( (constantIndex < 0) || (constantIndex >= constantsList.Count) ) + return null; + else + return constantsList[constantIndex]; + } + /// Gets number of constants associated with the expression. + /// + /// number of constants (int >= 0) + /// + /// + public int getConstantsNumber() { + return constantsList.Count; + } + /// + /// Removes first occurrences of the constants + /// associated with the expression. + /// + /// + /// + /// the constants names (variadic parameters) + /// comma separated list + /// + /// + /// + public void removeConstants(params String[] constantsNames) { + foreach (String constantName in constantsNames) { int constantIndex = getConstantIndex(constantName); - if (constantIndex == NOT_FOUND) - return null; - else - return constantsList[constantIndex]; - } - /** - * Gets constant associated with the expression. - * - * @param constantIndex the constant index - * - * @return Constant if the constantIndex is between - * 0 and the last available constant index - * (getConstantsNumber() - 1), - * otherwise it returns null. - * - * @see Constant - */ - public Constant getConstant(int constantIndex) { - if ( (constantIndex < 0) || (constantIndex >= constantsList.Count) ) - return null; - else - return constantsList[constantIndex]; - } - /** - * Gets number of constants associated with the expression. - * - * @return number of constants (int >= 0) - * - * @see Constant - */ - public int getConstantsNumber() { - return constantsList.Count; - } - /** - * Removes first occurrences of the constants - * associated with the expression. - * - * @param constantsNames the constants names (variadic parameters) - * comma separated list - * - * @see Constant - */ - public void removeConstants(params String[] constantsNames) { - foreach (String constantName in constantsNames) { - int constantIndex = getConstantIndex(constantName); - if (constantIndex != NOT_FOUND) { - Constant c = constantsList[constantIndex]; - c.removeRelatedExpression(this); - constantsList.RemoveAt( constantIndex ); - } + if (constantIndex != NOT_FOUND) { + Constant c = constantsList[constantIndex]; + c.removeRelatedExpression(this); + constantsList.RemoveAt( constantIndex ); } - setExpressionModifiedFlag(); } - /** - * Removes first occurrences of the constants - * associated with the expression - * - * @param constants the constants (variadic parameters) - * comma separated list - * - * @see Constant - */ - public void removeConstants(params Constant[] constants) { - foreach (Constant constant in constants) { - if (constant != null) { - constantsList.Remove(constant); - constant.removeRelatedExpression(this); - setExpressionModifiedFlag(); - } + setExpressionModifiedFlag(); + } + /// + /// Removes first occurrences of the constants + /// associated with the expression + /// + /// + /// + /// the constants (variadic parameters) + /// comma separated list + /// + /// + /// + public void removeConstants(params Constant[] constants) { + foreach (Constant constant in constants) { + if (constant != null) { + constantsList.Remove(constant); + constant.removeRelatedExpression(this); + setExpressionModifiedFlag(); } } - /** - * Removes all constants - * associated with the expression - * - * @see Constant - */ - public void removeAllConstants() { - foreach (Constant c in constantsList) - c.removeRelatedExpression(this); - constantsList.Clear(); - setExpressionModifiedFlag(); - } - /*================================================= - * - * Functions handling API - * - *================================================= - */ - /** - * Adds functions (variadic parameters) to the expression definition. - * - * @param functions the functions - * (variadic parameters) comma separated list - * - * @see Function - */ - public void addFunctions(params Function[] functions) { - foreach (Function f in functions) { - if (f != null) { - functionsList.Add(f); - if (f.getFunctionBodyType() == Function.BODY_RUNTIME) - f.addRelatedExpression(this); - } + } + /// + /// Removes all constants + /// associated with the expression + /// + /// + /// + public void removeAllConstants() { + foreach (Constant c in constantsList) + c.removeRelatedExpression(this); + constantsList.Clear(); + setExpressionModifiedFlag(); + } + /*================================================= + * + * Functions handling API + * + *================================================= + */ + /// Adds functions (variadic parameters) to the expression definition. + /// + /// + /// the functions + /// (variadic parameters) comma separated list + /// + /// + /// + public void addFunctions(params Function[] functions) { + foreach (Function f in functions) { + if (f != null) { + functionsList.Add(f); + if (f.getFunctionBodyType() == Function.BODY_RUNTIME) + f.addRelatedExpression(this); } - setExpressionModifiedFlag(); } - /** - * Enables to define the function (associated with - * the expression) based on the function name, - * function expression string and arguments names (variadic parameters). - * - * @param functionName the function name - * @param functionExpressionString the expression string - * @param argumentsNames the function arguments names - * (variadic parameters) - * comma separated list - * - * @see Function - */ - public void defineFunction(String functionName, String functionExpressionString, - params String[] argumentsNames) { - Function f = new Function(functionName, functionExpressionString, argumentsNames); - functionsList.Add(f); - f.addRelatedExpression(this); - setExpressionModifiedFlag(); - } - /** - * Gets index of function associated with the expression. - * - * @param functionName the function name - * - * @return Function index if function name was found, - * otherwise returns Function.NOT_FOUND - * - * @see Function - */ - public int getFunctionIndex(String functionName) { - int functionsNumber = functionsList.Count; - if (functionsNumber > 0) { - int functionIndex = 0; - int searchResult = NOT_FOUND; - while ((functionIndex < functionsNumber) - && (searchResult == NOT_FOUND)) { - if (functionsList[functionIndex].getFunctionName(). - Equals(functionName)) - searchResult = FOUND; - else - functionIndex++; - } - if (searchResult == FOUND) - return functionIndex; + setExpressionModifiedFlag(); + } + /// + /// Enables to define the function (associated with + /// the expression) based on the function name, + /// function expression string and arguments names (variadic parameters). + /// + /// + /// the function name + /// the expression string + /// + /// the function arguments names + /// (variadic parameters) + /// comma separated list + /// + /// + /// + public void defineFunction(String functionName, String functionExpressionString, + params String[] argumentsNames) { + Function f = new Function(functionName, functionExpressionString, argumentsNames); + functionsList.Add(f); + f.addRelatedExpression(this); + setExpressionModifiedFlag(); + } + /// Gets index of function associated with the expression. + /// + /// the function name + /// + /// + /// Function index if function name was found, + /// otherwise returns + /// + /// + /// + public int getFunctionIndex(String functionName) { + int functionsNumber = functionsList.Count; + if (functionsNumber > 0) { + int functionIndex = 0; + int searchResult = NOT_FOUND; + while ((functionIndex < functionsNumber) + && (searchResult == NOT_FOUND)) { + if (functionsList[functionIndex].getFunctionName(). + Equals(functionName)) + searchResult = FOUND; else - return NOT_FOUND; - } else + functionIndex++; + } + if (searchResult == FOUND) + return functionIndex; + else return NOT_FOUND; - } - /** - * Gets function associated with the expression. - * - * @param functionName the function name - * - * @return Function if function name was found, - * otherwise returns null. - * - * @see Function - */ - public Function getFunction(String functionName) { + } else + return NOT_FOUND; + } + /// Gets function associated with the expression. + /// + /// the function name + /// + /// + /// Function if function name was found, + /// otherwise returns null. + /// + /// + /// + public Function getFunction(String functionName) { + int functionIndex = getFunctionIndex(functionName); + if (functionIndex == NOT_FOUND) + return null; + else + return functionsList[functionIndex]; + } + /// Gets function associated with the expression. + /// + /// functionIndex the function index + /// + /// + /// Function if function index is between 0 and + /// the last available function index (-1), + /// otherwise returns null. + /// + /// + /// + public Function getFunction(int functionIndex) { + if ( (functionIndex < 0) || (functionIndex >= functionsList.Count) ) + return null; + else + return functionsList[functionIndex]; + } + /// Gets number of functions associated with the expression. + /// + /// number of functions (int >= 0) + /// + /// + public int getFunctionsNumber() { + return functionsList.Count; + } + /// + /// Removes first occurrences of the functions + /// associated with the expression. + /// + /// + /// + /// the functions names (variadic parameters) + /// comma separated list + /// + /// + /// + public void removeFunctions(params String[] functionsNames) { + foreach (String functionName in functionsNames) { int functionIndex = getFunctionIndex(functionName); - if (functionIndex == NOT_FOUND) - return null; - else - return functionsList[functionIndex]; - } - /** - * Gets function associated with the expression. - * - * @param functionIndex the function index - * - * @return Function if function index is between 0 and - * the last available function index (getFunctionsNumber()-1), - * otherwise returns null. - * - * @see Function - */ - public Function getFunction(int functionIndex) { - if ( (functionIndex < 0) || (functionIndex >= functionsList.Count) ) - return null; - else - return functionsList[functionIndex]; - } - /** - * Gets number of functions associated with the expression. - * - * @return number of functions (int >= 0) - * - * @see Function - */ - public int getFunctionsNumber() { - return functionsList.Count; - } - /** - * Removes first occurrences of the functions - * associated with the expression. - * - * @param functionsNames the functions names (variadic parameters) - * comma separated list - * - * @see Function - */ - public void removeFunctions(params String[] functionsNames) { - foreach (String functionName in functionsNames) { - int functionIndex = getFunctionIndex(functionName); - if (functionIndex != NOT_FOUND) { - Function f = functionsList[functionIndex]; - f.removeRelatedExpression(this); - functionsList.Remove(f); - } - } - setExpressionModifiedFlag(); - } - /** - * Removes first occurrences of the functions - * associated with the expression. - * - * @param functions the functions (variadic parameters) - * comma separated list. - * - * @see Function - */ - public void removeFunctions(params Function[] functions) { - foreach (Function function in functions) { - if (function != null) { - function.removeRelatedExpression(this); - functionsList.Remove(function); - } + if (functionIndex != NOT_FOUND) { + Function f = functionsList[functionIndex]; + f.removeRelatedExpression(this); + functionsList.Remove(f); } - setExpressionModifiedFlag(); } - /** - * Removes all functions - * associated with the expression. - * - * @see Function - */ - public void removeAllFunctions() { - foreach (Function f in functionsList) - f.removeRelatedExpression(this); - functionsList.Clear(); - setExpressionModifiedFlag(); + setExpressionModifiedFlag(); + } + /// + /// Removes first occurrences of the functions + /// associated with the expression. + /// + /// + /// + /// the functions (variadic parameters) + /// comma separated list. + /// + /// + /// + public void removeFunctions(params Function[] functions) { + foreach (Function function in functions) { + if (function != null) { + function.removeRelatedExpression(this); + functionsList.Remove(function); + } } + setExpressionModifiedFlag(); + } + /// + /// Removes all functions + /// associated with the expression. + /// + /// + /// + public void removeAllFunctions() { + foreach (Function f in functionsList) + f.removeRelatedExpression(this); + functionsList.Clear(); + setExpressionModifiedFlag(); + } /*================================================= * * Common methods (supporting calculations) * *================================================= */ - /** - * Sets given token to the number type / value. - * Method should be called only by the SetDecreaseRemove like methods - * - * @param pos the position on which token - * should be updated to the given number - * @param number the number - * @param ulpRound If true, then if {@link mXparser#ulpRounding} = true - * intelligent ULP rounding is applied. - */ + /// + /// Sets given token to the number type / value. + /// Method should be called only by the SetDecreaseRemove like methods + /// + /// + /// + /// the position on which token + /// should be updated to the given number + /// + /// the number + /// + /// If true, then if = true + /// intelligent ULP rounding is applied. + /// private void setToNumber(int pos, double number, bool ulpRound) { Token token = tokensList[pos]; if ((mXparser.ulpRounding) && (disableUlpRounding == false)) { @@ -1281,59 +1269,77 @@ private void setToNumber(int pos, double number, bool ulpRound) { private void setToNumber(int pos, double number) { setToNumber(pos, number, false); } - /** - * 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 - * - * @param pos the position on which token - * should be updated to the given number - * @param result the number - * @param ulpRound If true, then if {@link mXparser#ulpRounding} = true - * intelligent ULP rounding is applied. - */ + /// + /// 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 + /// + /// Set token type to number type / value + /// Decrease level of the token + /// 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 + /// + /// + /// Set cos token to 1 (pos=2, result=1): + /// + /// idx : 0 1 2 3 + /// token : 1 + 1 0 + /// level : 0 0 1 2 + /// + /// + /// + /// + /// Decrease level (pos=2): + /// + /// idx : 0 1 2 3 + /// token : 1 + 1 0 + /// level : 0 0 0 2 + /// + /// + /// + /// + /// Remove no longer needed tokens (pos+1=3): + /// + /// idx : 0 1 2 + /// token : 1 + 1 + /// level : 0 0 0 + /// + /// + /// + /// + /// + /// the position on which token + /// should be updated to the given number + /// + /// the number + /// + /// If true, then if = true + /// intelligent ULP rounding is applied. + /// private void f1SetDecreaseRemove(int pos, double result, bool ulpRound) { setToNumber(pos, result, ulpRound); tokensList[pos].tokenLevel--; @@ -1342,19 +1348,23 @@ private void f1SetDecreaseRemove(int pos, double result, bool ulpRound) { private void f1SetDecreaseRemove(int pos, double result) { f1SetDecreaseRemove(pos, result, false); } - /** - * SetDecreaseRemove for 2-args functions - * - * For detailed specification refer to the - * f1SetDecreaseRemove() - * - * @param pos the position on which token - * should be updated to the given number - * @param result the number - * @param ulpRound If true, then if {@link mXparser#ulpRounding} = true - * intelligent ULP rounding is applied. - */ - private void f2SetDecreaseRemove(int pos, double result, bool ulpRound) { + /// SetDecreaseRemove for 2-args functions + /// + /// For detailed specification refer to the + /// + /// + /// + /// the position on which token + /// should be updated to the given number + /// + /// the number + /// + /// If true, then if = true + /// intelligent ULP rounding is applied. + /// + /// + /// + private void f2SetDecreaseRemove(int pos, double result, bool ulpRound) { setToNumber(pos, result, ulpRound); tokensList[pos].tokenLevel--; tokensList.RemoveAt(pos+2); @@ -1363,18 +1373,22 @@ private void f2SetDecreaseRemove(int pos, double result, bool ulpRound) { private void f2SetDecreaseRemove(int pos, double result) { f2SetDecreaseRemove(pos, result, false); } - /** - * SetDecreaseRemove for 3-args functions - * - * For detailed specification refer to the - * f1SetDecreaseRemove() - * - * @param pos the position on which token - * should be updated to the given number - * @param result the number - * @param ulpRound If true, then if {@link mXparser#ulpRounding} = true - * intelligent ULP rounding is applied. - */ + /// SetDecreaseRemove for 3-args functions + /// + /// For detailed specification refer to the + /// + /// + /// + /// the position on which token + /// should be updated to the given number + /// + /// the number + /// + /// If true, then if = true + /// intelligent ULP rounding is applied. + /// + /// + /// private void f3SetDecreaseRemove(int pos, double result, bool ulpRound) { setToNumber(pos, result, ulpRound); tokensList[pos].tokenLevel--; @@ -1385,18 +1399,22 @@ private void f3SetDecreaseRemove(int pos, double result, bool ulpRound) { private void f3SetDecreaseRemove(int pos, double result) { f3SetDecreaseRemove(pos, result, false); } - /** - * SetDecreaseRemove for operators - * - * For detailed specification refer to the - * f1SetDecreaseRemove() - * - * @param pos the position on which token - * should be updated to the given number - * @param result the number - * @param ulpRound If true, then if {@link mXparser#ulpRounding} = true - * intelligent ULP rounding is applied. - */ + /// SetDecreaseRemove for operators + /// + /// For detailed specification refer to the + /// + /// + /// + /// the position on which token + /// should be updated to the given number + /// + /// the number + /// + /// If true, then if = true + /// intelligent ULP rounding is applied. + /// + /// + /// private void opSetDecreaseRemove(int pos, double result, bool ulpRound) { setToNumber(pos, result, ulpRound); tokensList.RemoveAt(pos+1); @@ -1405,18 +1423,22 @@ private void opSetDecreaseRemove(int pos, double result, bool ulpRound) { private void opSetDecreaseRemove(int pos, double result) { opSetDecreaseRemove(pos, result, false); } - /** - * SetDecreaseRemove for calculus operators. - * - * For detailed specification refer to the - * f1SetDecreaseRemove() - * - * @param pos the position on which token - * should be updated to the given number - * @param result the number - * @param ulpRound If true, then if {@link mXparser#ulpRounding} = true - * intelligent ULP rounding is applied. - */ + /// SetDecreaseRemove for calculus operators + /// + /// For detailed specification refer to the + /// + /// + /// + /// the position on which token + /// should be updated to the given number + /// + /// the number + /// + /// If true, then if = true + /// intelligent ULP rounding is applied. + /// + /// + /// private void calcSetDecreaseRemove(int pos, double result, bool ulpRound) { setToNumber(pos, result, ulpRound); tokensList[pos].tokenLevel--; @@ -1438,19 +1460,23 @@ private void calcSetDecreaseRemove(int pos, double result, bool ulpRound) { private void calcSetDecreaseRemove(int pos, double result) { calcSetDecreaseRemove(pos, result, false); } - /** - * SetDecreaseRemove for special functions. - * - * For detailed specification refer to the - * f1SetDecreaseRemove() - * - * @param pos the position on which token - * should be updated to the given number - * @param result the number - * @param length the special function range - * @param ulpRound If true, then if {@link mXparser#ulpRounding} = true - * intelligent ULP rounding is applied. - */ + /// SetDecreaseRemove for special functions + /// + /// For detailed specification refer to the + /// + /// + /// + /// the position on which token + /// should be updated to the given number + /// + /// the number + /// the special function range + /// + /// If true, then if = true + /// intelligent ULP rounding is applied. + /// + /// + /// private void variadicSetDecreaseRemove(int pos, double value, int length, bool ulpRound) { setToNumber(pos, value, ulpRound); tokensList[pos].tokenLevel--; @@ -1460,15 +1486,18 @@ private void variadicSetDecreaseRemove(int pos, double value, int length, bool u private void variadicSetDecreaseRemove(int pos, double value, int length) { variadicSetDecreaseRemove(pos, value, length, false); } - /** - * If set remove method for the if function. - * - * @param pos the position - * @param ifCondition the result of if condition - * @param ulpRound If true, then if {@link mXparser#ulpRounding} = true - * intelligent ULP rounding is applied. - */ - private void ifSetRemove(int pos, double ifCondition, bool ulpRound) { + /// If set remove method for the if function. + /// + /// + /// the position on which token + /// should be updated to the given number + /// + /// the number + /// + /// If true, then if = true + /// intelligent ULP rounding is applied. + /// + private void ifSetRemove(int pos, double ifCondition, bool ulpRound) { /* * left parethesis position */ @@ -1531,14 +1560,12 @@ private void removeTokens(int from, int to) { private void ifSetRemove(int pos, double ifCondition) { ifSetRemove(pos, ifCondition, false); } - /** - * Creates string tokens list from the subexpression. - * - * @param startPos start position (index) - * @param endPos end position (index) - * - * @return tokens list representing requested subexpression. - */ + /// Creates string tokens list from the subexpression. + /// + /// start position (index) + /// end position (index) + /// + /// tokens list representing requested subexpression. private List createInitialTokens(int startPos, int endPos, List tokensList) { @@ -1550,11 +1577,9 @@ private List createInitialTokens(int startPos, } return tokens; } - /** - * Return number of functions parameters. - * - * @param pos the function position - */ + /// Return number of functions parameters. + /// + /// the function position private int getParametersNumber(int pos) { int lPpos = pos+1; if (lPpos == initialTokens.Count) @@ -1586,16 +1611,14 @@ private int getParametersNumber(int pos) { return -1; } } - /** - * Returns list of the functions parameters. - * - * @param pos the function position - * @param tokensList the tokens checkSYnt - * - * @return the list of function parameters - * - * @see FunctionParameter - */ + /// Returns list of the functions parameters. + /// + /// the function position + /// the tokens checkSYnt + /// + /// the list of function parameters + /// + /// private List getFunctionParameters(int pos, List tokensList) { List functionParameters = new List(); int cPos = pos+2; @@ -1636,20 +1659,19 @@ private List getFunctionParameters(int pos, List token } while (!end); return functionParameters; } - /** - * Gets / returns argument representing given argument name. If - * argument name exists on the list of known arguments - * the the initial status of the found argument is remembered, otherwise new - * argument will be created. - * - * @param argumentName the argument name - * - * @return Argument parameter representing given argument name: - * - * - * @see ArgumentParameter - * @see Argument - */ + /// + /// Gets / returns argument representing given argument name. If + /// argument name exists on the list of known arguments + /// the the initial status of the found argument is remembered, otherwise new + /// argument will be created. + /// + /// + /// the argument name + /// + /// Argument parameter representing given argument name + /// + /// + /// private ArgumentParameter getParamArgument(String argumentName) { ArgumentParameter argParam = new ArgumentParameter(); argParam.index = getArgumentIndex(argumentName); @@ -1668,11 +1690,9 @@ private ArgumentParameter getParamArgument(String argumentName) { } return argParam; } - /** - * Clears argument parameter. - * - * @param argParam the argument parameter. - */ + /// Clears argument parameter. + /// + /// the argument parameter. private void clearParamArgument(ArgumentParameter argParam) { if (argParam.presence == NOT_FOUND) argumentsList.RemoveAt(argParam.index); @@ -1687,11 +1707,9 @@ private void clearParamArgument(ArgumentParameter argParam) { * *================================================= */ - /** - * Free Arguments handling. - * - * @param pos the token position - */ + /// Free Arguments handling. + /// + /// the token position private void FREE_ARGUMENT(int pos) { Argument argument = argumentsList[ tokensList[pos].tokenId ]; bool argumentVerboseMode = argument.getVerboseMode(); @@ -1701,11 +1719,9 @@ private void FREE_ARGUMENT(int pos) { if (argumentVerboseMode == false) argument.setSilentMode(); } - /** - * Dependent Arguments handling. - * - * @param pos the token position - */ + /// Dependent Arguments handling. + /// + /// the token position private void DEPENDENT_ARGUMENT(int pos) { Argument argument = argumentsList[ tokensList[pos].tokenId ]; bool argumentVerboseMode = argument.getVerboseMode(); @@ -1734,11 +1750,9 @@ private void DEPENDENT_ARGUMENT(int pos) { if (argumentVerboseMode == false) argument.setSilentMode(); } - /** - * User functions handling. - * - * @param pos the token position - */ + /// User functions handling. + /// + /// the token position private void USER_FUNCTION(int pos) { Function function; Function fun = functionsList[ tokensList[pos].tokenId ]; @@ -1792,20 +1806,16 @@ private void USER_FUNCTION(int pos) { if (functionVerboseMode == false) function.setSilentMode(); } - /** - * User constants handling. - * - * @param pos the token position - */ + /// User constants handling. + /// + /// the token position private void USER_CONSTANT(int pos) { Constant constant = constantsList[ tokensList[pos].tokenId ]; setToNumber(pos, constant.getConstantValue()); } - /** - * Recursive arguments handling. - * - * @param pos the token position - */ + /// Recursive arguments handling. + /// + /// the token position private void RECURSIVE_ARGUMENT(int pos) { double index = tokensList[pos+1].tokenValue; RecursiveArgument argument = (RecursiveArgument)argumentsList[ tokensList[pos].tokenId ]; @@ -1817,11 +1827,9 @@ private void RECURSIVE_ARGUMENT(int pos) { if (argumentVerboseMode == false) argument.setSilentMode(); } - /** - * Constants handling. - * - * @param pos the token position - */ + /// Constants handling. + /// + /// the token position private void CONSTANT(int pos) { double constValue = Double.NaN; switch (tokensList[pos].tokenId) { @@ -2098,11 +2106,9 @@ private void CONSTANT(int pos) { } setToNumber(pos, constValue); } - /** - * Constants handling. - * - * @param pos the token position - */ + /// Constants handling. + /// + /// the token position private void UNIT(int pos) { double unitValue = Double.NaN; switch (tokensList[pos].tokenId) { @@ -2406,11 +2412,9 @@ private void UNIT(int pos) { } setToNumber(pos, unitValue); } - /** - * Random Variables handling. - * - * @param pos the token position - */ + /// Random Variables handling. + /// + /// the token position private void RANDOM_VARIABLE(int pos) { double rndVar = Double.NaN; switch (tokensList[pos].tokenId) { @@ -2513,71 +2517,58 @@ private void RANDOM_VARIABLE(int pos) { } setToNumber(pos, rndVar); } - /** - * Gets token value - * @param tokenIndex the token index - * - * @return the token value - */ + /// Gets token value + /// + /// the token index + /// + /// the token value private double getTokenValue(int tokenIndex) { return tokensList[tokenIndex].tokenValue; } - /** - * Tetration handling. - * - * @param pos the token position - */ + /// Tetration handling. + /// + /// the token position private void TETRATION(int pos) { double a = getTokenValue(pos - 1); double n = getTokenValue(pos + 1); opSetDecreaseRemove(pos, MathFunctions.tetration(a, n), true); } - /** - * Power handling. - * - * @param pos the token position - */ + /// Power handling. + /// + /// the token position private void POWER(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, MathFunctions.power(a, b), true); } - /** - * Modulo handling. - * - * @param pos the token position - */ - private void MODULO(int pos) { + /// Modulo handling. + /// + /// the token position + private void MODULO(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, MathFunctions.mod(a, b) ); } - /** - * Division handling. - * - * @param pos the token position - */ - private void DIVIDE(int pos) { + /// Division handling. + /// + /// the token position + private void DIVIDE(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, MathFunctions.div(a, b), true); } - /** - * Multiplication handling. - * - * @param pos the token position - */ - private void MULTIPLY(int pos) { + /// Multiplication handling. + /// + /// the token position + private void MULTIPLY(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, a * b, true); } - /** - * Addition handling. - * - * @param pos the token position - */ - private void PLUS(int pos) { + /// Addition handling. + /// + /// the token position + private void PLUS(int pos) { Token b = tokensList[pos+1]; if (pos>0) { Token a = tokensList[pos-1]; @@ -2594,12 +2585,10 @@ private void PLUS(int pos) { tokensList.RemoveAt(pos+1); } } - /** - * Subtraction handling - * - * @param pos the token position - */ - private void MINUS(int pos) { + /// Subtraction handling + /// + /// the token position + private void MINUS(int pos) { Token b = tokensList[pos+1]; if (pos>0) { Token a = tokensList[pos-1]; @@ -2616,864 +2605,688 @@ private void MINUS(int pos) { tokensList.RemoveAt(pos+1); } } - /** - * Logical AND - * - * @param pos the token position - */ - private void AND(int pos) { + /// Logical AND + /// + /// the token position + private void AND(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.and(a, b) ); } - /** - * Logical OR - * - * @param pos the token position - */ - private void OR(int pos) { + /// Logical OR + /// + /// the token position + private void OR(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.or(a, b) ); } - /** - * Logical NAND - * - * @param pos the token position - */ - private void NAND(int pos) { + /// Logical NAND + /// + /// the token position + private void NAND(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.nand(a, b) ); } - /** - * Logical NOR - * - * @param pos the token position - */ - private void NOR(int pos) { + /// Logical NOR + /// + /// the token position + private void NOR(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.nor(a, b) ); } - /** - * Logical XOR - * - * - * @param pos the token position - */ - private void XOR(int pos) { + /// Logical XOR + /// + /// the token position + private void XOR(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.xor(a, b) ); } - /** - * Logical IMP - * - * - * @param pos the token position - */ - private void IMP(int pos) { + /// Logical IMP + /// + /// the token position + private void IMP(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.imp(a, b) ); } - /** - * Logical CIMP - * - * @param pos the token position - */ - private void CIMP(int pos) { + /// Logical CIMP + /// + /// the token position + private void CIMP(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.cimp(a, b) ); } - /** - * Logical NIMP - * - * @param pos the token position - */ - private void NIMP(int pos) { + /// Logical NIMP + /// + /// the token position + private void NIMP(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.nimp(a, b) ); } - /** - * Logical CNIMP - * - * @param pos the token position - */ - private void CNIMP(int pos) { + /// Logical CNIMP + /// + /// the token position + private void CNIMP(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.cnimp(a, b) ); } - /** - * Logical EQV - * - * @param pos the token position - */ - private void EQV(int pos) { + /// Logical EQV + /// + /// the token position + private void EQV(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.eqv(a, b) ); } - /** - * Logical negation - * - * @param pos the token position - */ - private void NEG(int pos) { + /// Logical negation + /// + /// the token position + private void NEG(int pos) { double a = getTokenValue(pos+1); setToNumber(pos, BooleanAlgebra.not(a) ); tokensList.RemoveAt(pos+1); } - /** - * Equality relation. - * - * @param pos the token position - */ - private void EQ(int pos) { + /// Equality relation. + /// + /// the token position + private void EQ(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BinaryRelations.eq(a, b) ); } - /** - * Not equals. - * - * @param pos the token position - */ - private void NEQ(int pos) { + /// Not equals. + /// + /// the token position + private void NEQ(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BinaryRelations.neq(a, b) ); } - /** - * Lower than. - * - * @param pos the token position - */ - private void LT(int pos) { + /// Lower than. + /// + /// the token position + private void LT(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BinaryRelations.lt(a, b) ); } - /** - * Greater than. - * - * @param pos the token position - */ - private void GT(int pos) { + /// Greater than. + /// + /// the token position + private void GT(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BinaryRelations.gt(a, b) ); } - /** - * Lower or equal. - * - * @param pos the token position - */ - private void LEQ(int pos) { + /// Lower or equal. + /// + /// the token position + private void LEQ(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BinaryRelations.leq(a, b) ); } - /** - * Greater or equal - * - * @param pos the token position - */ - private void GEQ(int pos) { + /// Greater or equal + /// + /// the token position + private void GEQ(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BinaryRelations.geq(a, b) ); } - /** - * Bitwise COMPL - * - * @param pos the token position - */ - private void BITWISE_COMPL(int pos) { + /// Bitwise COMPL + /// + /// the token position + private void BITWISE_COMPL(int pos) { long a = (long)getTokenValue(pos + 1); setToNumber(pos, ~a); tokensList.RemoveAt(pos + 1); } - /** - * Bitwise AND - * - * @param pos the token position - */ - private void BITWISE_AND(int pos) { + /// Bitwise AND + /// + /// the token position + private void BITWISE_AND(int pos) { long a = (long)getTokenValue(pos - 1); long b = (long)getTokenValue(pos + 1); opSetDecreaseRemove(pos, a & b); } - /** - * Bitwise OR - * - * @param pos the token position - */ - private void BITWISE_OR(int pos) { + /// Bitwise OR + /// + /// the token position + private void BITWISE_OR(int pos) { long a = (long)getTokenValue(pos - 1); long b = (long)getTokenValue(pos + 1); opSetDecreaseRemove(pos, a | b); } - /** - * Bitwise XOR - * - * @param pos the token position - */ - private void BITWISE_XOR(int pos) { + /// Bitwise XOR + /// + /// the token position + private void BITWISE_XOR(int pos) { long a = (long)getTokenValue(pos - 1); long b = (long)getTokenValue(pos + 1); opSetDecreaseRemove(pos, a ^ b); } - /** - * Bitwise LEFT SHIFT - * - * @param pos the token position - */ - private void BITWISE_LEFT_SHIFT(int pos) { + /// Bitwise LEFT SHIFT + /// + /// the token position + private void BITWISE_LEFT_SHIFT(int pos) { long a = (long)getTokenValue(pos - 1); int b = (int)getTokenValue(pos + 1); opSetDecreaseRemove(pos, a << b); } - /** - * Bitwise RIGHT SHIFT - * - * @param pos the token position - */ - private void BITWISE_RIGHT_SHIFT(int pos) { + /// Bitwise RIGHT SHIFT + /// + /// the token position + private void BITWISE_RIGHT_SHIFT(int pos) { long a = (long)getTokenValue(pos - 1); int b = (int)getTokenValue(pos + 1); opSetDecreaseRemove(pos, a >> b); } - /** - * Sine function - * - * @param pos the token position - */ - private void SIN(int pos) { + /// Sine function + /// + /// the token position + private void SIN(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.sin(a) ); } - /** - * Cosine / Trigonometric functions - * Sets tokens to number token - * - * @param pos the token position - */ - private void COS(int pos) { + /// Cosine / Trigonometric functions + /// Sets tokens to number token + /// + /// the token position + private void COS(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.cos(a) ); } - /** - * Tangent / Trigonometric functions - * Sets tokens to number token - * - * @param pos the token position - */ - private void TAN(int pos) { + /// Tangent / Trigonometric functions + /// Sets tokens to number token + /// + /// the token position + private void TAN(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.tan(a) ); } - /** - * Cotangent / Trigonometric functions - * Sets tokens to number token - * - * @param pos the token position - */ - private void CTAN(int pos) { + /// Cotangent / Trigonometric functions + /// Sets tokens to number token + /// + /// the token position + private void CTAN(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.ctan(a) ); } - /** - * Secant / Trigonometric functions - * Sets tokens to number token - * - * @param pos the token position - */ - private void SEC(int pos) { + /// Secant / Trigonometric functions + /// Sets tokens to number token + /// + /// the token position + private void SEC(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.sec(a) ); } - /** - * Cosecant / Trigonometric functions - * Sets tokens to number token - * - * @param pos the token position - */ - private void COSEC(int pos) { + /// Cosecant / Trigonometric functions + /// Sets tokens to number token + /// + /// the token position + private void COSEC(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.cosec(a) ); } - /** - * Arcus sine / Inverse trigonometric functions - * Sets tokens to number token - * - * @param pos the token position - */ - private void ASIN(int pos) { + /// Arcus sine / Inverse trigonometric functions + /// Sets tokens to number token + /// + /// the token position + private void ASIN(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.asin(a) ); } - /** - * Arcus cosine / Inverse trigonometric functions - * Sets tokens to number token - * - * @param pos the token position - */ - private void ACOS(int pos) { + /// Arcus cosine / Inverse trigonometric functions + /// Sets tokens to number token + /// + /// the token position + private void ACOS(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.acos(a) ); } - /** - * Arcus tangent / Inverse trigonometric functions - * Sets tokens to number token - * - * @param pos the token position - */ - private void ATAN(int pos) { + /// Arcus tangent / Inverse trigonometric functions + /// Sets tokens to number token + /// + /// the token position + private void ATAN(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.atan(a) ); } - /** - * Arcus cotangent / Inverse trigonometric functions - * Sets tokens to number token - * - * @param pos the token position - */ - private void ACTAN(int pos) { + /// Arcus cotangent / Inverse trigonometric functions + /// Sets tokens to number token + /// + /// the token position + private void ACTAN(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.actan(a) ); } - /** - * Natural logarithm (base e) - * Sets tokens to number token - * - * @param pos the token position - */ - private void LN(int pos) { + /// Natural logarithm (base e) + /// Sets tokens to number token + /// + /// the token position + private void LN(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.ln(a) ); } - /** - * Logarithm - base 2 - * Sets tokens to number token - * - * @param pos the token position - */ - private void LOG2(int pos) { + /// Logarithm - base 2 + /// Sets tokens to number token + /// + /// the token position + private void LOG2(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.log2(a) ); } - /** - * Logarithm - base 10 - * Sets tokens to number token - * - * @param pos the token position - */ - private void LOG10(int pos) { + /// Logarithm - base 10 + /// Sets tokens to number token + /// + /// the token position + private void LOG10(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.log10(a) ); } - /** - * Converts degrees to radius - * Sets tokens to number token - * - * @param pos the token position - */ - private void RAD(int pos) { + /// Converts degrees to radius + /// Sets tokens to number token + /// + /// the token position + private void RAD(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.rad(a) ); } - /** - * Exponential function - * Sets tokens to number token - * - * @param pos the token position - */ - private void EXP(int pos) { + /// Exponential function + /// Sets tokens to number token + /// + /// the token position + private void EXP(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.exp(a) ); } - /** - * Square root - * Sets tokens to number token - * - * @param pos the token position - */ - private void SQRT(int pos) { + /// Square root + /// Sets tokens to number token + /// + /// the token position + private void SQRT(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.sqrt(a) ); } - /** - * Hyperbolic sine - * Sets tokens to number token - * - * @param pos the token position - */ - private void SINH(int pos) { + /// Hyperbolic sine + /// Sets tokens to number token + /// + /// the token position + private void SINH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.sinh(a) ); } - /** - * Hyperbolic cosine - * Sets tokens to number token - * - * @param pos the token position - */ - private void COSH(int pos) { + /// Hyperbolic cosine + /// Sets tokens to number token + /// + /// the token position + private void COSH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.cosh(a) ); } - /** - * Hyperbolic tangent - * Sets tokens to number token - * - * @param pos the token position - */ - private void TANH(int pos) { + /// Hyperbolic tangent + /// Sets tokens to number token + /// + /// the token position + private void TANH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.tanh(a) ); } - /** - * Hyperbolic cotangent - * Sets tokens to number token - * - * @param pos the token position - */ - private void COTH(int pos) { + /// Hyperbolic cotangent + /// Sets tokens to number token + /// + /// the token position + private void COTH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.coth(a) ); } - /** - * Hyperbolic secant - * Sets tokens to number token - * - * @param pos the token position - */ - private void SECH(int pos) { + /// Hyperbolic secant + /// Sets tokens to number token + /// + /// the token position + private void SECH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.sech(a) ); } - /** - * Hyperbolic cosecant - * Sets tokens to number token - * - * @param pos the token position - */ - private void CSCH(int pos) { + /// Hyperbolic cosecant + /// Sets tokens to number token + /// + /// the token position + private void CSCH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.csch(a) ); } - /** - * Converts radians to degrees - * Sets tokens to number token - * - * @param pos the token position - */ - private void DEG(int pos) { + /// Converts radians to degrees + /// Sets tokens to number token + /// + /// the token position + private void DEG(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.deg(a) ); } - /** - * Absolut value - * Sets tokens to number token - * - * @param pos the token position - */ - private void ABS(int pos) { + /// Absolut value + /// Sets tokens to number token + /// + /// the token position + private void ABS(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.abs(a) ); } - /** - * Signum function - * Sets tokens to number token - * - * @param pos the token position - */ - private void SGN(int pos) { + /// Signum function + /// Sets tokens to number token + /// + /// the token position + private void SGN(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.sgn(a) ); } - /** - * Floor function - * Sets tokens to number token - * - * @param pos the token position - */ - private void FLOOR(int pos) { + /// Floor function + /// Sets tokens to number token + /// + /// the token position + private void FLOOR(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.floor(a) ); } - /** - * Ceil function - * Sets tokens to number token - * - * @param pos the token position - */ - private void CEIL(int pos) { + /// Ceil function + /// Sets tokens to number token + /// + /// the token position + private void CEIL(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.ceil(a) ); } - /** - * Arcus hyperbolic sine - * Sets tokens to number token - * - * @param pos the token position - */ - private void ARSINH(int pos) { + /// Arcus hyperbolic sine + /// Sets tokens to number token + /// + /// the token position + private void ARSINH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.arsinh(a) ); } - /** - * Arcus hyperbolic cosine - * Sets tokens to number token - * - * @param pos the token position - */ - private void ARCOSH(int pos) { + /// Arcus hyperbolic cosine + /// Sets tokens to number token + /// + /// the token position + private void ARCOSH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.arcosh(a) ); } - /** - * Arcus hyperbolic tangent - * Sets tokens to number token - * - * @param pos the token position - */ - private void ARTANH(int pos) { + /// Arcus hyperbolic tangent + /// Sets tokens to number token + /// + /// the token position + private void ARTANH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.artanh(a) ); } - /** - * Arcus hyperbolic cotangent - * Sets tokens to number token - * - * @param pos the token position - */ - private void ARCOTH(int pos) { + /// Arcus hyperbolic cotangent + /// Sets tokens to number token + /// + /// the token position + private void ARCOTH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.arcoth(a) ); } - /** - * Arcus hyperbolic secant - * Sets tokens to number token - * - * @param pos the token position - */ - private void ARSECH(int pos) { + /// Arcus hyperbolic secant + /// Sets tokens to number token + /// + /// the token position + private void ARSECH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.arsech(a) ); } - /** - * Arcus hyperbolic cosecant - * Sets tokens to number token - * - * @param pos the token position - */ - private void ARCSCH(int pos) { + /// Arcus hyperbolic cosecant + /// Sets tokens to number token + /// + /// the token position + private void ARCSCH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.arcsch(a) ); } - /** - * SA / sinc normalized - * - * @param pos the token position - */ - private void SA(int pos) { + /// SA / sinc normalized + /// + /// the token position + private void SA(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.sa(a) ); } - /** - * Sinc unnormalized - * - * @param pos the token position - */ - private void SINC(int pos) { + /// Sinc unnormalized + /// + /// the token position + private void SINC(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.sinc(a) ); } - /** - * Bell numbers - * - * @param pos the token position - */ - private void BELL_NUMBER(int pos) { + /// Bell numbers + /// + /// the token position + private void BELL_NUMBER(int pos) { double n = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.bellNumber(n) ); } - /** - * Lucas numbers - * - * @param pos the token position - */ - private void LUCAS_NUMBER(int pos) { + /// Lucas numbers + /// + /// the token position + private void LUCAS_NUMBER(int pos) { double n = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.lucasNumber(n) ); } - /** - * Fibonacci numbers - * - * @param pos the token position - */ - private void FIBONACCI_NUMBER(int pos) { + /// Fibonacci numbers + /// + /// the token position + private void FIBONACCI_NUMBER(int pos) { double n = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.fibonacciNumber(n) ); } - /** - * Harmonic numbers - * - * @param pos the token position - */ - private void HARMONIC_NUMBER(int pos) { + /// Harmonic numbers + /// + /// the token position + private void HARMONIC_NUMBER(int pos) { double n = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.harmonicNumber(n) ); } - /** - * Prime test - * - * @param pos the token position - */ - private void IS_PRIME(int pos) { + /// Prime test + /// + /// the token position + private void IS_PRIME(int pos) { double n = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, NumberTheory.primeTest(n)); } - /** - * Prime counting - * - * @param pos the token position - */ - private void PRIME_COUNT(int pos) { + /// Prime counting + /// + /// the token position + private void PRIME_COUNT(int pos) { double n = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, NumberTheory.primeCount(n)); } - /** - * Exponential integral function - * - * @param pos the token position - */ - private void EXP_INT(int pos) { + /// Exponential integral function + /// + /// the token position + private void EXP_INT(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.exponentialIntegralEi(x)); } - /** - * Logarithmic exponential integral function - * - * @param pos the token position - */ - private void LOG_INT(int pos) { + /// Logarithmic exponential integral function + /// + /// the token position + private void LOG_INT(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.logarithmicIntegralLi(x)); } - /** - * Offset logarithmic exponential integral function - * - * @param pos the token position - */ - private void OFF_LOG_INT(int pos) { + /// Offset logarithmic exponential integral function + /// + /// the token position + private void OFF_LOG_INT(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.offsetLogarithmicIntegralLi(x)); } - /** - * Factorilal function - * Sets tokens to number token - * - * @param pos the token position - */ - private void FACT(int pos) { + /// Factorilal function + /// Sets tokens to number token + /// + /// the token position + private void FACT(int pos) { double a = getTokenValue(pos-1); setToNumber(pos, MathFunctions.factorial(a)); tokensList.RemoveAt(pos-1); } - /** - * Percentage - * Sets tokens to number token - * - * @param pos the token position - */ - private void PERC(int pos) { + /// Percentage + /// Sets tokens to number token + /// + /// the token position + private void PERC(int pos) { double a = getTokenValue(pos - 1); setToNumber(pos, a * Units.PERC); tokensList.RemoveAt(pos - 1); } - /** - * Negation - * Sets tokens to number token - * - * @param pos the token position - */ - private void NOT(int pos) { + /// Negation + /// Sets tokens to number token + /// + /// the token position + private void NOT(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, BooleanAlgebra.not(a) ); } - /** - * Gauss error function - * - * @param pos the token position - */ - private void GAUSS_ERF(int pos) { + /// Gauss error function + /// + /// the token position + private void GAUSS_ERF(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.erf(x)); } - /** - * Gauss complementary error function - * - * @param pos the token position - */ - private void GAUSS_ERFC(int pos) { + /// Gauss complementary error function + /// + /// the token position + private void GAUSS_ERFC(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.erfc(x)); } - /** - * Inverse of Gauss error function - * - * @param pos the token position - */ - private void GAUSS_ERF_INV(int pos) { + /// Inverse of Gauss error function + /// + /// the token position + private void GAUSS_ERF_INV(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.erfInv(x)); } - /** - * Inverse of Gauss complementary error function - * - * @param pos the token position - */ - private void GAUSS_ERFC_INV(int pos) { + /// Inverse of Gauss complementary error function + /// + /// the token position + private void GAUSS_ERFC_INV(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.erfcInv(x)); } - /** - * Unit in The Last Place - * Sets tokens to number token - * - * @param pos the token position - */ - private void ULP(int pos) { + /// Unit in The Last Place + /// Sets tokens to number token + /// + /// the token position + private void ULP(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, MathFunctions.ulp(x)); } - /** - * Is Not-a-Number - * Sets tokens to number token - * - * @param pos the token position - */ - private void ISNAN(int pos) { + /// Is Not-a-Number + /// Sets tokens to number token + /// + /// the token position + private void ISNAN(int pos) { double x = getTokenValue(pos + 1); if (Double.IsNaN(x)) f1SetDecreaseRemove(pos, BooleanAlgebra.TRUE); else f1SetDecreaseRemove(pos, BooleanAlgebra.FALSE); } - /** - * Number of digits in base 10 - * Sets tokens to number token - * - * @param pos the token position - */ - private void NDIG10(int pos) { + /// Number of digits in base 10 + /// Sets tokens to number token + /// + /// the token position + private void NDIG10(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, NumberTheory.numberOfDigits(x)); } - /** - * Number of prime factors - distinct - * Sets tokens to number token - * - * @param pos the token position - */ - private void NFACT(int pos) { + /// Number of prime factors - distinct + /// Sets tokens to number token + /// + /// the token position + private void NFACT(int pos) { double n = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, NumberTheory.numberOfPrimeFactors(n)); } - /** - * Arcuus secant - * Sets tokens to number token - * - * @param pos the token position - */ - private void ARCSEC(int pos) { + /// Arcuus secant + /// Sets tokens to number token + /// + /// the token position + private void ARCSEC(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, MathFunctions.asec(x)); } - /** - * Arcuus cosecant - * Sets tokens to number token - * - * @param pos the token position - */ - private void ARCCSC(int pos) { + /// Arcuus cosecant + /// Sets tokens to number token + /// + /// the token position + private void ARCCSC(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, MathFunctions.acosec(x)); } - /** - * Gamma special function - * Sets tokens to number token - * - * @param pos the token position - */ - private void GAMMA(int pos) { + /// Gamma special function + /// Sets tokens to number token + /// + /// the token position + private void GAMMA(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.gamma(x)); } - /** - * Lambert-W special function, principal branch 0 - * Sets tokens to number token - * - * @param pos the token position - */ - private void LAMBERT_W0(int pos) { + /// Lambert-W special function, principal branch 0 + /// Sets tokens to number token + /// + /// the token position + private void LAMBERT_W0(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.lambertW(x, 0)); - } - /** - * Lambert-W special function, branch = -1 - * Sets tokens to number token - * - * @param pos the token position - */ - private void LAMBERT_W1(int pos) { + } + /// Lambert-W special function, branch = -1 + /// Sets tokens to number token + /// + /// the token position + private void LAMBERT_W1(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.lambertW(x, -1)); } - /** - * Signum of Gamma special function - * Sets tokens to number token - * - * @param pos the token position - */ - private void SGN_GAMMA(int pos) { + /// Signum of Gamma special function + /// Sets tokens to number token + /// + /// the token position + private void SGN_GAMMA(int pos) { double x = getTokenValue(pos+1); f1SetDecreaseRemove(pos, SpecialFunctions.sgnGamma(x) ); } - /** - * Log Gamma special function - * Sets tokens to number token - * - * @param pos the token position - */ - private void LOG_GAMMA(int pos) { + /// Log Gamma special function + /// Sets tokens to number token + /// + /// the token position + private void LOG_GAMMA(int pos) { double x = getTokenValue(pos+1); f1SetDecreaseRemove(pos, SpecialFunctions.logGamma(x) ); } - /** - * Digamma special function - * Sets tokens to number token - * - * @param pos the token position - */ - private void DI_GAMMA(int pos) { + /// Digamma special function + /// Sets tokens to number token + /// + /// the token position + private void DI_GAMMA(int pos) { double x = getTokenValue(pos+1); f1SetDecreaseRemove(pos, SpecialFunctions.diGamma(x) ); } - /** - * User Defined Variadic function param value - * Sets tokens to number token - * - * @param pos the token position - */ - private void UDF_PARAM(int pos) { + /// User Defined Variadic function param value + /// Sets tokens to number token + /// + /// the token position + private void UDF_PARAM(int pos) { double value = Double.NaN; double x = getTokenValue(pos+1); int npar = UDFVariadicParamsAtRunTime.Count; @@ -3491,25 +3304,21 @@ private void UDF_PARAM(int pos) { } f1SetDecreaseRemove(pos, value ); } - /** - * Logarithm - * Sets tokens to number token - * - * @param pos the token position - */ - private void LOG(int pos) { + /// Logarithm + /// Sets tokens to number token + /// + /// the token position + private void LOG(int pos) { double b = getTokenValue(pos+1); double a = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.log(a, b) ); } - /** - * Creates ArraList containing function parameters - * - * @param pos the function position - * - * @return List of function parameters. - */ - private List getNumbers(int pos) { + /// Creates containing function parameters + /// + /// the token position + /// + /// List of function parameters. + private List getNumbers(int pos) { List numbers = new List(); int pn = pos; int lastIndex = tokensList.Count - 1; @@ -3528,271 +3337,219 @@ private List getNumbers(int pos) { } while ( end == false ); return numbers; } - /** - * Modulo - * Sets tokens to number token - * - * @param pos the token position - */ - private void MOD(int pos) { + /// Modulo + /// Sets tokens to number token + /// + /// the token position + private void MOD(int pos) { double a = getTokenValue(pos+1); double b = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.mod(a, b) ); } - /** - * Binomial Coefficient - * - * @param pos the token position - */ - private void BINOM_COEFF(int pos) { + /// Binomial Coefficient + /// + /// the token position + private void BINOM_COEFF(int pos) { double n = getTokenValue(pos+1); double k = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.binomCoeff(n,k) ); } - /** - * Number of permutations - * - * @param pos the token position - */ - private void PERMUTATIONS(int pos) { + /// Number of permutations + /// + /// the token position + private void PERMUTATIONS(int pos) { double n = getTokenValue(pos+1); double k = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.numberOfPermutations(n, k) ); } - /** - * Beta special function - * @param pos the token position - */ - private void BETA(int pos) { + /// Beta special function + /// + /// the token position + private void BETA(int pos) { double x = getTokenValue(pos+1); double y = getTokenValue(pos+2); f2SetDecreaseRemove(pos, SpecialFunctions.beta(x, y) ); } - /** - * Log beta special function - * @param pos the token position - */ - private void LOG_BETA(int pos) { + /// Log beta special function + /// + /// the token position + private void LOG_BETA(int pos) { double x = getTokenValue(pos+1); double y = getTokenValue(pos+2); f2SetDecreaseRemove(pos, SpecialFunctions.logBeta(x, y) ); } - /** - * Bernoulli Number - * - * @param pos the token position - */ - private void BERNOULLI_NUMBER(int pos) { + /// Bernoulli Number + /// + /// the token position + private void BERNOULLI_NUMBER(int pos) { double m = getTokenValue(pos+1); double n = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.bernoulliNumber(m, n) ); } - /** - * Stirling number of the first kind - * - * @param pos the token position - */ - private void STIRLING1_NUMBER(int pos) { + /// Stirling number of the first kind + /// + /// the token position + private void STIRLING1_NUMBER(int pos) { double n = getTokenValue(pos+1); double k = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.Stirling1Number(n, k) ); } - /** - * Stirling number of the second kind. - * - * @param pos the token position - */ - private void STIRLING2_NUMBER(int pos) { + /// Stirling number of the second kind. + /// + /// the token position + private void STIRLING2_NUMBER(int pos) { double n = getTokenValue(pos+1); double k = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.Stirling2Number(n, k) ); } - /** - * Worpitzky number. - * - * @param pos the token position - */ - private void WORPITZKY_NUMBER(int pos) { + /// Worpitzky number. + /// + /// the token position + private void WORPITZKY_NUMBER(int pos) { double n = getTokenValue(pos+1); double k = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.worpitzkyNumber(n, k) ); } - /** - * Euler number - * - * @param pos the token position - */ - private void EULER_NUMBER(int pos) { + /// Euler number + /// + /// the token position + private void EULER_NUMBER(int pos) { double n = getTokenValue(pos+1); double k = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.eulerNumber(n, k) ); } - /** - * Kronecker delta - * - * @param pos the token position - */ - private void KRONECKER_DELTA(int pos) { + /// Kronecker delta + /// + /// the token position + private void KRONECKER_DELTA(int pos) { double i = getTokenValue(pos+1); double j = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.kroneckerDelta(i, j) ); } - /** - * Euler polynomial - * - * @param pos the token position - */ - private void EULER_POLYNOMIAL(int pos) { + /// Euler polynomial + /// + /// the token position + private void EULER_POLYNOMIAL(int pos) { double m = getTokenValue(pos+1); double x = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.eulerPolynomial(m, x) ); } - /** - * Harmonic numbers - * - * @param pos the token position - */ - private void HARMONIC2_NUMBER(int pos) { + /// Harmonic numbers + /// + /// the token position + private void HARMONIC2_NUMBER(int pos) { double x = getTokenValue(pos+1); double n = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.harmonicNumber(x, n) ); } - /** - * Decimal rounding - * - * @param pos the token position - */ - private void ROUND(int pos) { + /// Decimal rounding + /// + /// the token position + private void ROUND(int pos) { double value = getTokenValue(pos + 1); int places = (int)getTokenValue(pos + 2); f2SetDecreaseRemove(pos, MathFunctions.round(value, places)); } - /** - * Random number - Uniform Continuous distribution - * - * @param pos the token position - */ - private void RND_VAR_UNIFORM_CONT(int pos) { + /// Random number - Uniform Continuous distribution + /// + /// the token position + private void RND_VAR_UNIFORM_CONT(int pos) { double a = getTokenValue(pos + 1); double b = getTokenValue(pos + 2); f2SetDecreaseRemove(pos, ProbabilityDistributions.rndUniformContinuous(a, b, ProbabilityDistributions.randomGenerator)); } - /** - * Random number - Uniform Discrete distribution - * - * @param pos the token position - */ - private void RND_VAR_UNIFORM_DISCR(int pos) { + /// Random number - Uniform Discrete distribution + /// + /// the token position + private void RND_VAR_UNIFORM_DISCR(int pos) { int a = (int)getTokenValue(pos + 1); int b = (int)getTokenValue(pos + 2); f2SetDecreaseRemove(pos, ProbabilityDistributions.rndInteger(a, b, ProbabilityDistributions.randomGenerator)); } - /** - * Random number - Normal distribution - * - * @param pos the token position - */ - private void RND_NORMAL(int pos) { + /// Random number - Normal distribution + /// + /// the token position + private void RND_NORMAL(int pos) { double mean = getTokenValue(pos + 1); double stddev = getTokenValue(pos + 2); f2SetDecreaseRemove(pos, ProbabilityDistributions.rndNormal(mean, stddev, ProbabilityDistributions.randomGenerator)); } - /** - * Number of digits in given numeral system - * - * @param pos the token position - */ - private void NDIG(int pos) { + /// Number of digits in given numeral system + /// + /// the token position + private void NDIG(int pos) { double number = getTokenValue(pos + 1); double numeralSystemBase = getTokenValue(pos + 2); f2SetDecreaseRemove(pos, NumberTheory.numberOfDigits(number, numeralSystemBase)); } - /** - * Digit at position - base 10 numeral system - * - * @param pos the token position - */ - private void DIGIT10(int pos) { + /// Digit at position - base 10 numeral system + /// + /// the token position + private void DIGIT10(int pos) { double number = getTokenValue(pos + 1); double position = getTokenValue(pos + 2); f2SetDecreaseRemove(pos, NumberTheory.digitAtPosition(number, position)); } - /** - * Prime factor value - * - * @param pos the token position - */ - private void FACTVAL(int pos) { + /// Prime factor value + /// + /// the token position + private void FACTVAL(int pos) { double number = getTokenValue(pos + 1); double id = getTokenValue(pos + 2); f2SetDecreaseRemove(pos, NumberTheory.primeFactorValue(number, id)); } - /** - * Prime factor value exponent - * - * @param pos the token position - */ - private void FACTEXP(int pos) { + /// Prime factor value exponent + /// + /// the token position + private void FACTEXP(int pos) { double number = getTokenValue(pos + 1); double id = getTokenValue(pos + 2); f2SetDecreaseRemove(pos, NumberTheory.primeFactorExponent(number, id)); } - /** - * Nth order root - * - * @param pos the token position - */ - private void ROOT(int pos) { + /// Nth order root + /// + /// the token position + private void ROOT(int pos) { double n = getTokenValue(pos + 1); double x = getTokenValue(pos + 2); f2SetDecreaseRemove(pos, MathFunctions.root(n, x)); } - /** - * Lower incomplete special Gamma function - * - * @param pos the token position - */ - private void INC_GAMMA_LOWER(int pos) { + /// Lower incomplete special Gamma function + /// + /// the token position + private void INC_GAMMA_LOWER(int pos) { double s = getTokenValue(pos+1); double x = getTokenValue(pos+2); f2SetDecreaseRemove(pos, SpecialFunctions.incompleteGammaLower(s, x) ); } - /** - * Upper incomplete special Gamma function - * - * @param pos the token position - */ - private void INC_GAMMA_UPPER(int pos) { + /// Upper incomplete special Gamma function + /// + /// the token position + private void INC_GAMMA_UPPER(int pos) { double s = getTokenValue(pos+1); double x = getTokenValue(pos+2); f2SetDecreaseRemove(pos, SpecialFunctions.incompleteGammaUpper(s, x) ); } - /** - * Lower regularized special Gamma function - * - * @param pos the token position - */ - private void REG_GAMMA_LOWER(int pos) { + /// Lower regularized special Gamma function + /// + /// the token position + private void REG_GAMMA_LOWER(int pos) { double s = getTokenValue(pos+1); double x = getTokenValue(pos+2); f2SetDecreaseRemove(pos, SpecialFunctions.regularizedGammaLowerP(s, x) ); } - /** - * Lower regularized special Gamma function - * - * @param pos the token position - */ - private void REG_GAMMA_UPPER(int pos) { + /// Lower regularized special Gamma function + /// + /// the token position + private void REG_GAMMA_UPPER(int pos) { double s = getTokenValue(pos+1); double x = getTokenValue(pos+2); f2SetDecreaseRemove(pos, SpecialFunctions.regularizedGammaUpperQ(s, x) ); } - /** - * IF function - * - * @param pos the token position - */ - private void IF_CONDITION(int pos) { + /// IF function + /// + /// the token position + private void IF_CONDITION(int pos) { /* * Get condition string * 1st parameter @@ -3808,16 +3565,14 @@ private void IF_CONDITION(int pos) { ifExp.setVerboseMode(); ifSetRemove(pos, ifExp.calculate()); } - /** - * IFF function - * - * @param pos the token position - */ - private void IFF(int pos) { + /// IFF function + /// + /// the token position + private void IFF(int pos) { /* * Get condition string * 1st parameter - */ + */ List iffParams = getFunctionParameters(pos, tokensList); FunctionParameter iffParam = iffParams[0]; int parametersNumber = iffParams.Count; @@ -3873,13 +3628,11 @@ private void IFF(int pos) { tokensList[pos].tokenLevel--; } } - /** - * IF - * Sets tokens to number token - * - * @param pos token index (position) - */ - private void IF(int pos) { + /// IF + /// Sets tokens to number token + /// + /// the token position + private void IF(int pos) { double ifCondition = tokensList[pos+1].tokenValue; double ifTrue = tokensList[pos+2].tokenValue; double ifFalse = tokensList[pos+3].tokenValue; @@ -3890,157 +3643,132 @@ private void IF(int pos) { result = Double.NaN; f3SetDecreaseRemove(pos, result ); } - /** - * Characteristic function (a,b) - * - * @param pos the token position - */ - private void CHI(int pos) { + /// Characteristic function (a,b) + /// + /// the token position + private void CHI(int pos) { double x = getTokenValue(pos+1); double a = getTokenValue(pos+2); double b = getTokenValue(pos+3); f3SetDecreaseRemove(pos, MathFunctions.chi(x, a, b) ); } - /** - * Characteristic function [a,b] - * - * @param pos the token position - */ - private void CHI_LR(int pos) { + /// Characteristic function [a,b] + /// + /// the token position + private void CHI_LR(int pos) { double x = getTokenValue(pos+1); double a = getTokenValue(pos+2); double b = getTokenValue(pos+3); f3SetDecreaseRemove(pos, MathFunctions.chi_LR(x, a, b) ); } - /** - * Characteristic function [a,b) - * - * @param pos the token position - */ - private void CHI_L(int pos) { + /// Characteristic function [a,b) + /// + /// the token position + private void CHI_L(int pos) { double x = getTokenValue(pos+1); double a = getTokenValue(pos+2); double b = getTokenValue(pos+3); f3SetDecreaseRemove(pos, MathFunctions.chi_L(x, a, b) ); } - /** - * Characteristic function (a,b] - * - * @param pos the token position - */ - private void CHI_R(int pos) { + /// Characteristic function (a,b] + /// + /// the token position + private void CHI_R(int pos) { double x = getTokenValue(pos + 1); double a = getTokenValue(pos + 2); double b = getTokenValue(pos + 3); f3SetDecreaseRemove(pos, MathFunctions.chi_R(x, a, b)); } - /** - * Probability Distribution Function - Uniform Continuous distribution - * - * @param pos the token position - */ - private void PDF_UNIFORM_CONT(int pos) { + /// Probability Distribution Function - Uniform Continuous distribution + /// + /// the token position + private void PDF_UNIFORM_CONT(int pos) { double x = getTokenValue(pos + 1); double a = getTokenValue(pos + 2); double b = getTokenValue(pos + 3); f3SetDecreaseRemove(pos, ProbabilityDistributions.pdfUniformContinuous(x, a, b)); } - /** - * Cumulative Distribution Function - Uniform Continuous distribution - * - * @param pos the token position - */ - private void CDF_UNIFORM_CONT(int pos) { + /// Cumulative Distribution Function - Uniform Continuous distribution + /// + /// the token position + private void CDF_UNIFORM_CONT(int pos) { double x = getTokenValue(pos + 1); double a = getTokenValue(pos + 2); double b = getTokenValue(pos + 3); f3SetDecreaseRemove(pos, ProbabilityDistributions.cdfUniformContinuous(x, a, b)); } - /** - * Quantile Function - Uniform Continuous distribution - * - * @param pos the token position - */ - private void QNT_UNIFORM_CONT(int pos) { + /// Quantile Function - Uniform Continuous distribution + /// + /// the token position + private void QNT_UNIFORM_CONT(int pos) { double q = getTokenValue(pos + 1); double a = getTokenValue(pos + 2); double b = getTokenValue(pos + 3); f3SetDecreaseRemove(pos, ProbabilityDistributions.qntUniformContinuous(q, a, b)); } - /** - * Probability Distribution Function - Normal distribution - * - * @param pos the token position - */ - private void PDF_NORMAL(int pos) { + /// Probability Distribution Function - Normal distribution + /// + /// the token position + private void PDF_NORMAL(int pos) { double x = getTokenValue(pos + 1); double mean = getTokenValue(pos + 2); double stddev = getTokenValue(pos + 3); f3SetDecreaseRemove(pos, ProbabilityDistributions.pdfNormal(x, mean, stddev)); } - /** - * Cumulative Distribution Function - Normal distribution - * - * @param pos the token position - */ - private void CDF_NORMAL(int pos) { + /// Cumulative Distribution Function - Normal distribution + /// + /// the token position + private void CDF_NORMAL(int pos) { double x = getTokenValue(pos + 1); double mean = getTokenValue(pos + 2); double stddev = getTokenValue(pos + 3); f3SetDecreaseRemove(pos, ProbabilityDistributions.cdfNormal(x, mean, stddev)); } - /** - * Quantile Function - Normal distribution - * - * @param pos the token position - */ - private void QNT_NORMAL(int pos) { + /// Quantile Function - Normal distribution + /// + /// the token position + private void QNT_NORMAL(int pos) { double q = getTokenValue(pos + 1); double mean = getTokenValue(pos + 2); double stddev = getTokenValue(pos + 3); f3SetDecreaseRemove(pos, ProbabilityDistributions.qntNormal(q, mean, stddev)); } - /** - * Digit at position - numeral system with given base - * - * @param pos the token position - */ - private void DIGIT(int pos) { + /// Digit at position - numeral system with given base + /// + /// the token position + private void DIGIT(int pos) { double number = getTokenValue(pos + 1); double position = getTokenValue(pos + 2); double numeralSystemBase = getTokenValue(pos + 3); f3SetDecreaseRemove(pos, NumberTheory.digitAtPosition(number, position, numeralSystemBase)); } - /** - * Incomplete beta special function - * @param pos the token position - */ - private void INC_BETA(int pos) { + /// Incomplete beta special function + /// + /// the token position + private void INC_BETA(int pos) { double x = getTokenValue(pos+1); double a = getTokenValue(pos+2); double b = getTokenValue(pos+3); f3SetDecreaseRemove(pos, SpecialFunctions.incompleteBeta(a, b, x) ); } - /** - * Regularized incomplete beta special function - * @param pos the token position - */ - private void REG_BETA(int pos) { + /// Regularized incomplete beta special function + /// + /// the token position + private void REG_BETA(int pos) { double x = getTokenValue(pos+1); double a = getTokenValue(pos+2); double b = getTokenValue(pos+3); f3SetDecreaseRemove(pos, SpecialFunctions.regularizedBeta(a, b, x) ); } - /** - * Updating missing tokens (i.e. indexes i sum operator). Used when creating - * internal expressions based on the sublist of tokens. - * - * - * @param tokens the tokens list - * @param keyWord missing key word - * @param tokenId missing token id - * @param tokenTypeId missing token type id - */ + /// + /// Updating missing tokens (i.e. indexes i sum operator). Used when creating + /// internal expressions based on the sublist of tokens. + /// + /// + /// the tokens list + /// missing key word + /// missing token id + /// missing token type id private void updateMissingTokens(List tokens, String keyWord, int tokenId, int tokenTypeId) { foreach (Token t in tokens) if ( (t.tokenTypeId == ConstantValue.NaN) && (t.tokenStr.Equals(keyWord))) { @@ -4049,13 +3777,13 @@ private void updateMissingTokens(List tokens, String keyWord, int tokenId t.tokenTypeId = tokenTypeId; } } - /** - * Update missing tokens in expression related - * to iterative operators. - * - * @param index Index parameter of the iterative operator - * @param iterParams Parameters list of the iterative operator - */ + /// + /// Update missing tokens in expression related + /// to iterative operators. + /// + /// + /// Index parameter of the iterative operator + /// Parameters list of the iterative operator private void updateMissingTokens(ArgumentParameter index, IterativeOperatorParameters iterParams) { if (index.presence == Argument.NOT_FOUND) { updateMissingTokens(iterParams.indexParam.tokens, iterParams.indexParam.paramStr, index.index, Argument.TYPE_ID); @@ -4064,13 +3792,11 @@ private void updateMissingTokens(ArgumentParameter index, IterativeOperatorParam updateMissingTokens(iterParams.funParam.tokens, iterParams.indexParam.paramStr, index.index, Argument.TYPE_ID); } } - /** - * Evaluates ranges 'from', 'to', 'delta' for the iterative operator - * - * @param index Index parameter of the iterative operator - * @param iterParams Parameters list of the iterative operator - */ - private void evalFromToDeltaParameters(ArgumentParameter index, IterativeOperatorParameters iterParams) { + /// Evaluates ranges 'from', 'to', 'delta' for the iterative operator + /// + /// Index parameter of the iterative operator + /// Parameters list of the iterative operator + private void evalFromToDeltaParameters(ArgumentParameter index, IterativeOperatorParameters iterParams) { /* * Create from, to, fun expression * based on the from string @@ -4103,16 +3829,16 @@ private void evalFromToDeltaParameters(ArgumentParameter index, IterativeOperato iterParams.delta = iterParams.deltaExp.calculate(); } } - /** - * 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 - * - * @param pos the token position - */ + /// + /// 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 + ///
+ /// + /// the token position private void SUM(int pos) { IterativeOperatorParameters iterParams = new IterativeOperatorParameters(getFunctionParameters(pos, tokensList)); ArgumentParameter index = getParamArgument(iterParams.indexParam.paramStr); @@ -4122,17 +3848,17 @@ private void SUM(int pos) { clearParamArgument(index); calcSetDecreaseRemove(pos, sigma, true); } - /** - * 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 - * - * @param pos the token position - */ - 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 + ///
+ /// + /// the token position + private void PROD(int pos) { IterativeOperatorParameters iterParams = new IterativeOperatorParameters(getFunctionParameters(pos, tokensList)); ArgumentParameter index = getParamArgument(iterParams.indexParam.paramStr); updateMissingTokens(index, iterParams); @@ -4141,17 +3867,17 @@ private void PROD(int pos) { clearParamArgument(index); calcSetDecreaseRemove(pos, product, true); } - /** - * 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 - * - * @param pos the token position - */ - 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 + ///
+ /// + /// the token position + private void MIN(int pos) { IterativeOperatorParameters iterParams = new IterativeOperatorParameters(getFunctionParameters(pos, tokensList)); ArgumentParameter index = getParamArgument(iterParams.indexParam.paramStr); updateMissingTokens(index, iterParams); @@ -4160,16 +3886,16 @@ private void MIN(int pos) { clearParamArgument(index); calcSetDecreaseRemove(pos, min); } - /** - * 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 - * - * @param pos the token position - */ + /// + /// 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 + ///
+ /// + /// the token position private void MAX(int pos) { IterativeOperatorParameters iterParams = new IterativeOperatorParameters(getFunctionParameters(pos, tokensList)); ArgumentParameter index = getParamArgument(iterParams.indexParam.paramStr); @@ -4179,17 +3905,17 @@ private void MAX(int pos) { clearParamArgument(index); calcSetDecreaseRemove(pos, max); } - /** - * 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 - * - * @param pos the token position - */ - 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 + ///
+ /// + /// the token position + private void AVG(int pos) { IterativeOperatorParameters iterParams = new IterativeOperatorParameters(getFunctionParameters(pos, tokensList)); ArgumentParameter index = getParamArgument(iterParams.indexParam.paramStr); updateMissingTokens(index, iterParams); @@ -4198,17 +3924,17 @@ private void AVG(int pos) { clearParamArgument(index); calcSetDecreaseRemove(pos, avg, true); } - /** - * 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 - * - * @param pos the token position - */ - 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 + ///
+ /// + /// the token position + private void VAR(int pos) { IterativeOperatorParameters iterParams = new IterativeOperatorParameters(getFunctionParameters(pos, tokensList)); ArgumentParameter index = getParamArgument(iterParams.indexParam.paramStr); updateMissingTokens(index, iterParams); @@ -4217,17 +3943,17 @@ private void VAR(int pos) { clearParamArgument(index); calcSetDecreaseRemove(pos, var, true); } - /** - * 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 - * - * @param pos the token position - */ - 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 + ///
+ /// + /// the token position + private void STD(int pos) { IterativeOperatorParameters iterParams = new IterativeOperatorParameters(getFunctionParameters(pos, tokensList)); ArgumentParameter index = getParamArgument(iterParams.indexParam.paramStr); updateMissingTokens(index, iterParams); @@ -4236,13 +3962,12 @@ private void STD(int pos) { clearParamArgument(index); calcSetDecreaseRemove(pos, std, true); } - /* - * Function derivative - * - * @param pos the token position - * @param derivativeType the type of derivative (LEFT, RIGHT, ...) - */ - private void DERIVATIVE(int pos, int derivativeType) { + + /// Function derivative + /// + /// the token position + /// the type of derivative (LEFT, RIGHT, ...) + private void DERIVATIVE(int pos, int derivativeType) { /* * 2 params - der( f(x), x ) * 3 params - der( f(x), x, x0 ) @@ -4332,13 +4057,11 @@ private void DERIVATIVE(int pos, int derivativeType) { } clearParamArgument(x); } - /** - * Function derivative - * - * @param pos the token position - * @param derivativeType the type of derivative (left, right, etc...) - */ - private void DERIVATIVE_NTH(int pos, int derivativeType) { + /// Function derivative + /// + /// the token position + /// the type of derivative (left, right, etc...) + private void DERIVATIVE_NTH(int pos, int derivativeType) { const double DEF_EPS = 1E-6; /* * Default max number of steps @@ -4397,15 +4120,11 @@ private void DERIVATIVE_NTH(int pos, int derivativeType) { } clearParamArgument(x); } - /** - * Function integral - * - * @param pos the token position - */ - private void INTEGRAL(int pos) { - /** - * Default epsilon - */ + /// Function integral + /// + /// the token position + private void INTEGRAL(int pos) { + // Default epsilon const double DEF_EPS = 1E-6 ; /* @@ -4444,15 +4163,11 @@ private void INTEGRAL(int pos) { calcSetDecreaseRemove(pos, Calculus.integralTrapezoid(funExp, x.argument, aExp.calculate(), bExp.calculate(), eps, maxSteps) ); clearParamArgument(x); } - /** - * Function SOLVE - * - * @param pos the token position - */ - private void SOLVE(int pos) { - /** - * Default epsilon - */ + /// Function SOLVE + /// + /// the token position + private void SOLVE(int pos) { + /// Default epsilon const double DEF_EPS = 1E-9; /* * Default max number of steps @@ -4490,12 +4205,10 @@ private void SOLVE(int pos) { calcSetDecreaseRemove(pos, Calculus.solveBrent(funExp, x.argument, aExp.calculate(), bExp.calculate(), eps, maxSteps)); clearParamArgument(x); } - /** - * Forward difference operator - * - * @param pos the token position - */ - private void FORWARD_DIFFERENCE(int pos) { + /// Forward difference operator + /// + /// the token position + private void FORWARD_DIFFERENCE(int pos) { List parameters = getFunctionParameters(pos, tokensList); FunctionParameter funParam = parameters[0]; FunctionParameter xParam = parameters[1]; @@ -4514,12 +4227,10 @@ private void FORWARD_DIFFERENCE(int pos) { calcSetDecreaseRemove(pos, Calculus.forwardDifference(funExp, h, x.argument) ); clearParamArgument(x); } - /** - * Backward diffrence operator - * - * @param pos the token position - */ - private void BACKWARD_DIFFERENCE(int pos) { + /// Backward diffrence operator + /// + /// the token position + private void BACKWARD_DIFFERENCE(int pos) { List parameters = getFunctionParameters(pos, tokensList); FunctionParameter funParam = parameters[0]; FunctionParameter xParam = parameters[1]; @@ -4538,229 +4249,181 @@ private void BACKWARD_DIFFERENCE(int pos) { calcSetDecreaseRemove(pos, Calculus.backwardDifference(funExp, h, x.argument) ); clearParamArgument(x); } - /** - * Minimum variadic - * Sets tokens to number token - * - * @param pos the token position - */ - private void MIN_VARIADIC(int pos) { + /// Minimum variadic + /// Sets tokens to number token + /// + /// the token position + private void MIN_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.min( mXparser.arrayList2double(numbers) ), numbers.Count ); } - /** - * Maximum variadic - * Sets tokens to number token - * - * @param pos token index (position) - */ - private void MAX_VARIADIC(int pos) { + /// Maximum variadic + /// Sets tokens to number token + /// + /// the token position + private void MAX_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.max( mXparser.arrayList2double(numbers) ), numbers.Count ); } - /** - * Sum variadic - * Sets tokens to number token - * - * @param pos token index (position) - */ - private void SUM_VARIADIC(int pos) { + /// Sum variadic + /// Sets tokens to number token + /// + /// the token position + private void SUM_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.sum(mXparser.arrayList2double(numbers)), numbers.Count, true); } - /** - * Sum variadic - * Sets tokens to number token - * - * @param pos token index (position) - */ - private void PROD_VARIADIC(int pos) { + /// Sum variadic + /// Sets tokens to number token + /// + /// the token position + private void PROD_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.prod(mXparser.arrayList2double(numbers)), numbers.Count, true); } - /** - * Average variadic - * Sets tokens to number token - * - * @param pos token index (position) - */ - private void AVG_VARIADIC(int pos) { + /// Average variadic + /// Sets tokens to number token + /// + /// the token position + private void AVG_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, Statistics.avg(mXparser.arrayList2double(numbers)), numbers.Count, true); } - /** - * Variance variadic - * Sets tokens to number token - * - * @param pos token index (position) - */ - private void VAR_VARIADIC(int pos) { + /// Variance variadic + /// Sets tokens to number token + /// + /// the token position + private void VAR_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, Statistics.var(mXparser.arrayList2double(numbers)), numbers.Count, true); } - /** - * Standard deviation variadic - * Sets tokens to number token - * - * @param pos token index (position) - */ - private void STD_VARIADIC(int pos) { + /// Standard deviation variadic + /// Sets tokens to number token + /// + /// the token position + private void STD_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, Statistics.std(mXparser.arrayList2double(numbers)), numbers.Count, true); } - /** - * Continued fraction - * - * @param pos the token position - */ - private void CONTINUED_FRACTION(int pos) { + /// Continued fraction + /// + /// the token position + private void CONTINUED_FRACTION(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, MathFunctions.continuedFraction( mXparser.arrayList2double(numbers) ), numbers.Count ); } - /** - * Continued polynomial - * - * @param pos the token position - */ - private void CONTINUED_POLYNOMIAL(int pos) { + /// Continued polynomial + /// + /// the token position + private void CONTINUED_POLYNOMIAL(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, MathFunctions.continuedPolynomial( mXparser.arrayList2double(numbers) ), numbers.Count ); } - /** - * Greates Common Divisor - * - * @param pos the token position - */ - private void GCD(int pos) { + /// Greates Common Divisor + /// + /// the token position + private void GCD(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.gcd( mXparser.arrayList2double(numbers) ), numbers.Count ); } - /** - * Lowest Common Multiply - * - * @param pos the token position - */ - private void LCM(int pos) { + /// Lowest Common Multiply + /// + /// the token position + private void LCM(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.lcm( mXparser.arrayList2double(numbers) ), numbers.Count ); } - /** - * Random number from list - * - * @param pos the token position - */ - private void RND_LIST(int pos) { + /// Random number from list + /// + /// the token position + private void RND_LIST(int pos) { List numbers = getNumbers(pos); int n = numbers.Count; int i = ProbabilityDistributions.rndIndex(n, ProbabilityDistributions.randomGenerator); variadicSetDecreaseRemove(pos, numbers[i], numbers.Count); } - /** - * Coalesce - * - * @param pos the token position - */ - private void COALESCE(int pos) { + /// Coalesce + /// + /// the token position + private void COALESCE(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, MathFunctions.coalesce(mXparser.arrayList2double(numbers)), numbers.Count); } - /** - * OR_VARIADIC - * - * @param pos the token position - */ - private void OR_VARIADIC(int pos) { + /// OR_VARIADIC + /// + /// the token position + private void OR_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, BooleanAlgebra.orVariadic( mXparser.arrayList2double(numbers) ), numbers.Count ); } - /** - * AND_VARIADIC - * - * @param pos the token position - */ - private void AND_VARIADIC(int pos) { + /// AND_VARIADIC + /// + /// the token position + private void AND_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, BooleanAlgebra.andVariadic( mXparser.arrayList2double(numbers) ), numbers.Count ); } - /** - * XOR_VARIADIC - * - * @param pos the token position - */ - private void XOR_VARIADIC(int pos) { + /// XOR_VARIADIC + /// + /// the token position + private void XOR_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, BooleanAlgebra.xorVariadic( mXparser.arrayList2double(numbers) ), numbers.Count ); } - /** - * ARGMIN_VARIADIC - * - * @param pos the token position - */ - private void ARGMIN_VARIADIC(int pos) { + /// ARGMIN_VARIADIC + /// + /// the token position + private void ARGMIN_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.argmin(mXparser.arrayList2double(numbers)), numbers.Count ); } - /** - * ARGMAX_VARIADIC - * - * @param pos the token position - */ - private void ARGMAX_VARIADIC(int pos) { + /// ARGMAX_VARIADIC + /// + /// the token position + private void ARGMAX_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.argmax(mXparser.arrayList2double(numbers)), numbers.Count ); } - /** - * MEDIAN_VARIADIC - * - * @param pos the token position - */ - private void MEDIAN_VARIADIC(int pos) { + /// MEDIAN_VARIADIC + /// + /// the token position + private void MEDIAN_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, Statistics.median(mXparser.arrayList2double(numbers)), numbers.Count ); } - /** - * MODE_VARIADIC - * - * @param pos the token position - */ - private void MODE_VARIADIC(int pos) { + /// MODE_VARIADIC + /// + /// the token position + private void MODE_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, Statistics.mode(mXparser.arrayList2double(numbers)), numbers.Count ); } - /** - * BASE_VARIADIC - * - * @param pos the token position - */ - private void BASE_VARIADIC(int pos) { + /// BASE_VARIADIC + /// + /// the token position + private void BASE_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.convOthBase2Decimal(mXparser.arrayList2double(numbers)), numbers.Count ); } - /** - * NDIST_VARIADIC - * - * @param pos the token position - */ - private void NDIST_VARIADIC(int pos) { + /// NDIST_VARIADIC + /// + /// the token position + private void NDIST_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.numberOfDistValues(mXparser.arrayList2double(numbers)), numbers.Count ); } - /** - * Parser symbols - * Removes comma - * - * @param pos token index (position) - */ - private void COMMA(int pos) { + /// Parser symbols + /// Removes comma + /// + /// the token position) + private void COMMA(int pos) { tokensList.RemoveAt(pos); } - /** - * Parser symbols - * Removes parenthesis - * - * @param lPos left token index (position) - * @param rPos roght token index (position) - */ + /// Parser symbols + /// Removes parenthesis + /// + /// left token index (position) + /// roght token index (position) private void PARENTHESES(int lPos, int rPos) { for (int p = lPos; p <= rPos; p++) tokensList[p].tokenLevel--; @@ -4773,11 +4436,9 @@ private void PARENTHESES(int lPos, int rPos) { * *================================================= */ - /** - * Checks syntax of the expression string. - * - * @return true if syntax is ok - */ + /// Checks syntax of the expression string. + /// + /// true if syntax is ok public bool checkLexSyntax() { bool syntax = NO_SYNTAX_ERRORS; recursionCallsCounter = 0; @@ -4799,20 +4460,16 @@ public bool checkLexSyntax() { } return syntax; } - /** - * Checks syntax of the expression string. - * - * @return true if syntax is ok - */ + /// Checks syntax of the expression string. + /// + /// true if syntax is ok public bool checkSyntax() { bool syntax = checkSyntax("[" + expressionString + "] ", false); return syntax; } - /** - * Checks syntax of the calculus parameter - * - * @return true if syntax is ok - */ + /// Checks syntax of the calculus parameter + /// + /// true if syntax is ok private int checkCalculusParameter(String param) { int errors = 0; foreach (KeyWord kw in keyWordsList) @@ -4821,15 +4478,17 @@ private int checkCalculusParameter(String param) { errors++; return errors; } - /** - * Checks if argument given in the function parameter is known - * in the expression. - * - * @param param the function parameter - * - * @return true if argument is known, - * otherwise returns false. - */ + /// + /// Checks if argument given in the function parameter is known + /// in the expression. + /// + /// + /// the function parameter + /// + /// + /// true if argument is known, + /// otherwise returns false. + /// private bool checkIfKnownArgument(FunctionParameter param) { if (param.tokens.Count > 1) return false; @@ -4838,14 +4497,14 @@ private bool checkIfKnownArgument(FunctionParameter param) { return false; return true; } - /** - * Checks if token is uknown - * - * @param param the function parameter - * - * @return true if there is only 1 token with unknown type, - * otherwise returns false. - */ + /// Checks if token is uknown + /// + /// the function parameter + /// + /// + /// true if there is only 1 token with unknown type, + /// otherwise returns false. + /// private bool checkIfUnknownToken(FunctionParameter param) { if (param.tokens.Count > 1) return false; @@ -4854,13 +4513,14 @@ private bool checkIfUnknownToken(FunctionParameter param) { return false; return true; } - /** - * Checking the syntax (recursively). - * - * @param level string representing the recurssion level. - * @return true if syntax was correct, - * otherwise returns false. - */ + /// Checking the syntax (recursively). + /// + /// string representing the recurssion level. + /// + /// + /// true if syntax was correct, + /// otherwise returns false. + /// private bool checkSyntax(String level, bool functionWithBodyExt) { if ( (expressionWasModified == false) && (syntaxStatus == NO_SYNTAX_ERRORS) && (optionsChangesetNumber == mXparser.optionsChangesetNumber) ) { errorMessage = level + "already checked - no errors!\n"; @@ -5178,12 +4838,12 @@ private bool checkSyntax(String level, bool functionWithBodyExt) { recursionCallPending = false; return syntax; } - /** - * Calculates the expression value - * - * @return The expression value if syntax was ok, - * otherwise returns Double.NaN. - */ + /// Calculates the expression value + /// + /// + /// The expression value if syntax was ok, + /// otherwise returns . + /// public double calculate() { computingTime = 0; long startTime = mXparser.currentTimeMillis(); @@ -5727,10 +5387,9 @@ public double calculate() { } return result; } - /** - * Calculates unary function - * @param pos token position - */ + /// Calculates unary function + /// + /// token position private void f1ArgCalc(int pos) { switch (tokensList[pos].tokenId) { case Function1Arg.SIN_ID: SIN(pos); break; @@ -5797,10 +5456,9 @@ private void f1ArgCalc(int pos) { case Function1Arg.PARAM_ID: UDF_PARAM(pos); break; } } - /** - * Calculates binary function - * @param pos Token position - */ + /// Calculates binary function + /// + /// Token position private void f2ArgCalc(int pos) { switch (tokensList[pos].tokenId) { case Function2Arg.LOG_ID: LOG(pos); break; @@ -5832,10 +5490,9 @@ private void f2ArgCalc(int pos) { case Function2Arg.LOG_BETA_ID: LOG_BETA(pos); break; } } - /** - * Calculates function with 3 arguments - * @param pos Token position - */ + /// Calculates function with 3 arguments + /// + /// Token position private void f3ArgCalc(int pos) { switch (tokensList[pos].tokenId) { case Function3Arg.IF_ID: IF(pos); break; @@ -5854,10 +5511,9 @@ private void f3ArgCalc(int pos) { case Function3Arg.REG_BETA_ID: REG_BETA(pos); break; } } - /** - * Calculates Variadic function - * @param pos Token position - */ + /// Calculates Variadic function + /// + /// Token position private void variadicFunCalc(int pos) { switch (tokensList[pos].tokenId) { case FunctionVariadic.IFF_ID: IFF(pos); break; @@ -5885,11 +5541,10 @@ private void variadicFunCalc(int pos) { case FunctionVariadic.NDIST_ID: NDIST_VARIADIC(pos); break; } } - /** - * Calculates calculus operators - * @param pos - */ - private void calculusCalc(int pos) { + /// Calculates calculus operators + /// + /// the token position + private void calculusCalc(int pos) { switch (tokensList[pos].tokenId) { case CalculusOperator.SUM_ID: SUM(pos); break; case CalculusOperator.PROD_ID: PROD(pos); break; @@ -5908,11 +5563,10 @@ private void calculusCalc(int pos) { case CalculusOperator.BACKW_DIFF_ID: BACKWARD_DIFFERENCE(pos); break; } } - /** - * Calculates boolean operators - * @param pos - */ - private void bolCalc(int pos) { + /// Calculates boolean operators + /// + /// the token position + private void bolCalc(int pos) { switch (tokensList[pos].tokenId) { case BooleanOperator.AND_ID: AND(pos); break; case BooleanOperator.CIMP_ID: CIMP(pos); break; @@ -5926,11 +5580,10 @@ private void bolCalc(int pos) { case BooleanOperator.XOR_ID: XOR(pos); break; } } - /** - * Calculates Bitwise operators - * @param pos - */ - private void bitwiseCalc(int pos) { + /// Calculates Bitwise operators + /// + /// the token position + private void bitwiseCalc(int pos) { switch (tokensList[pos].tokenId) { case BitwiseOperator.AND_ID: BITWISE_AND(pos); break; case BitwiseOperator.OR_ID: BITWISE_OR(pos); break; @@ -5945,18 +5598,16 @@ private void bitwiseCalc(int pos) { * *================================================= */ - /** - * Class level method for adding specific automatic - * parser keywords relates to User Defined Functions - * i.e.: par(i), [npar] - */ + /// + /// Class level method for adding specific automatic + /// parser keywords relates to User Defined Functions + /// i.e.: par(i), [npar] + /// private void addUDFSpecificParserKeyWords() { addKeyWord(Function1Arg.PARAM_STR, Function1Arg.PARAM_DESC, Function1Arg.PARAM_ID, Function1Arg.PARAM_SYN, Function1Arg.PARAM_SINCE, Function1Arg.TYPE_ID); addKeyWord(ConstantValue.NPAR_STR, ConstantValue.NPAR_DESC, ConstantValue.NPAR_ID, ConstantValue.NPAR_SYN, ConstantValue.NPAR_SINCE, ConstantValue.TYPE_ID); } - /** - * Creates parser key words list - */ + /// Creates parser key words list private void addParserKeyWords() { /* * Operators key words @@ -6477,9 +6128,7 @@ private void addParserKeyWords() { addKeyWord(ParserSymbol.DECIMAL_REG_EXP, ParserSymbol.NUMBER_REG_DESC, ParserSymbol.NUMBER_ID, ParserSymbol.NUMBER_SYN, ParserSymbol.NUMBER_SINCE, ParserSymbol.NUMBER_TYPE_ID); addKeyWord(ParserSymbol.BLANK_STR, ParserSymbol.BLANK_DESC, ParserSymbol.BLANK_ID, ParserSymbol.BLANK_SYN, ParserSymbol.BLANK_SINCE, ParserSymbol.TYPE_ID); } - /** - * Adds arguments key words to the keywords list - */ + /// Adds arguments key words to the keywords list private void addArgumentsKeyWords() { int argumentsNumber = argumentsList.Count; for (int argumentIndex = 0; argumentIndexAdds functions key words to the keywords list private void addFunctionsKeyWords() { int functionsNumber = functionsList.Count; for (int functionIndex = 0; functionIndexAdds constants key words to the keywords list private void addConstantsKeyWords() { int constantsNumber = constantsList.Count; for (int constantIndex = 0; constantIndex < constantsNumber; constantIndex++) { @@ -6518,9 +6163,7 @@ private void addConstantsKeyWords() { addKeyWord(c.getConstantName(), c.getDescription(), constantIndex, c.getConstantName(), "", Constant.TYPE_ID); } } - /** - * Final validation of key words - */ + /// Final validation of key words private void validateParserKeyWords() { if (mXparser.overrideBuiltinTokens) { /* @@ -6555,14 +6198,14 @@ private void validateParserKeyWords() { keyWordsList.Remove(kw); } } - /** - * Adds key word to the keyWords list - * - * @param wordString - * @param wordDescription - * @param wordId - * @param wordTypeId - */ + /// Adds key word to the keyWords list + /// + /// + /// + /// + /// + /// private void addKeyWord(String wordString, String wordDescription, int wordId, String wordSyntax, String wordSince, int wordTypeId) { if ((mXparser.tokensToRemove.Count > 0) || (mXparser.tokensToModify.Count > 0)) if ((wordTypeId == Function1Arg.TYPE_ID) || @@ -6587,13 +6230,13 @@ private void addKeyWord(String wordString, String wordDescription, int wordId, S } keyWordsList.Add(new KeyWord(wordString, wordDescription, wordId, wordSyntax, wordSince, wordTypeId)); } - /** - * Checks whether unknown token represents number literal - * provided in different numeral base system, where - * base is between 1 and 36. - * - * @param token The token not know to the parser - */ + /// + /// Checks whether unknown token represents number literal + /// provided in different numeral base system, where + /// base is between 1 and 36. + /// + /// + /// The token not know to the parser private void checkOtherNumberBases(Token token) { int dotPos = 0; int tokenStrLength = token.tokenStr.Length; @@ -6663,12 +6306,12 @@ private void checkOtherNumberBases(Token token) { token.tokenValue = NumberTheory.convOthBase2Decimal(numberLiteral, numeralSystemBase); } } - /** - * Checks whether unknown token represents fraction - * provided as fraction or mixed fraction - * - * @param token The token not know to the parser - */ + /// + /// Checks whether unknown token represents fraction + /// provided as fraction or mixed fraction + /// + /// + /// The token not know to the parser private void checkFraction(Token token) { int tokenStrLength = token.tokenStr.Length; if (tokenStrLength < 3) return; @@ -6707,14 +6350,14 @@ private void checkFraction(Token token) { token.tokenId = ParserSymbol.NUMBER_ID; token.tokenValue = fractionValue; } - /** - * Adds expression token - * Method is called by the tokenExpressionString() - * while parsing string expression - * - * @param tokenStr the token string - * @param keyWord the key word - */ + /// + /// Adds expression token + /// Method is called by the tokenExpressionString() + /// while parsing string expression + /// + /// + /// the token string + /// the key word private void addToken(String tokenStr, KeyWord keyWord) { Token token = new Token(); initialTokens.Add(token); @@ -6733,9 +6376,7 @@ private void addToken(String tokenStr, KeyWord keyWord) { checkFraction(token); } } - /** - * Tokenizing expressiong string - */ + /// Tokenizing expressiong string private void tokenizeExpressionString() { /* * Add parser and argument key words @@ -7158,9 +6799,7 @@ private void tokenizeExpressionString() { */ evaluateTokensLevels(); } - /** - * Evaluates tokens levels - */ + /// Evaluates tokens levels private void evaluateTokensLevels() { int tokenLevel = 0; Stack tokenStack = new Stack(); @@ -7202,9 +6841,7 @@ private void evaluateTokensLevels() { } } } - /** - * copy initial tokens lito to tokens list - */ + /// copy initial tokens lito to tokens list private void copyInitialTokens() { tokensList = new List(); foreach (Token token in initialTokens) { @@ -7215,15 +6852,15 @@ private void copyInitialTokens() { private const String ARGUMENT = "argument"; private const String UNITCONST = "unit/const"; private const String ERROR = "error"; - /** - * Tokenizes expression string and returns tokens list, - * including: string, type, level. - * - * @return Copy of initial tokens. - * - * @see Token - * @see mXparser#consolePrintTokens(ArrayList) - */ + /// + /// Tokenizes expression string and returns tokens list, + /// including: string, type, level. + /// + /// + /// Copy of initial tokens. + /// + /// + /// public List getCopyOfInitialTokens() { List tokensListCopy = new List(); if (expressionString.Length == 0) return tokensListCopy; @@ -7250,14 +6887,16 @@ public List getCopyOfInitialTokens() { } return tokensListCopy; } - /** - * 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. - * - * @return Array of missing user defined arguments names - * - distinct strings. - */ + /// + /// 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. + /// + /// + /// + /// Array of missing user defined arguments names + /// - distinct strings. + /// public String[] getMissingUserDefinedArguments() { List tokens = getCopyOfInitialTokens(); List missingArguments = new List(); @@ -7271,14 +6910,16 @@ public String[] getMissingUserDefinedArguments() { missArgs[i] = missingArguments[i]; return missArgs; } - /** - * Returns missing user defined units names, i.e. - * 2*[w] + [q] where [w] and [q] are not defined - * function will return [w] and [q]. - * - * @return Array of missing user defined units names - * - distinct strings. - */ + /// + /// Returns missing user defined units names, i.e. + /// 2*[w] + [q] where [w] and [q] are not defined + /// function will return [w] and [q]. + /// + /// + /// + /// Array of missing user defined units names + /// - distinct strings. + /// public String[] getMissingUserDefinedUnits() { List tokens = getCopyOfInitialTokens(); List missingUnits = new List(); @@ -7292,14 +6933,16 @@ public String[] getMissingUserDefinedUnits() { missUnits[i] = missingUnits[i]; return missUnits; } - /** - * Returns missing user defined functions names, i.e. - * sin(x) + fun(x,y) where fun is not defined - * function will return fun. - * - * @return Array of missing user defined functions names - * - distinct strings. - */ + /// + /// Returns missing user defined functions names, i.e. + /// sin(x) + fun(x,y) where fun is not defined + /// function will return fun. + /// + /// + /// + /// Array of missing user defined functions names + /// - distinct strings. + /// public String[] getMissingUserDefinedFunctions() { List tokens = getCopyOfInitialTokens(); List missingFunctions = new List(); @@ -7313,36 +6956,27 @@ public String[] getMissingUserDefinedFunctions() { missFun[i] = missingFunctions[i]; return missFun; } - /** - * Gets initial tokens and returns copied list - * - * @see Function - */ + /// Gets initial tokens and returns copied list + /// + /// internal List getInitialTokens() { return initialTokens; } - /* - * Text adjusting. - */ + /// Text adjusting. private static String getLeftSpaces(String maxStr, String str) { String spc = ""; for (int i=0; iText adjusting. private static String getRightSpaces(String maxStr, String str) { String spc = ""; for (int i=0; iShows parsing (verbose mode purposes). private void showParsing(int lPos, int rPos) { mXparser.consolePrint(" ---> "); for (int i=lPos; i<=rPos; i++) { @@ -7354,9 +6988,7 @@ private void showParsing(int lPos, int rPos) { } mXparser.consolePrint(" ... "); } - /** - * shows known keywords - */ + /// shows known keywords void showKeyWords() { int keyWordsNumber = keyWordsList.Count; String maxStr = "KEY_WORD"; @@ -7374,21 +7006,17 @@ void showKeyWords() { } mXparser.consolePrintln(" -------------------------------------------"); } - /** - * Gets help content. - * - * @return The help content. - */ + /// Gets help content. + /// + /// The help content. public String getHelp() { return getHelp(""); } - /** - * Searching help content. - * - * @param word searching key word - * - * @return The help content. - */ + /// Searching help content. + /// + /// searching key word + /// + /// The help content. public String getHelp(String word) { keyWordsList = new List(); String helpStr = "Help content: \n\n"; @@ -7443,32 +7071,30 @@ public String getHelp(String word) { } return helpStr; } - /** - * Returns list of key words known to the parser - * - * @return List of keywords known to the parser. - * - * @see KeyWord - * @see KeyWord#wordTypeId - * @see Expression#getHelp() - */ + /// Returns list of key words known to the parser + /// + /// List of keywords known to the parser. + /// + /// + /// + /// public List getKeyWords() { return getKeyWords(""); } - /** - * Returns list of key words known to the parser - * - * @param query Give any string to filter list of key words against this string. - * User more precise syntax: str=tokenString, desc=tokenDescription, - * syn=TokenSyntax, sin=tokenSince, wid=wordId, tid=wordTypeId - * to narrow the result. - * - * @return List of keywords known to the parser filter against query string. - * - * @see KeyWord - * @see KeyWord#wordTypeId - * @see Expression#getHelp(String) - */ + /// Returns list of key words known to the parser + /// + /// + /// Give any string to filter list of key words against this string. + /// User more precise syntax: str=tokenString, desc=tokenDescription, + /// syn=TokenSyntax, sin=tokenSince, wid=wordId, tid=wordTypeId + /// to narrow the result. + /// + /// + /// List of keywords known to the parser filter against query string. + /// + /// + /// + /// public List getKeyWords(String query) { keyWordsList = new List(); List kwyWordsToReturn = new List(); @@ -7494,15 +7120,11 @@ public List getKeyWords(String query) { } return kwyWordsToReturn; } - /* - * shows tokens - */ + /// shows tokens void showTokens() { showTokens(tokensList); } - /* - * show tokens - */ + /// show tokens internal static void showTokens(List tokensList) { String maxStr = "TokenTypeId"; mXparser.consolePrintln(" --------------------"); @@ -7535,15 +7157,11 @@ internal static void showTokens(List tokensList) { } mXparser.consolePrintln(" ---------------------------------------------------------------------------------------------------------------"); } - /** - * shows initial tokens - */ + /// shows initial tokens void showInitialTokens() { showTokens(initialTokens); } - /* - * show arguments - */ + /// show arguments private void showArguments() { foreach (Argument a in argumentsList) { bool vMode = a.getVerboseMode(); @@ -7553,20 +7171,16 @@ private void showArguments() { a.setVerboseMode(); } } - /** - * - * @param info - * @param withExpressionString - */ + /// + /// + /// private void printSystemInfo(String info, bool withExpressionString) { if (withExpressionString) mXparser.consolePrint( /*"[" + this + "]" + */ "[" + description + "]" + "[" + expressionString + "] " + info); else mXparser.consolePrint(/*"[" + this + "]" + */ info); } - /** - * Expression cloning. - */ + /// Expression cloning. internal Expression clone() { Expression newExp = new Expression(this); if ( (initialTokens != null) && (initialTokens.Count > 0) ) From 769592ff8a335cea8373577fdb6b31f2e5741c49 Mon Sep 17 00:00:00 2001 From: Adam Spofford Date: Mon, 19 Aug 2019 16:18:09 -0700 Subject: [PATCH 05/15] Fix tabs --- .../mariuszgromada/math/mxparser/Constant.cs | 42 +- .../math/mxparser/Expression.cs | 2268 ++++++++--------- 2 files changed, 1155 insertions(+), 1155 deletions(-) diff --git a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Constant.cs b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Constant.cs index 7e93573e..081cfdb9 100644 --- a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Constant.cs +++ b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Constant.cs @@ -58,12 +58,12 @@ using System.Collections.Generic; namespace org.mariuszgromada.math.mxparser { - /// + /// /// Constant class provides ability to declare constants. /// Constants can be used in further processing by any expression, /// dependent or recursive argument, function, etc... /// - /// + /// /// When creating a constant you should avoid names reserved as /// parser keywords, in general words known in mathematical language /// as function names, operators (for example: @@ -72,7 +72,7 @@ namespace org.mariuszgromada.math.mxparser { /// its name will be recognized by the parser as reserved key word. /// It means that it could not be the same as any other key word known /// by the parser for this particular expression. - /// + /// /// Author: Mariusz Gromada
/// mariuszgromada.org@gmail.com
/// MathSpace.pl
@@ -91,7 +91,7 @@ namespace org.mariuszgromada.math.mxparser { /// ScalarMath.org
/// /// Version: 4.3.0 - ///
+ ///
/// /// /// @@ -117,11 +117,11 @@ public class Constant : PrimitiveElement { private List relatedExpressionsList; /// Status of the expression syntax /// - /// + /// /// Please referet to the: /// - /// - - /// + /// private bool syntaxStatus; /// Message after checking the syntax private String errorMessage; @@ -144,11 +144,11 @@ public Constant(String constantName, double constantValue) : base(Constant.TYPE_ } } - /// + /// /// Constructor - creates constant with a given name and given value. /// Additionally description is being set. /// - /// + /// /// the constant name /// the constant value /// the constant description @@ -167,21 +167,21 @@ public Constant(String constantName, double constantValue, String description) : } } - /// + /// /// Constructor for function definition in natural math language, /// for instance providing on string "f(x,y) = sin(x) + cos(x)" /// is enough to define function "f" with parameters "x and y" /// and function body "sin(x) + cos(x)". - /// + /// /// /// - /// Constant definition in the form - /// of one String, ie "c = 2" or "c = 2*sin(pi/3)" - /// + /// Constant definition in the form + /// of one String, ie "c = 2" or "c = 2*sin(pi/3)" + /// /// - /// Optional parameters (comma separated) such as Arguments, - /// Constants, Functions - /// + /// Optional parameters (comma separated) such as Arguments, + /// Constants, Functions + /// public Constant(String constantDefinitionString, params PrimitiveElement[] elements) : base(Constant.TYPE_ID) { description = ""; syntaxStatus = SYNTAX_ERROR_OR_STATUS_UNKNOWN; @@ -205,10 +205,10 @@ public String getConstantName() { return constantName; } - /// + /// /// Sets constant name. If constant is associated with any expression /// then this operation will set modified flag to each related expression. - /// + /// /// /// the constant name public void setConstantName(String constantName) { @@ -223,7 +223,7 @@ public void setConstantName(String constantName) { } /// Sets constant value - /// + /// /// constant value public void setConstantValue(double constantValue) { this.constantValue = constantValue; @@ -260,10 +260,10 @@ public String getErrorMessage() { /// Gets syntax status of the expression. /// /// - /// if there are no syntax errors, + /// if there are no syntax errors, /// when syntax error was found or /// syntax status is unknown - /// + /// public bool getSyntaxStatus() { return this.syntaxStatus; } diff --git a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Expression.cs b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Expression.cs index b858091d..f801626e 100644 --- a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Expression.cs +++ b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Expression.cs @@ -64,7 +64,7 @@ using org.mariuszgromada.math.mxparser.parsertokens; namespace org.mariuszgromada.math.mxparser { - /// + /// /// Expression - base class for real expressions definition. /// /// Examples: @@ -73,16 +73,16 @@ namespace org.mariuszgromada.math.mxparser { /// 'sin(x)+1' /// 'asin(3*x)^10-log(4,8)' /// - /// in general 'f(x1,x2,...,xn)' where x1,...,xn are real + /// in general 'f(x1,x2,...,xn)' where x1,...,xn are real /// arguments - /// + /// /// - /// - /// + /// + /// /// Class provides easy way to define multivariate arithmetic expression. /// /// Authors:
- /// Mariusz Gromada
+ /// Mariusz Gromada
/// mariuszgromada.org@gmail.com
/// MathSpace.pl
/// MathParser.org - mXparser project page
@@ -100,7 +100,7 @@ namespace org.mariuszgromada.math.mxparser { /// ScalarMath.org /// /// Version: 4.3.3 - ///
+ /// /// /// /// @@ -140,30 +140,30 @@ public class Expression { /// /// internal List constantsList; - /// List of key words known by the parser - private List keyWordsList; - /// + /// List of key words known by the parser + private List keyWordsList; + /// /// 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 ( - 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 - /// - /// + /// + /// private List initialTokens; - /// + /// /// the initialTokens list keeps unchanged information about /// found tokens. /// - /// + /// /// While parsing the tokensList is used. The tokensList is the same /// as list at the beginning of the calculation process. /// Each math operation changes tokens list - it means that @@ -171,73 +171,73 @@ public class Expression { /// 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. - /// + /// private List tokensList; - /// + /// /// 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 - /// - /// + /// + /// internal List relatedExpressionsList; /// Keeps computing time private double computingTime; - /// + /// /// if true then new tokenizing is required /// (the list needs to be updated) - /// + /// private bool expressionWasModified; - /// + /// /// If recursive mode is on the recursive calls are permitted. /// It mean there will be no null pointer exceptions /// due to expression, and functions cloning. - /// + /// internal bool recursiveMode; - /// + /// /// Verbose mode prints processing info /// calls Console.Write* methods - /// + /// private bool verboseMode; - /// + /// /// Internal parameter for calculus expressions /// to avoid decrease in accuracy. - /// + /// internal bool disableUlpRounding; internal const bool DISABLE_ULP_ROUNDING = true; internal const bool KEEP_ULP_ROUNDING_SETTINGS = false; /// Status of the expression syntax /// /// Please referet to the: - /// + /// /// /// - /// - /// + /// + /// private bool syntaxStatus; /// Message after checking the syntax private String errorMessage; - /// + /// /// Flag used internally to mark started recursion /// call on the current object, necessary to /// avoid infinite loops while recursive syntax /// checking (i.e. f -> g and g -> f) /// or marking modified flags on the expressions /// related to this expression. - /// + /// /// /// /// private bool recursionCallPending; - /// + /// /// Internal counter to avoid infinite loops while calculating /// expression defined in the way shown by below examples /// @@ -250,21 +250,21 @@ public class Expression { /// Function g = new Function("g(x) = 2*f(x)"); /// f.addDefinitions(g); /// g.addDefinitions(f); - /// - /// + /// + /// private int recursionCallsCounter; - /// + /// /// Internal indicator for tokenization process /// if true, then keywords such as constants /// functions etc.. will not be recognized /// during tokenization - /// + /// private bool parserKeyWordsOnly; - /// + /// /// Indicator whether expression was /// automatically built for user defined /// functions purpose - /// + /// /// /// internal bool UDFExpression = false; @@ -272,10 +272,10 @@ public class Expression { /// /// internal List UDFVariadicParamsAtRunTime; - /// + /// /// Internal indicator for calculation process /// method - /// + /// /// It show whether to build again tokens list
/// if clone - build again
/// if not clone - build only at the beginning @@ -287,8 +287,8 @@ public class Expression { /// Function g = new Function("g(x) = 2*f(x)"); /// f.addDefinitions(g); /// g.addDefinitions(f); - /// - ///
+ /// + ///
private bool internalClone; /// mXparser options changeset /// used in checkSyntax() method @@ -299,11 +299,11 @@ public class Expression { * *================================================= */ - /// + /// /// Adds related expression /// The same expression could be added more than once /// For example when - /// + /// /// /// the expression internal void addRelatedExpression(Expression expression) { @@ -324,11 +324,11 @@ internal void showRelatedExpressions() { foreach (Expression e in relatedExpressionsList) mXparser.consolePrintln("-> " + e.description + " = " + e.expressionString); } - /// + /// /// Method return error message after /// calling method or /// . - /// + /// /// /// Error message as string. public String getErrorMessage() { @@ -336,20 +336,20 @@ public String getErrorMessage() { } /// Gets syntax status of the expression. /// - /// + /// /// true if there are no syntax errors, /// false when syntax error was found or /// syntax status is unknown - /// + /// public bool getSyntaxStatus() { return this.syntaxStatus; } - /// + /// /// Package level method for passing /// information about errors identified /// on the constructors level /// - /// + /// /// Syntax status /// Error message /// @@ -359,11 +359,11 @@ internal void setSyntaxStatus(bool syntaxStatus, String errorMessage) { this.errorMessage = errorMessage; this.expressionWasModified = false; } - /// + /// /// Sets expression status to modified /// Calls setExpressionModifiedFlag() method /// to all related expressions. - /// + /// internal void setExpressionModifiedFlag() { if (recursionCallPending == false) { recursionCallPending = true; @@ -415,10 +415,10 @@ private void expressionInit() { /// Default constructor - empty expression /// /// - /// Optional elements list (variadic - comma separated) - /// of types: , , - /// - /// + /// Optional elements list (variadic - comma separated) + /// of types: , , + /// + /// /// /// public Expression(params PrimitiveElement[] elements) { @@ -431,10 +431,10 @@ public Expression(params PrimitiveElement[] elements) { /// /// definition of the expression /// - /// Optional elements list (variadic - comma separated) - /// of types: , , - /// - /// + /// Optional elements list (variadic - comma separated) + /// of types: , , + /// + /// /// /// /// @@ -447,26 +447,26 @@ public Expression(String expressionString, params PrimitiveElement[] elements) { /// Constructor - creates new expression from expression string. /// definition of the expression /// - /// if true then all keywords such as functions, + /// if true then all keywords such as functions, /// constants, arguments will not be recognized. - /// + /// internal Expression(String expressionString, bool parserKeyWordsOnly) { expressionInit(); this.expressionString = "" + expressionString; setExpressionModifiedFlag(); this.parserKeyWordsOnly = parserKeyWordsOnly; } - /// + /// /// 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...). - /// + /// /// /// the expression string - /// + /// /// the tokens list (starting point - no tokenizing, /// no syntax checking) - /// + /// /// the arguments list /// the functions list /// the constants list @@ -494,13 +494,13 @@ internal Expression(String expressionString, List initialTokens, List + /// /// 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. + /// No related expressions at the beginning. /// /// the expression string /// the arguments list @@ -593,10 +593,10 @@ public void setSilentMode() { } /// Returns verbose mode status. /// - /// + /// /// true if verbose mode is on, /// otherwise returns false. - /// + /// public bool getVerboseMode() { return verboseMode; } @@ -610,10 +610,10 @@ internal void disableRecursiveMode() { } /// Gets recursive mode status /// - /// + /// /// true if recursive mode is enabled, /// otherwise returns false. - /// + /// public bool getRecursiveMode() { return recursiveMode; } @@ -623,19 +623,19 @@ public bool getRecursiveMode() { public double getComputingTime() { return computingTime; } - /// + /// /// Adds user defined elements (such as: - /// Arguments, - /// Constants, - /// Functions) + /// Arguments, + /// Constants, + /// Functions) /// to the expressions. /// - /// - /// + /// + /// /// Elements list (variadic), where , - /// , + /// , /// extend the same class - /// + /// /// /// public void addDefinitions(params PrimitiveElement[] elements) { @@ -649,19 +649,19 @@ public void addDefinitions(params PrimitiveElement[] elements) { } } } - /// + /// /// Removes user defined elements (such as: - /// Arguments, - /// Constants, - /// Functions) + /// Arguments, + /// Constants, + /// Functions) /// to the expressions. - /// + /// /// - /// + /// /// Elements list (variadic), where , - /// , + /// , /// extend the same class - /// + /// /// /// public void removeDefinitions(params PrimitiveElement[] elements) { @@ -683,10 +683,10 @@ public void removeDefinitions(params PrimitiveElement[] elements) { */ /// Adds arguments (variadic) to the expression definition. /// - /// + /// /// the arguments list /// (comma separated list) - /// + /// /// /// public void addArguments(params Argument[] arguments) { @@ -698,15 +698,15 @@ public void addArguments(params Argument[] arguments) { } setExpressionModifiedFlag(); } - /// + /// /// Enables to define the arguments (associated with /// the expression) based on the given arguments names. - /// + /// /// - /// + /// /// the arguments names (variadic) /// comma separated list - /// + /// /// /// /// @@ -718,10 +718,10 @@ public void defineArguments(params String[] argumentsNames) { } setExpressionModifiedFlag(); } - /// + /// /// Enables to define the argument (associated with the expression) /// based on the argument name and the argument value. - /// + /// /// /// the argument name /// the the argument value @@ -738,10 +738,10 @@ public void defineArgument(String argumentName, double argumentValue) { /// /// the argument name /// - /// + /// /// The argument index if the argument name was found, /// otherwise returns - /// + /// /// /// /// @@ -767,10 +767,10 @@ public int getArgumentIndex(String argumentName) { /// /// the argument name /// - /// + /// /// The argument if the argument name was found, /// otherwise returns null. - /// + /// /// /// /// @@ -785,11 +785,11 @@ public Argument getArgument(String argumentName) { /// /// the argument index /// - /// + /// /// Argument if the argument index is between 0 and /// the last available argument index (-1), /// otherwise returns null. - /// + /// /// /// /// @@ -821,10 +821,10 @@ public void setArgumentValue(String argumentName, double argumentValue) { /// /// the argument name /// - /// + /// /// Argument value if argument name was found, /// otherwise return . - /// + /// public double getArgumentValue(String argumentName) { int argumentIndex = getArgumentIndex(argumentName); if (argumentIndex != NOT_FOUND) @@ -832,16 +832,16 @@ public double getArgumentValue(String argumentName) { else return Double.NaN; } - /// + /// /// Removes first occurrences of the arguments /// associated with the expression. /// - /// - /// + /// + /// /// the arguments names /// (variadic parameters) comma separated /// list - /// + /// /// /// /// @@ -857,14 +857,14 @@ public void removeArguments(params String[] argumentsNames) { setExpressionModifiedFlag(); } /// - /// Removes first occurrences of the arguments + /// Removes first occurrences of the arguments /// associated with the expression. - /// + /// /// - /// + /// /// the arguments (variadic parameters) /// comma separated list - /// + /// /// /// /// @@ -895,10 +895,10 @@ public void removeAllArguments() { */ /// Adds constants (variadic parameters) to the expression definition. /// - /// + /// /// the constants /// (comma separated list) - /// + /// /// /// public void addConstants(params Constant[] constants) { @@ -911,11 +911,11 @@ public void addConstants(params Constant[] constants) { setExpressionModifiedFlag(); } /// - /// Enables to define the constant (associated with + /// Enables to define the constant (associated with /// the expression) based on the constant name and /// constant value. /// - /// + /// /// the constant name /// the constant value /// @@ -930,10 +930,10 @@ public void defineConstant(String constantName, double constantValue) { /// /// the constant name /// - /// + /// /// Constant index if constant name was found, /// otherwise return . - /// + /// /// /// public int getConstantIndex(String constantName) { @@ -958,11 +958,11 @@ public int getConstantIndex(String constantName) { /// /// the constant name /// - /// + /// /// Constant if constant name was found, /// otherwise return null. /// - /// + /// /// public Constant getConstant(String constantName) { int constantIndex = getConstantIndex(constantName); @@ -975,12 +975,12 @@ public Constant getConstant(String constantName) { /// /// the constant index /// - /// + /// /// Constant if the is between /// 0 and the last available constant index /// ( - 1), /// otherwise it returns null. - /// + /// /// /// public Constant getConstant(int constantIndex) { @@ -997,16 +997,16 @@ public Constant getConstant(int constantIndex) { public int getConstantsNumber() { return constantsList.Count; } - /// + /// /// Removes first occurrences of the constants /// associated with the expression. - /// + /// /// - /// + /// /// the constants names (variadic parameters) /// comma separated list /// - /// + /// /// public void removeConstants(params String[] constantsNames) { foreach (String constantName in constantsNames) { @@ -1020,14 +1020,14 @@ public void removeConstants(params String[] constantsNames) { setExpressionModifiedFlag(); } /// - /// Removes first occurrences of the constants + /// Removes first occurrences of the constants /// associated with the expression - /// + /// /// - /// + /// /// the constants (variadic parameters) /// comma separated list - /// + /// /// /// public void removeConstants(params Constant[] constants) { @@ -1039,10 +1039,10 @@ public void removeConstants(params Constant[] constants) { } } } - /// + /// /// Removes all constants /// associated with the expression - /// + /// /// /// public void removeAllConstants() { @@ -1059,11 +1059,11 @@ public void removeAllConstants() { */ /// Adds functions (variadic parameters) to the expression definition. /// - /// + /// /// the functions /// (variadic parameters) comma separated list /// - /// + /// /// public void addFunctions(params Function[] functions) { foreach (Function f in functions) { @@ -1075,20 +1075,20 @@ public void addFunctions(params Function[] functions) { } setExpressionModifiedFlag(); } - /// + /// /// Enables to define the function (associated with /// the expression) based on the function name, /// function expression string and arguments names (variadic parameters). /// - /// + /// /// the function name /// the expression string - /// + /// /// the function arguments names /// (variadic parameters) /// comma separated list /// - /// + /// /// public void defineFunction(String functionName, String functionExpressionString, params String[] argumentsNames) { @@ -1101,11 +1101,11 @@ public void defineFunction(String functionName, String functionExpressionString /// /// the function name /// - /// + /// /// Function index if function name was found, /// otherwise returns /// - /// + /// /// public int getFunctionIndex(String functionName) { int functionsNumber = functionsList.Count; @@ -1131,11 +1131,11 @@ public int getFunctionIndex(String functionName) { /// /// the function name /// - /// + /// /// Function if function name was found, /// otherwise returns null. /// - /// + /// /// public Function getFunction(String functionName) { int functionIndex = getFunctionIndex(functionName); @@ -1148,12 +1148,12 @@ public Function getFunction(String functionName) { /// /// functionIndex the function index /// - /// + /// /// Function if function index is between 0 and /// the last available function index (-1), /// otherwise returns null. /// - /// + /// /// public Function getFunction(int functionIndex) { if ( (functionIndex < 0) || (functionIndex >= functionsList.Count) ) @@ -1169,16 +1169,16 @@ public Function getFunction(int functionIndex) { public int getFunctionsNumber() { return functionsList.Count; } - /// + /// /// Removes first occurrences of the functions /// associated with the expression. /// - /// - /// + /// + /// /// the functions names (variadic parameters) /// comma separated list /// - /// + /// /// public void removeFunctions(params String[] functionsNames) { foreach (String functionName in functionsNames) { @@ -1191,16 +1191,16 @@ public void removeFunctions(params String[] functionsNames) { } setExpressionModifiedFlag(); } - /// + /// /// Removes first occurrences of the functions /// associated with the expression. - /// - /// - /// + /// + /// + /// /// the functions (variadic parameters) /// comma separated list. /// - /// + /// /// public void removeFunctions(params Function[] functions) { foreach (Function function in functions) { @@ -1212,9 +1212,9 @@ public void removeFunctions(params Function[] functions) { setExpressionModifiedFlag(); } /// - /// Removes all functions + /// Removes all functions /// associated with the expression. - /// + /// /// /// public void removeAllFunctions() { @@ -1230,19 +1230,19 @@ public void removeAllFunctions() { *================================================= */ /// - /// Sets given token to the number type / value. + /// Sets given token to the number type / value. /// Method should be called only by the SetDecreaseRemove like methods - /// + /// /// - /// + /// /// the position on which token /// should be updated to the given number - /// + /// /// the number - /// + /// /// If true, then if = true /// intelligent ULP rounding is applied. - /// + /// private void setToNumber(int pos, double number, bool ulpRound) { Token token = tokensList[pos]; if ((mXparser.ulpRounding) && (disableUlpRounding == false)) { @@ -1269,16 +1269,16 @@ private void setToNumber(int pos, double number, bool ulpRound) { private void setToNumber(int pos, double number) { setToNumber(pos, number, false); } - /// + /// /// 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 - /// + /// /// Set token type to number type / value /// Decrease level of the token /// Remove no longer needed tokens @@ -1304,42 +1304,42 @@ private void setToNumber(int pos, double number) { /// SetDecreaseRemove like methods /// /// - /// Set cos token to 1 (pos=2, result=1): - /// + /// Set cos token to 1 (pos=2, result=1): + /// /// idx : 0 1 2 3 /// token : 1 + 1 0 /// level : 0 0 1 2 - /// - /// + /// + /// /// /// - /// Decrease level (pos=2): - /// + /// Decrease level (pos=2): + /// /// idx : 0 1 2 3 /// token : 1 + 1 0 /// level : 0 0 0 2 - /// - /// + /// + /// /// /// - /// Remove no longer needed tokens (pos+1=3): - /// + /// Remove no longer needed tokens (pos+1=3): + /// /// idx : 0 1 2 /// token : 1 + 1 /// level : 0 0 0 - /// - /// - /// + /// + /// + /// /// - /// + /// /// the position on which token /// should be updated to the given number - /// + /// /// the number - /// + /// /// If true, then if = true /// intelligent ULP rounding is applied. - /// + /// private void f1SetDecreaseRemove(int pos, double result, bool ulpRound) { setToNumber(pos, result, ulpRound); tokensList[pos].tokenLevel--; @@ -1348,23 +1348,23 @@ private void f1SetDecreaseRemove(int pos, double result, bool ulpRound) { private void f1SetDecreaseRemove(int pos, double result) { f1SetDecreaseRemove(pos, result, false); } - /// SetDecreaseRemove for 2-args functions - /// - /// For detailed specification refer to the - /// - /// - /// - /// the position on which token - /// should be updated to the given number - /// - /// the number - /// - /// If true, then if = true - /// intelligent ULP rounding is applied. - /// - /// - /// - private void f2SetDecreaseRemove(int pos, double result, bool ulpRound) { + /// SetDecreaseRemove for 2-args functions + /// + /// For detailed specification refer to the + /// + /// + /// + /// the position on which token + /// should be updated to the given number + /// + /// the number + /// + /// If true, then if = true + /// intelligent ULP rounding is applied. + /// + /// + /// + private void f2SetDecreaseRemove(int pos, double result, bool ulpRound) { setToNumber(pos, result, ulpRound); tokensList[pos].tokenLevel--; tokensList.RemoveAt(pos+2); @@ -1373,22 +1373,22 @@ private void f2SetDecreaseRemove(int pos, double result, bool ulpRound) { private void f2SetDecreaseRemove(int pos, double result) { f2SetDecreaseRemove(pos, result, false); } - /// SetDecreaseRemove for 3-args functions - /// - /// For detailed specification refer to the - /// - /// - /// - /// the position on which token - /// should be updated to the given number - /// - /// the number - /// - /// If true, then if = true - /// intelligent ULP rounding is applied. - /// - /// - /// + /// SetDecreaseRemove for 3-args functions + /// + /// For detailed specification refer to the + /// + /// + /// + /// the position on which token + /// should be updated to the given number + /// + /// the number + /// + /// If true, then if = true + /// intelligent ULP rounding is applied. + /// + /// + /// private void f3SetDecreaseRemove(int pos, double result, bool ulpRound) { setToNumber(pos, result, ulpRound); tokensList[pos].tokenLevel--; @@ -1399,22 +1399,22 @@ private void f3SetDecreaseRemove(int pos, double result, bool ulpRound) { private void f3SetDecreaseRemove(int pos, double result) { f3SetDecreaseRemove(pos, result, false); } - /// SetDecreaseRemove for operators - /// - /// For detailed specification refer to the - /// - /// - /// - /// the position on which token - /// should be updated to the given number - /// - /// the number - /// - /// If true, then if = true - /// intelligent ULP rounding is applied. - /// - /// - /// + /// SetDecreaseRemove for operators + /// + /// For detailed specification refer to the + /// + /// + /// + /// the position on which token + /// should be updated to the given number + /// + /// the number + /// + /// If true, then if = true + /// intelligent ULP rounding is applied. + /// + /// + /// private void opSetDecreaseRemove(int pos, double result, bool ulpRound) { setToNumber(pos, result, ulpRound); tokensList.RemoveAt(pos+1); @@ -1423,22 +1423,22 @@ private void opSetDecreaseRemove(int pos, double result, bool ulpRound) { private void opSetDecreaseRemove(int pos, double result) { opSetDecreaseRemove(pos, result, false); } - /// SetDecreaseRemove for calculus operators - /// - /// For detailed specification refer to the - /// - /// - /// - /// the position on which token - /// should be updated to the given number - /// - /// the number - /// - /// If true, then if = true - /// intelligent ULP rounding is applied. - /// - /// - /// + /// SetDecreaseRemove for calculus operators + /// + /// For detailed specification refer to the + /// + /// + /// + /// the position on which token + /// should be updated to the given number + /// + /// the number + /// + /// If true, then if = true + /// intelligent ULP rounding is applied. + /// + /// + /// private void calcSetDecreaseRemove(int pos, double result, bool ulpRound) { setToNumber(pos, result, ulpRound); tokensList[pos].tokenLevel--; @@ -1460,23 +1460,23 @@ private void calcSetDecreaseRemove(int pos, double result, bool ulpRound) { private void calcSetDecreaseRemove(int pos, double result) { calcSetDecreaseRemove(pos, result, false); } - /// SetDecreaseRemove for special functions - /// - /// For detailed specification refer to the - /// - /// - /// - /// the position on which token - /// should be updated to the given number - /// - /// the number - /// the special function range - /// - /// If true, then if = true - /// intelligent ULP rounding is applied. - /// - /// - /// + /// SetDecreaseRemove for special functions + /// + /// For detailed specification refer to the + /// + /// + /// + /// the position on which token + /// should be updated to the given number + /// + /// the number + /// the special function range + /// + /// If true, then if = true + /// intelligent ULP rounding is applied. + /// + /// + /// private void variadicSetDecreaseRemove(int pos, double value, int length, bool ulpRound) { setToNumber(pos, value, ulpRound); tokensList[pos].tokenLevel--; @@ -1486,18 +1486,18 @@ private void variadicSetDecreaseRemove(int pos, double value, int length, bool u private void variadicSetDecreaseRemove(int pos, double value, int length) { variadicSetDecreaseRemove(pos, value, length, false); } - /// If set remove method for the if function. - /// - /// - /// the position on which token - /// should be updated to the given number - /// - /// the number - /// - /// If true, then if = true - /// intelligent ULP rounding is applied. - /// - private void ifSetRemove(int pos, double ifCondition, bool ulpRound) { + /// If set remove method for the if function. + /// + /// + /// the position on which token + /// should be updated to the given number + /// + /// the number + /// + /// If true, then if = true + /// intelligent ULP rounding is applied. + /// + private void ifSetRemove(int pos, double ifCondition, bool ulpRound) { /* * left parethesis position */ @@ -1659,12 +1659,12 @@ private List getFunctionParameters(int pos, List token } while (!end); return functionParameters; } - /// + /// /// Gets / returns argument representing given argument name. If /// argument name exists on the list of known arguments /// the the initial status of the found argument is remembered, otherwise new /// argument will be created. - /// + /// /// /// the argument name /// @@ -2518,7 +2518,7 @@ private void RANDOM_VARIABLE(int pos) { setToNumber(pos, rndVar); } /// Gets token value - /// + /// /// the token index /// /// the token value @@ -2541,34 +2541,34 @@ private void POWER(int pos) { double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, MathFunctions.power(a, b), true); } - /// Modulo handling. - /// - /// the token position - private void MODULO(int pos) { + /// Modulo handling. + /// + /// the token position + private void MODULO(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, MathFunctions.mod(a, b) ); } - /// Division handling. - /// - /// the token position - private void DIVIDE(int pos) { + /// Division handling. + /// + /// the token position + private void DIVIDE(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, MathFunctions.div(a, b), true); } - /// Multiplication handling. - /// - /// the token position - private void MULTIPLY(int pos) { + /// Multiplication handling. + /// + /// the token position + private void MULTIPLY(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, a * b, true); } - /// Addition handling. - /// - /// the token position - private void PLUS(int pos) { + /// Addition handling. + /// + /// the token position + private void PLUS(int pos) { Token b = tokensList[pos+1]; if (pos>0) { Token a = tokensList[pos-1]; @@ -2585,10 +2585,10 @@ private void PLUS(int pos) { tokensList.RemoveAt(pos+1); } } - /// Subtraction handling - /// - /// the token position - private void MINUS(int pos) { + /// Subtraction handling + /// + /// the token position + private void MINUS(int pos) { Token b = tokensList[pos+1]; if (pos>0) { Token a = tokensList[pos-1]; @@ -2605,688 +2605,688 @@ private void MINUS(int pos) { tokensList.RemoveAt(pos+1); } } - /// Logical AND - /// - /// the token position - private void AND(int pos) { + /// Logical AND + /// + /// the token position + private void AND(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.and(a, b) ); } - /// Logical OR - /// - /// the token position - private void OR(int pos) { + /// Logical OR + /// + /// the token position + private void OR(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.or(a, b) ); } - /// Logical NAND - /// - /// the token position - private void NAND(int pos) { + /// Logical NAND + /// + /// the token position + private void NAND(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.nand(a, b) ); } - /// Logical NOR - /// - /// the token position - private void NOR(int pos) { + /// Logical NOR + /// + /// the token position + private void NOR(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.nor(a, b) ); } - /// Logical XOR - /// - /// the token position - private void XOR(int pos) { + /// Logical XOR + /// + /// the token position + private void XOR(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.xor(a, b) ); } - /// Logical IMP - /// - /// the token position - private void IMP(int pos) { + /// Logical IMP + /// + /// the token position + private void IMP(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.imp(a, b) ); } - /// Logical CIMP - /// - /// the token position - private void CIMP(int pos) { + /// Logical CIMP + /// + /// the token position + private void CIMP(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.cimp(a, b) ); } - /// Logical NIMP - /// - /// the token position - private void NIMP(int pos) { + /// Logical NIMP + /// + /// the token position + private void NIMP(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.nimp(a, b) ); } - /// Logical CNIMP - /// - /// the token position - private void CNIMP(int pos) { + /// Logical CNIMP + /// + /// the token position + private void CNIMP(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.cnimp(a, b) ); } - /// Logical EQV - /// - /// the token position - private void EQV(int pos) { + /// Logical EQV + /// + /// the token position + private void EQV(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BooleanAlgebra.eqv(a, b) ); } - /// Logical negation - /// - /// the token position - private void NEG(int pos) { + /// Logical negation + /// + /// the token position + private void NEG(int pos) { double a = getTokenValue(pos+1); setToNumber(pos, BooleanAlgebra.not(a) ); tokensList.RemoveAt(pos+1); } - /// Equality relation. - /// - /// the token position - private void EQ(int pos) { + /// Equality relation. + /// + /// the token position + private void EQ(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BinaryRelations.eq(a, b) ); } - /// Not equals. - /// - /// the token position - private void NEQ(int pos) { + /// Not equals. + /// + /// the token position + private void NEQ(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BinaryRelations.neq(a, b) ); } - /// Lower than. - /// - /// the token position - private void LT(int pos) { + /// Lower than. + /// + /// the token position + private void LT(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BinaryRelations.lt(a, b) ); } - /// Greater than. - /// - /// the token position - private void GT(int pos) { + /// Greater than. + /// + /// the token position + private void GT(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BinaryRelations.gt(a, b) ); } - /// Lower or equal. - /// - /// the token position - private void LEQ(int pos) { + /// Lower or equal. + /// + /// the token position + private void LEQ(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BinaryRelations.leq(a, b) ); } - /// Greater or equal - /// - /// the token position - private void GEQ(int pos) { + /// Greater or equal + /// + /// the token position + private void GEQ(int pos) { double a = getTokenValue(pos-1); double b = getTokenValue(pos+1); opSetDecreaseRemove(pos, BinaryRelations.geq(a, b) ); } - /// Bitwise COMPL - /// - /// the token position - private void BITWISE_COMPL(int pos) { + /// Bitwise COMPL + /// + /// the token position + private void BITWISE_COMPL(int pos) { long a = (long)getTokenValue(pos + 1); setToNumber(pos, ~a); tokensList.RemoveAt(pos + 1); } - /// Bitwise AND - /// - /// the token position - private void BITWISE_AND(int pos) { + /// Bitwise AND + /// + /// the token position + private void BITWISE_AND(int pos) { long a = (long)getTokenValue(pos - 1); long b = (long)getTokenValue(pos + 1); opSetDecreaseRemove(pos, a & b); } - /// Bitwise OR - /// - /// the token position - private void BITWISE_OR(int pos) { + /// Bitwise OR + /// + /// the token position + private void BITWISE_OR(int pos) { long a = (long)getTokenValue(pos - 1); long b = (long)getTokenValue(pos + 1); opSetDecreaseRemove(pos, a | b); } - /// Bitwise XOR - /// - /// the token position - private void BITWISE_XOR(int pos) { + /// Bitwise XOR + /// + /// the token position + private void BITWISE_XOR(int pos) { long a = (long)getTokenValue(pos - 1); long b = (long)getTokenValue(pos + 1); opSetDecreaseRemove(pos, a ^ b); } - /// Bitwise LEFT SHIFT - /// - /// the token position - private void BITWISE_LEFT_SHIFT(int pos) { + /// Bitwise LEFT SHIFT + /// + /// the token position + private void BITWISE_LEFT_SHIFT(int pos) { long a = (long)getTokenValue(pos - 1); int b = (int)getTokenValue(pos + 1); opSetDecreaseRemove(pos, a << b); } - /// Bitwise RIGHT SHIFT - /// - /// the token position - private void BITWISE_RIGHT_SHIFT(int pos) { + /// Bitwise RIGHT SHIFT + /// + /// the token position + private void BITWISE_RIGHT_SHIFT(int pos) { long a = (long)getTokenValue(pos - 1); int b = (int)getTokenValue(pos + 1); opSetDecreaseRemove(pos, a >> b); } - /// Sine function - /// - /// the token position - private void SIN(int pos) { + /// Sine function + /// + /// the token position + private void SIN(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.sin(a) ); } - /// Cosine / Trigonometric functions - /// Sets tokens to number token - /// - /// the token position - private void COS(int pos) { + /// Cosine / Trigonometric functions + /// Sets tokens to number token + /// + /// the token position + private void COS(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.cos(a) ); } - /// Tangent / Trigonometric functions - /// Sets tokens to number token - /// - /// the token position - private void TAN(int pos) { + /// Tangent / Trigonometric functions + /// Sets tokens to number token + /// + /// the token position + private void TAN(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.tan(a) ); } - /// Cotangent / Trigonometric functions - /// Sets tokens to number token - /// - /// the token position - private void CTAN(int pos) { + /// Cotangent / Trigonometric functions + /// Sets tokens to number token + /// + /// the token position + private void CTAN(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.ctan(a) ); } - /// Secant / Trigonometric functions - /// Sets tokens to number token - /// - /// the token position - private void SEC(int pos) { + /// Secant / Trigonometric functions + /// Sets tokens to number token + /// + /// the token position + private void SEC(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.sec(a) ); } - /// Cosecant / Trigonometric functions - /// Sets tokens to number token - /// - /// the token position - private void COSEC(int pos) { + /// Cosecant / Trigonometric functions + /// Sets tokens to number token + /// + /// the token position + private void COSEC(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.cosec(a) ); } - /// Arcus sine / Inverse trigonometric functions - /// Sets tokens to number token - /// - /// the token position - private void ASIN(int pos) { + /// Arcus sine / Inverse trigonometric functions + /// Sets tokens to number token + /// + /// the token position + private void ASIN(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.asin(a) ); } - /// Arcus cosine / Inverse trigonometric functions - /// Sets tokens to number token - /// - /// the token position - private void ACOS(int pos) { + /// Arcus cosine / Inverse trigonometric functions + /// Sets tokens to number token + /// + /// the token position + private void ACOS(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.acos(a) ); } - /// Arcus tangent / Inverse trigonometric functions - /// Sets tokens to number token - /// - /// the token position - private void ATAN(int pos) { + /// Arcus tangent / Inverse trigonometric functions + /// Sets tokens to number token + /// + /// the token position + private void ATAN(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.atan(a) ); } - /// Arcus cotangent / Inverse trigonometric functions - /// Sets tokens to number token - /// - /// the token position - private void ACTAN(int pos) { + /// Arcus cotangent / Inverse trigonometric functions + /// Sets tokens to number token + /// + /// the token position + private void ACTAN(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.actan(a) ); } - /// Natural logarithm (base e) - /// Sets tokens to number token - /// - /// the token position - private void LN(int pos) { + /// Natural logarithm (base e) + /// Sets tokens to number token + /// + /// the token position + private void LN(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.ln(a) ); } - /// Logarithm - base 2 - /// Sets tokens to number token - /// - /// the token position - private void LOG2(int pos) { + /// Logarithm - base 2 + /// Sets tokens to number token + /// + /// the token position + private void LOG2(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.log2(a) ); } - /// Logarithm - base 10 - /// Sets tokens to number token - /// - /// the token position - private void LOG10(int pos) { + /// Logarithm - base 10 + /// Sets tokens to number token + /// + /// the token position + private void LOG10(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.log10(a) ); } - /// Converts degrees to radius - /// Sets tokens to number token - /// - /// the token position - private void RAD(int pos) { + /// Converts degrees to radius + /// Sets tokens to number token + /// + /// the token position + private void RAD(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.rad(a) ); } - /// Exponential function - /// Sets tokens to number token - /// - /// the token position - private void EXP(int pos) { + /// Exponential function + /// Sets tokens to number token + /// + /// the token position + private void EXP(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.exp(a) ); } - /// Square root - /// Sets tokens to number token - /// - /// the token position - private void SQRT(int pos) { + /// Square root + /// Sets tokens to number token + /// + /// the token position + private void SQRT(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.sqrt(a) ); } - /// Hyperbolic sine - /// Sets tokens to number token - /// - /// the token position - private void SINH(int pos) { + /// Hyperbolic sine + /// Sets tokens to number token + /// + /// the token position + private void SINH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.sinh(a) ); } - /// Hyperbolic cosine - /// Sets tokens to number token - /// - /// the token position - private void COSH(int pos) { + /// Hyperbolic cosine + /// Sets tokens to number token + /// + /// the token position + private void COSH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.cosh(a) ); } - /// Hyperbolic tangent - /// Sets tokens to number token - /// - /// the token position - private void TANH(int pos) { + /// Hyperbolic tangent + /// Sets tokens to number token + /// + /// the token position + private void TANH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.tanh(a) ); } - /// Hyperbolic cotangent - /// Sets tokens to number token - /// - /// the token position - private void COTH(int pos) { + /// Hyperbolic cotangent + /// Sets tokens to number token + /// + /// the token position + private void COTH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.coth(a) ); } - /// Hyperbolic secant - /// Sets tokens to number token - /// - /// the token position - private void SECH(int pos) { + /// Hyperbolic secant + /// Sets tokens to number token + /// + /// the token position + private void SECH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.sech(a) ); } - /// Hyperbolic cosecant - /// Sets tokens to number token - /// - /// the token position - private void CSCH(int pos) { + /// Hyperbolic cosecant + /// Sets tokens to number token + /// + /// the token position + private void CSCH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.csch(a) ); } - /// Converts radians to degrees - /// Sets tokens to number token - /// - /// the token position - private void DEG(int pos) { + /// Converts radians to degrees + /// Sets tokens to number token + /// + /// the token position + private void DEG(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.deg(a) ); } - /// Absolut value - /// Sets tokens to number token - /// - /// the token position - private void ABS(int pos) { + /// Absolut value + /// Sets tokens to number token + /// + /// the token position + private void ABS(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.abs(a) ); } - /// Signum function - /// Sets tokens to number token - /// - /// the token position - private void SGN(int pos) { + /// Signum function + /// Sets tokens to number token + /// + /// the token position + private void SGN(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.sgn(a) ); } - /// Floor function - /// Sets tokens to number token - /// - /// the token position - private void FLOOR(int pos) { + /// Floor function + /// Sets tokens to number token + /// + /// the token position + private void FLOOR(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.floor(a) ); } - /// Ceil function - /// Sets tokens to number token - /// - /// the token position - private void CEIL(int pos) { + /// Ceil function + /// Sets tokens to number token + /// + /// the token position + private void CEIL(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.ceil(a) ); } - /// Arcus hyperbolic sine - /// Sets tokens to number token - /// - /// the token position - private void ARSINH(int pos) { + /// Arcus hyperbolic sine + /// Sets tokens to number token + /// + /// the token position + private void ARSINH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.arsinh(a) ); } - /// Arcus hyperbolic cosine - /// Sets tokens to number token - /// - /// the token position - private void ARCOSH(int pos) { + /// Arcus hyperbolic cosine + /// Sets tokens to number token + /// + /// the token position + private void ARCOSH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.arcosh(a) ); } - /// Arcus hyperbolic tangent - /// Sets tokens to number token - /// - /// the token position - private void ARTANH(int pos) { + /// Arcus hyperbolic tangent + /// Sets tokens to number token + /// + /// the token position + private void ARTANH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.artanh(a) ); } - /// Arcus hyperbolic cotangent - /// Sets tokens to number token - /// - /// the token position - private void ARCOTH(int pos) { + /// Arcus hyperbolic cotangent + /// Sets tokens to number token + /// + /// the token position + private void ARCOTH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.arcoth(a) ); } - /// Arcus hyperbolic secant - /// Sets tokens to number token - /// - /// the token position - private void ARSECH(int pos) { + /// Arcus hyperbolic secant + /// Sets tokens to number token + /// + /// the token position + private void ARSECH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.arsech(a) ); } - /// Arcus hyperbolic cosecant - /// Sets tokens to number token - /// - /// the token position - private void ARCSCH(int pos) { + /// Arcus hyperbolic cosecant + /// Sets tokens to number token + /// + /// the token position + private void ARCSCH(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.arcsch(a) ); } - /// SA / sinc normalized - /// - /// the token position - private void SA(int pos) { + /// SA / sinc normalized + /// + /// the token position + private void SA(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.sa(a) ); } - /// Sinc unnormalized - /// - /// the token position - private void SINC(int pos) { + /// Sinc unnormalized + /// + /// the token position + private void SINC(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.sinc(a) ); } - /// Bell numbers - /// - /// the token position - private void BELL_NUMBER(int pos) { + /// Bell numbers + /// + /// the token position + private void BELL_NUMBER(int pos) { double n = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.bellNumber(n) ); } - /// Lucas numbers - /// - /// the token position - private void LUCAS_NUMBER(int pos) { + /// Lucas numbers + /// + /// the token position + private void LUCAS_NUMBER(int pos) { double n = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.lucasNumber(n) ); } - /// Fibonacci numbers - /// - /// the token position - private void FIBONACCI_NUMBER(int pos) { + /// Fibonacci numbers + /// + /// the token position + private void FIBONACCI_NUMBER(int pos) { double n = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.fibonacciNumber(n) ); } - /// Harmonic numbers - /// - /// the token position - private void HARMONIC_NUMBER(int pos) { + /// Harmonic numbers + /// + /// the token position + private void HARMONIC_NUMBER(int pos) { double n = getTokenValue(pos+1); f1SetDecreaseRemove(pos, MathFunctions.harmonicNumber(n) ); } - /// Prime test - /// - /// the token position - private void IS_PRIME(int pos) { + /// Prime test + /// + /// the token position + private void IS_PRIME(int pos) { double n = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, NumberTheory.primeTest(n)); } - /// Prime counting - /// - /// the token position - private void PRIME_COUNT(int pos) { + /// Prime counting + /// + /// the token position + private void PRIME_COUNT(int pos) { double n = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, NumberTheory.primeCount(n)); } - /// Exponential integral function - /// - /// the token position - private void EXP_INT(int pos) { + /// Exponential integral function + /// + /// the token position + private void EXP_INT(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.exponentialIntegralEi(x)); } - /// Logarithmic exponential integral function - /// - /// the token position - private void LOG_INT(int pos) { + /// Logarithmic exponential integral function + /// + /// the token position + private void LOG_INT(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.logarithmicIntegralLi(x)); } - /// Offset logarithmic exponential integral function - /// - /// the token position - private void OFF_LOG_INT(int pos) { + /// Offset logarithmic exponential integral function + /// + /// the token position + private void OFF_LOG_INT(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.offsetLogarithmicIntegralLi(x)); } - /// Factorilal function - /// Sets tokens to number token - /// - /// the token position - private void FACT(int pos) { + /// Factorilal function + /// Sets tokens to number token + /// + /// the token position + private void FACT(int pos) { double a = getTokenValue(pos-1); setToNumber(pos, MathFunctions.factorial(a)); tokensList.RemoveAt(pos-1); } - /// Percentage - /// Sets tokens to number token - /// - /// the token position - private void PERC(int pos) { + /// Percentage + /// Sets tokens to number token + /// + /// the token position + private void PERC(int pos) { double a = getTokenValue(pos - 1); setToNumber(pos, a * Units.PERC); tokensList.RemoveAt(pos - 1); } - /// Negation - /// Sets tokens to number token - /// - /// the token position - private void NOT(int pos) { + /// Negation + /// Sets tokens to number token + /// + /// the token position + private void NOT(int pos) { double a = getTokenValue(pos+1); f1SetDecreaseRemove(pos, BooleanAlgebra.not(a) ); } - /// Gauss error function - /// - /// the token position - private void GAUSS_ERF(int pos) { + /// Gauss error function + /// + /// the token position + private void GAUSS_ERF(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.erf(x)); } - /// Gauss complementary error function - /// - /// the token position - private void GAUSS_ERFC(int pos) { + /// Gauss complementary error function + /// + /// the token position + private void GAUSS_ERFC(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.erfc(x)); } - /// Inverse of Gauss error function - /// - /// the token position - private void GAUSS_ERF_INV(int pos) { + /// Inverse of Gauss error function + /// + /// the token position + private void GAUSS_ERF_INV(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.erfInv(x)); } - /// Inverse of Gauss complementary error function - /// - /// the token position - private void GAUSS_ERFC_INV(int pos) { + /// Inverse of Gauss complementary error function + /// + /// the token position + private void GAUSS_ERFC_INV(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.erfcInv(x)); } - /// Unit in The Last Place - /// Sets tokens to number token - /// - /// the token position - private void ULP(int pos) { + /// Unit in The Last Place + /// Sets tokens to number token + /// + /// the token position + private void ULP(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, MathFunctions.ulp(x)); } - /// Is Not-a-Number - /// Sets tokens to number token - /// - /// the token position - private void ISNAN(int pos) { + /// Is Not-a-Number + /// Sets tokens to number token + /// + /// the token position + private void ISNAN(int pos) { double x = getTokenValue(pos + 1); if (Double.IsNaN(x)) f1SetDecreaseRemove(pos, BooleanAlgebra.TRUE); else f1SetDecreaseRemove(pos, BooleanAlgebra.FALSE); } - /// Number of digits in base 10 - /// Sets tokens to number token - /// - /// the token position - private void NDIG10(int pos) { + /// Number of digits in base 10 + /// Sets tokens to number token + /// + /// the token position + private void NDIG10(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, NumberTheory.numberOfDigits(x)); } - /// Number of prime factors - distinct - /// Sets tokens to number token - /// - /// the token position - private void NFACT(int pos) { + /// Number of prime factors - distinct + /// Sets tokens to number token + /// + /// the token position + private void NFACT(int pos) { double n = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, NumberTheory.numberOfPrimeFactors(n)); } - /// Arcuus secant - /// Sets tokens to number token - /// - /// the token position - private void ARCSEC(int pos) { + /// Arcuus secant + /// Sets tokens to number token + /// + /// the token position + private void ARCSEC(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, MathFunctions.asec(x)); } - /// Arcuus cosecant - /// Sets tokens to number token - /// - /// the token position - private void ARCCSC(int pos) { + /// Arcuus cosecant + /// Sets tokens to number token + /// + /// the token position + private void ARCCSC(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, MathFunctions.acosec(x)); } - /// Gamma special function - /// Sets tokens to number token - /// - /// the token position - private void GAMMA(int pos) { + /// Gamma special function + /// Sets tokens to number token + /// + /// the token position + private void GAMMA(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.gamma(x)); } - /// Lambert-W special function, principal branch 0 - /// Sets tokens to number token - /// - /// the token position - private void LAMBERT_W0(int pos) { + /// Lambert-W special function, principal branch 0 + /// Sets tokens to number token + /// + /// the token position + private void LAMBERT_W0(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.lambertW(x, 0)); } - /// Lambert-W special function, branch = -1 - /// Sets tokens to number token - /// - /// the token position - private void LAMBERT_W1(int pos) { + /// Lambert-W special function, branch = -1 + /// Sets tokens to number token + /// + /// the token position + private void LAMBERT_W1(int pos) { double x = getTokenValue(pos + 1); f1SetDecreaseRemove(pos, SpecialFunctions.lambertW(x, -1)); } - /// Signum of Gamma special function - /// Sets tokens to number token - /// - /// the token position - private void SGN_GAMMA(int pos) { + /// Signum of Gamma special function + /// Sets tokens to number token + /// + /// the token position + private void SGN_GAMMA(int pos) { double x = getTokenValue(pos+1); f1SetDecreaseRemove(pos, SpecialFunctions.sgnGamma(x) ); } - /// Log Gamma special function - /// Sets tokens to number token - /// - /// the token position - private void LOG_GAMMA(int pos) { + /// Log Gamma special function + /// Sets tokens to number token + /// + /// the token position + private void LOG_GAMMA(int pos) { double x = getTokenValue(pos+1); f1SetDecreaseRemove(pos, SpecialFunctions.logGamma(x) ); } - /// Digamma special function - /// Sets tokens to number token - /// - /// the token position - private void DI_GAMMA(int pos) { + /// Digamma special function + /// Sets tokens to number token + /// + /// the token position + private void DI_GAMMA(int pos) { double x = getTokenValue(pos+1); f1SetDecreaseRemove(pos, SpecialFunctions.diGamma(x) ); } - /// User Defined Variadic function param value - /// Sets tokens to number token - /// - /// the token position - private void UDF_PARAM(int pos) { + /// User Defined Variadic function param value + /// Sets tokens to number token + /// + /// the token position + private void UDF_PARAM(int pos) { double value = Double.NaN; double x = getTokenValue(pos+1); int npar = UDFVariadicParamsAtRunTime.Count; @@ -3304,21 +3304,21 @@ private void UDF_PARAM(int pos) { } f1SetDecreaseRemove(pos, value ); } - /// Logarithm - /// Sets tokens to number token - /// - /// the token position - private void LOG(int pos) { + /// Logarithm + /// Sets tokens to number token + /// + /// the token position + private void LOG(int pos) { double b = getTokenValue(pos+1); double a = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.log(a, b) ); } - /// Creates containing function parameters - /// - /// the token position - /// - /// List of function parameters. - private List getNumbers(int pos) { + /// Creates containing function parameters + /// + /// the token position + /// + /// List of function parameters. + private List getNumbers(int pos) { List numbers = new List(); int pn = pos; int lastIndex = tokensList.Count - 1; @@ -3337,219 +3337,219 @@ private List getNumbers(int pos) { } while ( end == false ); return numbers; } - /// Modulo - /// Sets tokens to number token - /// - /// the token position - private void MOD(int pos) { + /// Modulo + /// Sets tokens to number token + /// + /// the token position + private void MOD(int pos) { double a = getTokenValue(pos+1); double b = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.mod(a, b) ); } - /// Binomial Coefficient - /// - /// the token position - private void BINOM_COEFF(int pos) { + /// Binomial Coefficient + /// + /// the token position + private void BINOM_COEFF(int pos) { double n = getTokenValue(pos+1); double k = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.binomCoeff(n,k) ); } - /// Number of permutations - /// - /// the token position - private void PERMUTATIONS(int pos) { + /// Number of permutations + /// + /// the token position + private void PERMUTATIONS(int pos) { double n = getTokenValue(pos+1); double k = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.numberOfPermutations(n, k) ); } - /// Beta special function - /// - /// the token position - private void BETA(int pos) { + /// Beta special function + /// + /// the token position + private void BETA(int pos) { double x = getTokenValue(pos+1); double y = getTokenValue(pos+2); f2SetDecreaseRemove(pos, SpecialFunctions.beta(x, y) ); } - /// Log beta special function - /// - /// the token position - private void LOG_BETA(int pos) { + /// Log beta special function + /// + /// the token position + private void LOG_BETA(int pos) { double x = getTokenValue(pos+1); double y = getTokenValue(pos+2); f2SetDecreaseRemove(pos, SpecialFunctions.logBeta(x, y) ); } - /// Bernoulli Number - /// - /// the token position - private void BERNOULLI_NUMBER(int pos) { + /// Bernoulli Number + /// + /// the token position + private void BERNOULLI_NUMBER(int pos) { double m = getTokenValue(pos+1); double n = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.bernoulliNumber(m, n) ); } - /// Stirling number of the first kind - /// - /// the token position - private void STIRLING1_NUMBER(int pos) { + /// Stirling number of the first kind + /// + /// the token position + private void STIRLING1_NUMBER(int pos) { double n = getTokenValue(pos+1); double k = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.Stirling1Number(n, k) ); } - /// Stirling number of the second kind. - /// - /// the token position - private void STIRLING2_NUMBER(int pos) { + /// Stirling number of the second kind. + /// + /// the token position + private void STIRLING2_NUMBER(int pos) { double n = getTokenValue(pos+1); double k = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.Stirling2Number(n, k) ); } - /// Worpitzky number. - /// - /// the token position - private void WORPITZKY_NUMBER(int pos) { + /// Worpitzky number. + /// + /// the token position + private void WORPITZKY_NUMBER(int pos) { double n = getTokenValue(pos+1); double k = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.worpitzkyNumber(n, k) ); } - /// Euler number - /// - /// the token position - private void EULER_NUMBER(int pos) { + /// Euler number + /// + /// the token position + private void EULER_NUMBER(int pos) { double n = getTokenValue(pos+1); double k = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.eulerNumber(n, k) ); } - /// Kronecker delta - /// - /// the token position - private void KRONECKER_DELTA(int pos) { + /// Kronecker delta + /// + /// the token position + private void KRONECKER_DELTA(int pos) { double i = getTokenValue(pos+1); double j = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.kroneckerDelta(i, j) ); } - /// Euler polynomial - /// - /// the token position - private void EULER_POLYNOMIAL(int pos) { + /// Euler polynomial + /// + /// the token position + private void EULER_POLYNOMIAL(int pos) { double m = getTokenValue(pos+1); double x = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.eulerPolynomial(m, x) ); } - /// Harmonic numbers - /// - /// the token position - private void HARMONIC2_NUMBER(int pos) { + /// Harmonic numbers + /// + /// the token position + private void HARMONIC2_NUMBER(int pos) { double x = getTokenValue(pos+1); double n = getTokenValue(pos+2); f2SetDecreaseRemove(pos, MathFunctions.harmonicNumber(x, n) ); } - /// Decimal rounding - /// - /// the token position - private void ROUND(int pos) { + /// Decimal rounding + /// + /// the token position + private void ROUND(int pos) { double value = getTokenValue(pos + 1); int places = (int)getTokenValue(pos + 2); f2SetDecreaseRemove(pos, MathFunctions.round(value, places)); } - /// Random number - Uniform Continuous distribution - /// - /// the token position - private void RND_VAR_UNIFORM_CONT(int pos) { + /// Random number - Uniform Continuous distribution + /// + /// the token position + private void RND_VAR_UNIFORM_CONT(int pos) { double a = getTokenValue(pos + 1); double b = getTokenValue(pos + 2); f2SetDecreaseRemove(pos, ProbabilityDistributions.rndUniformContinuous(a, b, ProbabilityDistributions.randomGenerator)); } - /// Random number - Uniform Discrete distribution - /// - /// the token position - private void RND_VAR_UNIFORM_DISCR(int pos) { + /// Random number - Uniform Discrete distribution + /// + /// the token position + private void RND_VAR_UNIFORM_DISCR(int pos) { int a = (int)getTokenValue(pos + 1); int b = (int)getTokenValue(pos + 2); f2SetDecreaseRemove(pos, ProbabilityDistributions.rndInteger(a, b, ProbabilityDistributions.randomGenerator)); } - /// Random number - Normal distribution - /// - /// the token position - private void RND_NORMAL(int pos) { + /// Random number - Normal distribution + /// + /// the token position + private void RND_NORMAL(int pos) { double mean = getTokenValue(pos + 1); double stddev = getTokenValue(pos + 2); f2SetDecreaseRemove(pos, ProbabilityDistributions.rndNormal(mean, stddev, ProbabilityDistributions.randomGenerator)); } - /// Number of digits in given numeral system - /// - /// the token position - private void NDIG(int pos) { + /// Number of digits in given numeral system + /// + /// the token position + private void NDIG(int pos) { double number = getTokenValue(pos + 1); double numeralSystemBase = getTokenValue(pos + 2); f2SetDecreaseRemove(pos, NumberTheory.numberOfDigits(number, numeralSystemBase)); } - /// Digit at position - base 10 numeral system - /// - /// the token position - private void DIGIT10(int pos) { + /// Digit at position - base 10 numeral system + /// + /// the token position + private void DIGIT10(int pos) { double number = getTokenValue(pos + 1); double position = getTokenValue(pos + 2); f2SetDecreaseRemove(pos, NumberTheory.digitAtPosition(number, position)); } - /// Prime factor value - /// - /// the token position - private void FACTVAL(int pos) { + /// Prime factor value + /// + /// the token position + private void FACTVAL(int pos) { double number = getTokenValue(pos + 1); double id = getTokenValue(pos + 2); f2SetDecreaseRemove(pos, NumberTheory.primeFactorValue(number, id)); } - /// Prime factor value exponent - /// - /// the token position - private void FACTEXP(int pos) { + /// Prime factor value exponent + /// + /// the token position + private void FACTEXP(int pos) { double number = getTokenValue(pos + 1); double id = getTokenValue(pos + 2); f2SetDecreaseRemove(pos, NumberTheory.primeFactorExponent(number, id)); } - /// Nth order root - /// - /// the token position - private void ROOT(int pos) { + /// Nth order root + /// + /// the token position + private void ROOT(int pos) { double n = getTokenValue(pos + 1); double x = getTokenValue(pos + 2); f2SetDecreaseRemove(pos, MathFunctions.root(n, x)); } - /// Lower incomplete special Gamma function - /// - /// the token position - private void INC_GAMMA_LOWER(int pos) { + /// Lower incomplete special Gamma function + /// + /// the token position + private void INC_GAMMA_LOWER(int pos) { double s = getTokenValue(pos+1); double x = getTokenValue(pos+2); f2SetDecreaseRemove(pos, SpecialFunctions.incompleteGammaLower(s, x) ); } - /// Upper incomplete special Gamma function - /// - /// the token position - private void INC_GAMMA_UPPER(int pos) { + /// Upper incomplete special Gamma function + /// + /// the token position + private void INC_GAMMA_UPPER(int pos) { double s = getTokenValue(pos+1); double x = getTokenValue(pos+2); f2SetDecreaseRemove(pos, SpecialFunctions.incompleteGammaUpper(s, x) ); } - /// Lower regularized special Gamma function - /// - /// the token position - private void REG_GAMMA_LOWER(int pos) { + /// Lower regularized special Gamma function + /// + /// the token position + private void REG_GAMMA_LOWER(int pos) { double s = getTokenValue(pos+1); double x = getTokenValue(pos+2); f2SetDecreaseRemove(pos, SpecialFunctions.regularizedGammaLowerP(s, x) ); } - /// Lower regularized special Gamma function - /// - /// the token position - private void REG_GAMMA_UPPER(int pos) { + /// Lower regularized special Gamma function + /// + /// the token position + private void REG_GAMMA_UPPER(int pos) { double s = getTokenValue(pos+1); double x = getTokenValue(pos+2); f2SetDecreaseRemove(pos, SpecialFunctions.regularizedGammaUpperQ(s, x) ); } - /// IF function - /// - /// the token position - private void IF_CONDITION(int pos) { + /// IF function + /// + /// the token position + private void IF_CONDITION(int pos) { /* * Get condition string * 1st parameter @@ -3565,14 +3565,14 @@ private void IF_CONDITION(int pos) { ifExp.setVerboseMode(); ifSetRemove(pos, ifExp.calculate()); } - /// IFF function - /// - /// the token position - private void IFF(int pos) { + /// IFF function + /// + /// the token position + private void IFF(int pos) { /* * Get condition string * 1st parameter - */ + */ List iffParams = getFunctionParameters(pos, tokensList); FunctionParameter iffParam = iffParams[0]; int parametersNumber = iffParams.Count; @@ -3628,11 +3628,11 @@ private void IFF(int pos) { tokensList[pos].tokenLevel--; } } - /// IF - /// Sets tokens to number token - /// - /// the token position - private void IF(int pos) { + /// IF + /// Sets tokens to number token + /// + /// the token position + private void IF(int pos) { double ifCondition = tokensList[pos+1].tokenValue; double ifTrue = tokensList[pos+2].tokenValue; double ifFalse = tokensList[pos+3].tokenValue; @@ -3643,124 +3643,124 @@ private void IF(int pos) { result = Double.NaN; f3SetDecreaseRemove(pos, result ); } - /// Characteristic function (a,b) - /// - /// the token position - private void CHI(int pos) { + /// Characteristic function (a,b) + /// + /// the token position + private void CHI(int pos) { double x = getTokenValue(pos+1); double a = getTokenValue(pos+2); double b = getTokenValue(pos+3); f3SetDecreaseRemove(pos, MathFunctions.chi(x, a, b) ); } - /// Characteristic function [a,b] - /// - /// the token position - private void CHI_LR(int pos) { + /// Characteristic function [a,b] + /// + /// the token position + private void CHI_LR(int pos) { double x = getTokenValue(pos+1); double a = getTokenValue(pos+2); double b = getTokenValue(pos+3); f3SetDecreaseRemove(pos, MathFunctions.chi_LR(x, a, b) ); } - /// Characteristic function [a,b) - /// - /// the token position - private void CHI_L(int pos) { + /// Characteristic function [a,b) + /// + /// the token position + private void CHI_L(int pos) { double x = getTokenValue(pos+1); double a = getTokenValue(pos+2); double b = getTokenValue(pos+3); f3SetDecreaseRemove(pos, MathFunctions.chi_L(x, a, b) ); } - /// Characteristic function (a,b] - /// - /// the token position - private void CHI_R(int pos) { + /// Characteristic function (a,b] + /// + /// the token position + private void CHI_R(int pos) { double x = getTokenValue(pos + 1); double a = getTokenValue(pos + 2); double b = getTokenValue(pos + 3); f3SetDecreaseRemove(pos, MathFunctions.chi_R(x, a, b)); } - /// Probability Distribution Function - Uniform Continuous distribution - /// - /// the token position - private void PDF_UNIFORM_CONT(int pos) { + /// Probability Distribution Function - Uniform Continuous distribution + /// + /// the token position + private void PDF_UNIFORM_CONT(int pos) { double x = getTokenValue(pos + 1); double a = getTokenValue(pos + 2); double b = getTokenValue(pos + 3); f3SetDecreaseRemove(pos, ProbabilityDistributions.pdfUniformContinuous(x, a, b)); } - /// Cumulative Distribution Function - Uniform Continuous distribution - /// - /// the token position - private void CDF_UNIFORM_CONT(int pos) { + /// Cumulative Distribution Function - Uniform Continuous distribution + /// + /// the token position + private void CDF_UNIFORM_CONT(int pos) { double x = getTokenValue(pos + 1); double a = getTokenValue(pos + 2); double b = getTokenValue(pos + 3); f3SetDecreaseRemove(pos, ProbabilityDistributions.cdfUniformContinuous(x, a, b)); } - /// Quantile Function - Uniform Continuous distribution - /// - /// the token position - private void QNT_UNIFORM_CONT(int pos) { + /// Quantile Function - Uniform Continuous distribution + /// + /// the token position + private void QNT_UNIFORM_CONT(int pos) { double q = getTokenValue(pos + 1); double a = getTokenValue(pos + 2); double b = getTokenValue(pos + 3); f3SetDecreaseRemove(pos, ProbabilityDistributions.qntUniformContinuous(q, a, b)); } - /// Probability Distribution Function - Normal distribution - /// - /// the token position - private void PDF_NORMAL(int pos) { + /// Probability Distribution Function - Normal distribution + /// + /// the token position + private void PDF_NORMAL(int pos) { double x = getTokenValue(pos + 1); double mean = getTokenValue(pos + 2); double stddev = getTokenValue(pos + 3); f3SetDecreaseRemove(pos, ProbabilityDistributions.pdfNormal(x, mean, stddev)); } - /// Cumulative Distribution Function - Normal distribution - /// - /// the token position - private void CDF_NORMAL(int pos) { + /// Cumulative Distribution Function - Normal distribution + /// + /// the token position + private void CDF_NORMAL(int pos) { double x = getTokenValue(pos + 1); double mean = getTokenValue(pos + 2); double stddev = getTokenValue(pos + 3); f3SetDecreaseRemove(pos, ProbabilityDistributions.cdfNormal(x, mean, stddev)); } - /// Quantile Function - Normal distribution - /// - /// the token position - private void QNT_NORMAL(int pos) { + /// Quantile Function - Normal distribution + /// + /// the token position + private void QNT_NORMAL(int pos) { double q = getTokenValue(pos + 1); double mean = getTokenValue(pos + 2); double stddev = getTokenValue(pos + 3); f3SetDecreaseRemove(pos, ProbabilityDistributions.qntNormal(q, mean, stddev)); } - /// Digit at position - numeral system with given base - /// - /// the token position - private void DIGIT(int pos) { + /// Digit at position - numeral system with given base + /// + /// the token position + private void DIGIT(int pos) { double number = getTokenValue(pos + 1); double position = getTokenValue(pos + 2); double numeralSystemBase = getTokenValue(pos + 3); f3SetDecreaseRemove(pos, NumberTheory.digitAtPosition(number, position, numeralSystemBase)); } - /// Incomplete beta special function - /// - /// the token position - private void INC_BETA(int pos) { + /// Incomplete beta special function + /// + /// the token position + private void INC_BETA(int pos) { double x = getTokenValue(pos+1); double a = getTokenValue(pos+2); double b = getTokenValue(pos+3); f3SetDecreaseRemove(pos, SpecialFunctions.incompleteBeta(a, b, x) ); } - /// Regularized incomplete beta special function - /// - /// the token position - private void REG_BETA(int pos) { + /// Regularized incomplete beta special function + /// + /// the token position + private void REG_BETA(int pos) { double x = getTokenValue(pos+1); double a = getTokenValue(pos+2); double b = getTokenValue(pos+3); f3SetDecreaseRemove(pos, SpecialFunctions.regularizedBeta(a, b, x) ); } - /// + /// /// Updating missing tokens (i.e. indexes i sum operator). Used when creating /// internal expressions based on the sublist of tokens. /// @@ -3777,10 +3777,10 @@ private void updateMissingTokens(List tokens, String keyWord, int tokenId t.tokenTypeId = tokenTypeId; } } - /// + /// /// Update missing tokens in expression related /// to iterative operators. - /// + /// /// /// Index parameter of the iterative operator /// Parameters list of the iterative operator @@ -3792,11 +3792,11 @@ private void updateMissingTokens(ArgumentParameter index, IterativeOperatorParam updateMissingTokens(iterParams.funParam.tokens, iterParams.indexParam.paramStr, index.index, Argument.TYPE_ID); } } - /// Evaluates ranges 'from', 'to', 'delta' for the iterative operator - /// - /// Index parameter of the iterative operator - /// Parameters list of the iterative operator - private void evalFromToDeltaParameters(ArgumentParameter index, IterativeOperatorParameters iterParams) { + /// Evaluates ranges 'from', 'to', 'delta' for the iterative operator + /// + /// Index parameter of the iterative operator + /// Parameters list of the iterative operator + private void evalFromToDeltaParameters(ArgumentParameter index, IterativeOperatorParameters iterParams) { /* * Create from, to, fun expression * based on the from string @@ -3829,14 +3829,14 @@ private void evalFromToDeltaParameters(ArgumentParameter index, IterativeOperato iterParams.delta = iterParams.deltaExp.calculate(); } } - /// + /// /// 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 - ///
+ ///
/// /// the token position private void SUM(int pos) { @@ -3848,17 +3848,17 @@ private void SUM(int pos) { clearParamArgument(index); calcSetDecreaseRemove(pos, sigma, true); } - /// - /// 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 - ///
- /// - /// the token position - 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 + ///
+ /// + /// the token position + private void PROD(int pos) { IterativeOperatorParameters iterParams = new IterativeOperatorParameters(getFunctionParameters(pos, tokensList)); ArgumentParameter index = getParamArgument(iterParams.indexParam.paramStr); updateMissingTokens(index, iterParams); @@ -3867,17 +3867,17 @@ private void PROD(int pos) { clearParamArgument(index); calcSetDecreaseRemove(pos, product, true); } - /// - /// 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 - ///
- /// - /// the token position - 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 + ///
+ /// + /// the token position + private void MIN(int pos) { IterativeOperatorParameters iterParams = new IterativeOperatorParameters(getFunctionParameters(pos, tokensList)); ArgumentParameter index = getParamArgument(iterParams.indexParam.paramStr); updateMissingTokens(index, iterParams); @@ -3886,14 +3886,14 @@ private void MIN(int pos) { clearParamArgument(index); calcSetDecreaseRemove(pos, min); } - /// + /// /// 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 - ///
+ ///
/// /// the token position private void MAX(int pos) { @@ -3905,17 +3905,17 @@ private void MAX(int pos) { clearParamArgument(index); calcSetDecreaseRemove(pos, max); } - /// - /// 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 - ///
- /// - /// the token position - 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 + ///
+ /// + /// the token position + private void AVG(int pos) { IterativeOperatorParameters iterParams = new IterativeOperatorParameters(getFunctionParameters(pos, tokensList)); ArgumentParameter index = getParamArgument(iterParams.indexParam.paramStr); updateMissingTokens(index, iterParams); @@ -3924,17 +3924,17 @@ private void AVG(int pos) { clearParamArgument(index); calcSetDecreaseRemove(pos, avg, true); } - /// - /// 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 - ///
- /// - /// the token position - 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 + ///
+ /// + /// the token position + private void VAR(int pos) { IterativeOperatorParameters iterParams = new IterativeOperatorParameters(getFunctionParameters(pos, tokensList)); ArgumentParameter index = getParamArgument(iterParams.indexParam.paramStr); updateMissingTokens(index, iterParams); @@ -3943,17 +3943,17 @@ private void VAR(int pos) { clearParamArgument(index); calcSetDecreaseRemove(pos, var, true); } - /// - /// 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 - ///
- /// - /// the token position - 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 + ///
+ /// + /// the token position + private void STD(int pos) { IterativeOperatorParameters iterParams = new IterativeOperatorParameters(getFunctionParameters(pos, tokensList)); ArgumentParameter index = getParamArgument(iterParams.indexParam.paramStr); updateMissingTokens(index, iterParams); @@ -3963,11 +3963,11 @@ private void STD(int pos) { calcSetDecreaseRemove(pos, std, true); } - /// Function derivative - /// - /// the token position - /// the type of derivative (LEFT, RIGHT, ...) - private void DERIVATIVE(int pos, int derivativeType) { + /// Function derivative + /// + /// the token position + /// the type of derivative (LEFT, RIGHT, ...) + private void DERIVATIVE(int pos, int derivativeType) { /* * 2 params - der( f(x), x ) * 3 params - der( f(x), x, x0 ) @@ -4057,11 +4057,11 @@ private void DERIVATIVE(int pos, int derivativeType) { } clearParamArgument(x); } - /// Function derivative - /// - /// the token position - /// the type of derivative (left, right, etc...) - private void DERIVATIVE_NTH(int pos, int derivativeType) { + /// Function derivative + /// + /// the token position + /// the type of derivative (left, right, etc...) + private void DERIVATIVE_NTH(int pos, int derivativeType) { const double DEF_EPS = 1E-6; /* * Default max number of steps @@ -4120,10 +4120,10 @@ private void DERIVATIVE_NTH(int pos, int derivativeType) { } clearParamArgument(x); } - /// Function integral - /// - /// the token position - private void INTEGRAL(int pos) { + /// Function integral + /// + /// the token position + private void INTEGRAL(int pos) { // Default epsilon const double DEF_EPS = 1E-6 ; @@ -4163,10 +4163,10 @@ private void INTEGRAL(int pos) { calcSetDecreaseRemove(pos, Calculus.integralTrapezoid(funExp, x.argument, aExp.calculate(), bExp.calculate(), eps, maxSteps) ); clearParamArgument(x); } - /// Function SOLVE - /// - /// the token position - private void SOLVE(int pos) { + /// Function SOLVE + /// + /// the token position + private void SOLVE(int pos) { /// Default epsilon const double DEF_EPS = 1E-9; /* @@ -4205,10 +4205,10 @@ private void SOLVE(int pos) { calcSetDecreaseRemove(pos, Calculus.solveBrent(funExp, x.argument, aExp.calculate(), bExp.calculate(), eps, maxSteps)); clearParamArgument(x); } - /// Forward difference operator - /// - /// the token position - private void FORWARD_DIFFERENCE(int pos) { + /// Forward difference operator + /// + /// the token position + private void FORWARD_DIFFERENCE(int pos) { List parameters = getFunctionParameters(pos, tokensList); FunctionParameter funParam = parameters[0]; FunctionParameter xParam = parameters[1]; @@ -4227,10 +4227,10 @@ private void FORWARD_DIFFERENCE(int pos) { calcSetDecreaseRemove(pos, Calculus.forwardDifference(funExp, h, x.argument) ); clearParamArgument(x); } - /// Backward diffrence operator - /// - /// the token position - private void BACKWARD_DIFFERENCE(int pos) { + /// Backward diffrence operator + /// + /// the token position + private void BACKWARD_DIFFERENCE(int pos) { List parameters = getFunctionParameters(pos, tokensList); FunctionParameter funParam = parameters[0]; FunctionParameter xParam = parameters[1]; @@ -4249,174 +4249,174 @@ private void BACKWARD_DIFFERENCE(int pos) { calcSetDecreaseRemove(pos, Calculus.backwardDifference(funExp, h, x.argument) ); clearParamArgument(x); } - /// Minimum variadic - /// Sets tokens to number token - /// - /// the token position - private void MIN_VARIADIC(int pos) { + /// Minimum variadic + /// Sets tokens to number token + /// + /// the token position + private void MIN_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.min( mXparser.arrayList2double(numbers) ), numbers.Count ); } - /// Maximum variadic - /// Sets tokens to number token - /// - /// the token position - private void MAX_VARIADIC(int pos) { + /// Maximum variadic + /// Sets tokens to number token + /// + /// the token position + private void MAX_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.max( mXparser.arrayList2double(numbers) ), numbers.Count ); } - /// Sum variadic - /// Sets tokens to number token - /// - /// the token position - private void SUM_VARIADIC(int pos) { + /// Sum variadic + /// Sets tokens to number token + /// + /// the token position + private void SUM_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.sum(mXparser.arrayList2double(numbers)), numbers.Count, true); } - /// Sum variadic - /// Sets tokens to number token - /// - /// the token position - private void PROD_VARIADIC(int pos) { + /// Sum variadic + /// Sets tokens to number token + /// + /// the token position + private void PROD_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.prod(mXparser.arrayList2double(numbers)), numbers.Count, true); } - /// Average variadic - /// Sets tokens to number token - /// - /// the token position - private void AVG_VARIADIC(int pos) { + /// Average variadic + /// Sets tokens to number token + /// + /// the token position + private void AVG_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, Statistics.avg(mXparser.arrayList2double(numbers)), numbers.Count, true); } - /// Variance variadic - /// Sets tokens to number token - /// - /// the token position - private void VAR_VARIADIC(int pos) { + /// Variance variadic + /// Sets tokens to number token + /// + /// the token position + private void VAR_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, Statistics.var(mXparser.arrayList2double(numbers)), numbers.Count, true); } - /// Standard deviation variadic - /// Sets tokens to number token - /// - /// the token position - private void STD_VARIADIC(int pos) { + /// Standard deviation variadic + /// Sets tokens to number token + /// + /// the token position + private void STD_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, Statistics.std(mXparser.arrayList2double(numbers)), numbers.Count, true); } - /// Continued fraction - /// - /// the token position - private void CONTINUED_FRACTION(int pos) { + /// Continued fraction + /// + /// the token position + private void CONTINUED_FRACTION(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, MathFunctions.continuedFraction( mXparser.arrayList2double(numbers) ), numbers.Count ); } - /// Continued polynomial - /// - /// the token position - private void CONTINUED_POLYNOMIAL(int pos) { + /// Continued polynomial + /// + /// the token position + private void CONTINUED_POLYNOMIAL(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, MathFunctions.continuedPolynomial( mXparser.arrayList2double(numbers) ), numbers.Count ); } - /// Greates Common Divisor - /// - /// the token position - private void GCD(int pos) { + /// Greates Common Divisor + /// + /// the token position + private void GCD(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.gcd( mXparser.arrayList2double(numbers) ), numbers.Count ); } - /// Lowest Common Multiply - /// - /// the token position - private void LCM(int pos) { + /// Lowest Common Multiply + /// + /// the token position + private void LCM(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.lcm( mXparser.arrayList2double(numbers) ), numbers.Count ); } - /// Random number from list - /// - /// the token position - private void RND_LIST(int pos) { + /// Random number from list + /// + /// the token position + private void RND_LIST(int pos) { List numbers = getNumbers(pos); int n = numbers.Count; int i = ProbabilityDistributions.rndIndex(n, ProbabilityDistributions.randomGenerator); variadicSetDecreaseRemove(pos, numbers[i], numbers.Count); } - /// Coalesce - /// - /// the token position - private void COALESCE(int pos) { + /// Coalesce + /// + /// the token position + private void COALESCE(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, MathFunctions.coalesce(mXparser.arrayList2double(numbers)), numbers.Count); } - /// OR_VARIADIC - /// - /// the token position - private void OR_VARIADIC(int pos) { + /// OR_VARIADIC + /// + /// the token position + private void OR_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, BooleanAlgebra.orVariadic( mXparser.arrayList2double(numbers) ), numbers.Count ); } - /// AND_VARIADIC - /// - /// the token position - private void AND_VARIADIC(int pos) { + /// AND_VARIADIC + /// + /// the token position + private void AND_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, BooleanAlgebra.andVariadic( mXparser.arrayList2double(numbers) ), numbers.Count ); } - /// XOR_VARIADIC - /// - /// the token position - private void XOR_VARIADIC(int pos) { + /// XOR_VARIADIC + /// + /// the token position + private void XOR_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, BooleanAlgebra.xorVariadic( mXparser.arrayList2double(numbers) ), numbers.Count ); } - /// ARGMIN_VARIADIC - /// - /// the token position - private void ARGMIN_VARIADIC(int pos) { + /// ARGMIN_VARIADIC + /// + /// the token position + private void ARGMIN_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.argmin(mXparser.arrayList2double(numbers)), numbers.Count ); } - /// ARGMAX_VARIADIC - /// - /// the token position - private void ARGMAX_VARIADIC(int pos) { + /// ARGMAX_VARIADIC + /// + /// the token position + private void ARGMAX_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.argmax(mXparser.arrayList2double(numbers)), numbers.Count ); } - /// MEDIAN_VARIADIC - /// - /// the token position - private void MEDIAN_VARIADIC(int pos) { + /// MEDIAN_VARIADIC + /// + /// the token position + private void MEDIAN_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, Statistics.median(mXparser.arrayList2double(numbers)), numbers.Count ); } - /// MODE_VARIADIC - /// - /// the token position - private void MODE_VARIADIC(int pos) { + /// MODE_VARIADIC + /// + /// the token position + private void MODE_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, Statistics.mode(mXparser.arrayList2double(numbers)), numbers.Count ); } - /// BASE_VARIADIC - /// - /// the token position - private void BASE_VARIADIC(int pos) { + /// BASE_VARIADIC + /// + /// the token position + private void BASE_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.convOthBase2Decimal(mXparser.arrayList2double(numbers)), numbers.Count ); } - /// NDIST_VARIADIC - /// - /// the token position - private void NDIST_VARIADIC(int pos) { + /// NDIST_VARIADIC + /// + /// the token position + private void NDIST_VARIADIC(int pos) { List numbers = getNumbers(pos); variadicSetDecreaseRemove(pos, NumberTheory.numberOfDistValues(mXparser.arrayList2double(numbers)), numbers.Count ); } - /// Parser symbols - /// Removes comma - /// - /// the token position) - private void COMMA(int pos) { + /// Parser symbols + /// Removes comma + /// + /// the token position) + private void COMMA(int pos) { tokensList.RemoveAt(pos); } /// Parser symbols @@ -4443,7 +4443,7 @@ public bool checkLexSyntax() { bool syntax = NO_SYNTAX_ERRORS; recursionCallsCounter = 0; if (expressionString.Length == 0) { - syntax = SYNTAX_ERROR_OR_STATUS_UNKNOWN; + syntax = SYNTAX_ERROR_OR_STATUS_UNKNOWN; errorMessage = "Empty expression string\n"; return syntax; } @@ -4478,17 +4478,17 @@ private int checkCalculusParameter(String param) { errors++; return errors; } - /// + /// /// Checks if argument given in the function parameter is known /// in the expression. /// - /// + /// /// the function parameter /// - /// + /// /// true if argument is known, /// otherwise returns false. - /// + /// private bool checkIfKnownArgument(FunctionParameter param) { if (param.tokens.Count > 1) return false; @@ -4502,9 +4502,9 @@ private bool checkIfKnownArgument(FunctionParameter param) { /// the function parameter /// /// - /// true if there is only 1 token with unknown type, + /// true if there is only 1 token with unknown type, /// otherwise returns false. - /// + /// private bool checkIfUnknownToken(FunctionParameter param) { if (param.tokens.Count > 1) return false; @@ -4516,11 +4516,11 @@ private bool checkIfUnknownToken(FunctionParameter param) { /// Checking the syntax (recursively). /// /// string representing the recurssion level. - /// + /// /// - /// true if syntax was correct, + /// true if syntax was correct, /// otherwise returns false. - /// + /// private bool checkSyntax(String level, bool functionWithBodyExt) { if ( (expressionWasModified == false) && (syntaxStatus == NO_SYNTAX_ERRORS) && (optionsChangesetNumber == mXparser.optionsChangesetNumber) ) { errorMessage = level + "already checked - no errors!\n"; @@ -4539,7 +4539,7 @@ private bool checkSyntax(String level, bool functionWithBodyExt) { errorMessage = level +"checking ...\n"; bool syntax = NO_SYNTAX_ERRORS; if (expressionString.Length == 0) { - syntax = SYNTAX_ERROR_OR_STATUS_UNKNOWN; + syntax = SYNTAX_ERROR_OR_STATUS_UNKNOWN; errorMessage = errorMessage + level + "Empty expression string\n"; syntaxStatus = syntax; recursionCallPending = false; @@ -4841,9 +4841,9 @@ private bool checkSyntax(String level, bool functionWithBodyExt) { /// Calculates the expression value /// /// - /// The expression value if syntax was ok, + /// The expression value if syntax was ok, /// otherwise returns . - /// + /// public double calculate() { computingTime = 0; long startTime = mXparser.currentTimeMillis(); @@ -5388,7 +5388,7 @@ public double calculate() { return result; } /// Calculates unary function - /// + /// /// token position private void f1ArgCalc(int pos) { switch (tokensList[pos].tokenId) { @@ -5457,7 +5457,7 @@ private void f1ArgCalc(int pos) { } } /// Calculates binary function - /// + /// /// Token position private void f2ArgCalc(int pos) { switch (tokensList[pos].tokenId) { @@ -5491,7 +5491,7 @@ private void f2ArgCalc(int pos) { } } /// Calculates function with 3 arguments - /// + /// /// Token position private void f3ArgCalc(int pos) { switch (tokensList[pos].tokenId) { @@ -5512,7 +5512,7 @@ private void f3ArgCalc(int pos) { } } /// Calculates Variadic function - /// + /// /// Token position private void variadicFunCalc(int pos) { switch (tokensList[pos].tokenId) { @@ -5541,10 +5541,10 @@ private void variadicFunCalc(int pos) { case FunctionVariadic.NDIST_ID: NDIST_VARIADIC(pos); break; } } - /// Calculates calculus operators - /// - /// the token position - private void calculusCalc(int pos) { + /// Calculates calculus operators + /// + /// the token position + private void calculusCalc(int pos) { switch (tokensList[pos].tokenId) { case CalculusOperator.SUM_ID: SUM(pos); break; case CalculusOperator.PROD_ID: PROD(pos); break; @@ -5563,10 +5563,10 @@ private void calculusCalc(int pos) { case CalculusOperator.BACKW_DIFF_ID: BACKWARD_DIFFERENCE(pos); break; } } - /// Calculates boolean operators - /// - /// the token position - private void bolCalc(int pos) { + /// Calculates boolean operators + /// + /// the token position + private void bolCalc(int pos) { switch (tokensList[pos].tokenId) { case BooleanOperator.AND_ID: AND(pos); break; case BooleanOperator.CIMP_ID: CIMP(pos); break; @@ -5580,10 +5580,10 @@ private void bolCalc(int pos) { case BooleanOperator.XOR_ID: XOR(pos); break; } } - /// Calculates Bitwise operators - /// - /// the token position - private void bitwiseCalc(int pos) { + /// Calculates Bitwise operators + /// + /// the token position + private void bitwiseCalc(int pos) { switch (tokensList[pos].tokenId) { case BitwiseOperator.AND_ID: BITWISE_AND(pos); break; case BitwiseOperator.OR_ID: BITWISE_OR(pos); break; @@ -5599,10 +5599,10 @@ private void bitwiseCalc(int pos) { *================================================= */ /// - /// Class level method for adding specific automatic + /// Class level method for adding specific automatic /// parser keywords relates to User Defined Functions /// i.e.: par(i), [npar] - /// + /// private void addUDFSpecificParserKeyWords() { addKeyWord(Function1Arg.PARAM_STR, Function1Arg.PARAM_DESC, Function1Arg.PARAM_ID, Function1Arg.PARAM_SYN, Function1Arg.PARAM_SINCE, Function1Arg.TYPE_ID); addKeyWord(ConstantValue.NPAR_STR, ConstantValue.NPAR_DESC, ConstantValue.NPAR_ID, ConstantValue.NPAR_SYN, ConstantValue.NPAR_SINCE, ConstantValue.TYPE_ID); @@ -6203,9 +6203,9 @@ private void validateParserKeyWords() { /// /// - /// + /// /// - /// + /// private void addKeyWord(String wordString, String wordDescription, int wordId, String wordSyntax, String wordSince, int wordTypeId) { if ((mXparser.tokensToRemove.Count > 0) || (mXparser.tokensToModify.Count > 0)) if ((wordTypeId == Function1Arg.TYPE_ID) || @@ -6224,17 +6224,17 @@ private void addKeyWord(String wordString, String wordDescription, int wordId, S wordString = tm.newToken; if (tm.newTokenDescription != null) wordDescription = tm.newTokenDescription; - wordSyntax = wordSyntax.Replace(tm.currentToken, tm.newToken); - } - } + wordSyntax = wordSyntax.Replace(tm.currentToken, tm.newToken); + } + } } keyWordsList.Add(new KeyWord(wordString, wordDescription, wordId, wordSyntax, wordSince, wordTypeId)); } /// - /// Checks whether unknown token represents number literal + /// Checks whether unknown token represents number literal /// provided in different numeral base system, where /// base is between 1 and 36. - /// + ///
/// /// The token not know to the parser private void checkOtherNumberBases(Token token) { @@ -6307,10 +6307,10 @@ private void checkOtherNumberBases(Token token) { } } /// - /// Checks whether unknown token represents fraction + /// Checks whether unknown token represents fraction /// provided as fraction or mixed fraction /// - /// + /// /// The token not know to the parser private void checkFraction(Token token) { int tokenStrLength = token.tokenStr.Length; @@ -6351,10 +6351,10 @@ private void checkFraction(Token token) { token.tokenValue = fractionValue; } /// - /// Adds expression token + /// Adds expression token /// Method is called by the tokenExpressionString() /// while parsing string expression - /// + ///
/// /// the token string /// the key word @@ -6853,9 +6853,9 @@ private void copyInitialTokens() { private const String UNITCONST = "unit/const"; private const String ERROR = "error"; /// - /// Tokenizes expression string and returns tokens list, + /// Tokenizes expression string and returns tokens list, /// including: string, type, level. - /// + ///
/// /// Copy of initial tokens. /// @@ -6888,15 +6888,15 @@ public List getCopyOfInitialTokens() { return tokensListCopy; } /// - /// Returns missing user defined arguments names, i.e. + /// 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. - /// + ///
/// /// - /// Array of missing user defined arguments names + /// Array of missing user defined arguments names /// - distinct strings. - /// + /// public String[] getMissingUserDefinedArguments() { List tokens = getCopyOfInitialTokens(); List missingArguments = new List(); @@ -6911,15 +6911,15 @@ public String[] getMissingUserDefinedArguments() { return missArgs; } /// - /// Returns missing user defined units names, i.e. + /// Returns missing user defined units names, i.e. /// 2*[w] + [q] where [w] and [q] are not defined /// function will return [w] and [q]. - /// + ///
/// /// - /// Array of missing user defined units names + /// Array of missing user defined units names /// - distinct strings. - /// + /// public String[] getMissingUserDefinedUnits() { List tokens = getCopyOfInitialTokens(); List missingUnits = new List(); @@ -6934,15 +6934,15 @@ public String[] getMissingUserDefinedUnits() { return missUnits; } /// - /// Returns missing user defined functions names, i.e. + /// Returns missing user defined functions names, i.e. /// sin(x) + fun(x,y) where fun is not defined /// function will return fun. - /// + /// /// /// - /// Array of missing user defined functions names + /// Array of missing user defined functions names /// - distinct strings. - /// + /// public String[] getMissingUserDefinedFunctions() { List tokens = getCopyOfInitialTokens(); List missingFunctions = new List(); @@ -7084,11 +7084,11 @@ public List getKeyWords() { /// Returns list of key words known to the parser /// /// - /// Give any string to filter list of key words against this string. + /// Give any string to filter list of key words against this string. /// User more precise syntax: str=tokenString, desc=tokenDescription, /// syn=TokenSyntax, sin=tokenSince, wid=wordId, tid=wordTypeId /// to narrow the result. - /// + /// /// /// List of keywords known to the parser filter against query string. /// @@ -7173,7 +7173,7 @@ private void showArguments() { } /// /// - /// + /// private void printSystemInfo(String info, bool withExpressionString) { if (withExpressionString) mXparser.consolePrint( /*"[" + this + "]" + */ "[" + description + "]" + "[" + expressionString + "] " + info); From f647e25cb2194e2d6aef83380725338992465141 Mon Sep 17 00:00:00 2001 From: Adam Spofford Date: Mon, 19 Aug 2019 17:05:29 -0700 Subject: [PATCH 06/15] Document Function.cs --- .../mariuszgromada/math/mxparser/Function.cs | 1148 ++++++++--------- 1 file changed, 558 insertions(+), 590 deletions(-) diff --git a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Function.cs b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Function.cs index b65aa665..e4cc01c6 100644 --- a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Function.cs +++ b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Function.cs @@ -58,129 +58,102 @@ using System.Collections.Generic; namespace org.mariuszgromada.math.mxparser { - /** - * Function class provides possibility to define user functions. - * Functions can be used in further processing by any expression, - * dependent or recursive argument, function, etc... For expamle: - * - *
    - *
  • 'f(x) = sin(x)' - *
  • 'g(x,y) = sin(x)+cos(y)' - *
  • 'h(x,y = f(x)+g(y,x)' - *
  • in general 'f(x1,x2,...,xn)' where x1,...,xn are arguments - *
- * - *

- * When creating a function you should avoid names reserved as - * parser keywords, in general words known in mathematical language - * as function names, operators (for example: - * sin, cos, +, -, pi, e, etc...). Please be informed that after associating - * the constant with the expression, function or dependent/recursive argument - * its name will be recognized by the parser as reserved key word. - * It means that it could not be the same as any other key word known - * by the parser for this particular expression. - * - * @author Mariusz Gromada
- * mariuszgromada.org@gmail.com
- * MathSpace.pl
- * MathParser.org - mXparser project page
- * mXparser on GitHub
- * mXparser on SourceForge
- * mXparser on Bitbucket
- * mXparser on CodePlex
- * Janet Sudoku - project web page
- * Janet Sudoku on GitHub
- * Janet Sudoku on CodePlex
- * Janet Sudoku on SourceForge
- * Janet Sudoku on BitBucket
- * Scalar Free
- * Scalar Pro
- * ScalarMath.org
- * - * @version 4.3.0 - * - * @see RecursiveArgument - * @see Expression - * @see Argument - * @see Constant - * @see FunctionExtension - * - */ + ///

+ /// Function class provides possibility to define user functions. + /// Functions can be used in further processing by any expression, + /// dependent or recursive argument, function, etc... For expamle: + /// + /// + /// 'f(x) = sin(x)' + /// 'g(x,y) = sin(x)+cos(y)' + /// 'h(x,y = f(x)+g(y,x)' + /// in general 'f(x1,x2,...,xn)' where x1,...,xn are arguments + /// + /// + /// + /// + /// When creating a function you should avoid names reserved as + /// parser keywords, in general words known in mathematical language + /// as function names, operators (for example: + /// sin, cos, +, -, pi, e, etc...). Please be informed that after associating + /// the constant with the expression, function or dependent/recursive argument + /// its name will be recognized by the parser as reserved key word. + /// It means that it could not be the same as any other key word known + /// by the parser for this particular expression. + /// + /// Author:
+ /// Mariusz Gromada
+ /// mariuszgromada.org@gmail.com
+ /// MathSpace.pl
+ /// MathParser.org - mXparser project page
+ /// mXparser on GitHub
+ /// mXparser on SourceForge
+ /// mXparser on Bitbucket
+ /// mXparser on CodePlex
+ /// Janet Sudoku - project web page
+ /// Janet Sudoku on GitHub
+ /// Janet Sudoku on CodePlex
+ /// Janet Sudoku on SourceForge
+ /// Janet Sudoku on BitBucket
+ /// Scalar Free
+ /// Scalar Pro
+ /// ScalarMath.org + /// + /// Version: 4.3.0 + ///
+ /// + /// + /// + /// + /// + /// [CLSCompliant(true)] public class Function : PrimitiveElement { - /** - * No syntax errors in the function. - */ + /// No syntax errors in the function. public const bool NO_SYNTAX_ERRORS = Expression.NO_SYNTAX_ERRORS; - /** - * Syntax error in the function or syntax status unknown. - */ + /// Syntax error in the function or syntax status unknown. public const bool SYNTAX_ERROR_OR_STATUS_UNKNOWN = Expression.SYNTAX_ERROR_OR_STATUS_UNKNOWN; - /** - * When function was not found - */ + /// When function was not found public const int NOT_FOUND = Expression.NOT_FOUND; - /** - * Function type id identifier - */ + /// Function type id identifier public const int TYPE_ID = 103; public const String TYPE_DESC = "User defined function"; - /** - * Function with body based on the expression string. - * - * @see Function#getFunctionBodyType() - */ + /// Function with body based on the expression string. + /// + /// public const int BODY_RUNTIME = 1; - /** - * Function with body based on the extended code. - * - * @see FunctionExtension - * @see Function#getFunctionBodyType() - */ + /// Function with body based on the extended code. + /// + /// + /// public const int BODY_EXTENDED = 2; - /** - * Function body type. - * - * @see Function#BODY_RUNTIME - * @see Function#BODY_EXTENDED - * @see Function#getFunctionBodyType() - */ + /// Function body type. + /// + /// + /// + /// private int functionBodyType; - /** - * function expression - */ + /// function expression internal Expression functionExpression; - /** - * function name - */ + /// function name private String functionName; - /** - * function description - */ + /// function description private String description; - /** - * Indicates whether UDF is variadic - */ + /// Indicates whether UDF is variadic internal bool isVariadic; - /** - * The number of function parameters - */ + /// The number of function parameters private int parametersNumber; - /** - * Function extension (body based in code) - * - * @see FunctionExtension - * @see FunctionExtensionVariadic - * @see Function#Function(String, FunctionExtension) - */ + /// Function extension (body based in code) + /// + /// + /// + /// private FunctionExtension functionExtension; - /** - * Function extension variadic (body based in code) - * - * @see FunctionExtension - * @see FunctionExtensionVariadic - * @see Function#Function(String, FunctionExtension) - */ + /// Function extension variadic (body based in code) + /// + /// + /// + /// private FunctionExtensionVariadic functionExtensionVariadic; /*================================================= * @@ -188,17 +161,21 @@ public class Function : PrimitiveElement { * *================================================= */ - /** - * Constructor - creates function from function name - * and function expression string. - * - * @param functionName the function name - * @param functionExpressionString the function expression string - * @param elements Optional elements list (variadic - comma separated) of types: Argument, Constant, Function - * - * @see PrimitiveElement - * @see Expression - */ + /// + /// Constructor - creates function from function name + /// and function expression string. + /// + /// + /// the function name + /// the function expression string + /// + /// Optional elements list (variadic - comma separated) + /// of types: , , + /// + /// + /// + /// + /// public Function(String functionName ,String functionExpressionString, params PrimitiveElement[] elements) : base(Function.TYPE_ID) { if (mXparser.regexMatch(functionName, ParserSymbol.nameOnlyTokenRegExp)) { @@ -219,17 +196,19 @@ public Function(String functionName functionExpression.setSyntaxStatus(SYNTAX_ERROR_OR_STATUS_UNKNOWN, "[" + functionName + "]" + "Invalid function name, pattern not matches: " + ParserSymbol.nameTokenRegExp); } } - /** - * Constructor - creates function from function name, - * function expression string and argument names. - * - * @param functionName the function name - * @param functionExpressionString the function expression string - * @param argumentsNames the arguments names (variadic parameters) - * comma separated list - * - * @see Expression - */ + /// + /// Constructor - creates function from function name, + /// function expression string and argument names. + /// + /// + /// the function name + /// the function expression string + /// + /// the arguments names (variadic parameters) + /// comma separated list + /// + /// + /// public Function(String functionName ,String functionExpressionString ,params String[] argumentsNames ) : base(Function.TYPE_ID) { @@ -253,20 +232,23 @@ public Function(String functionName functionExpression.setSyntaxStatus(SYNTAX_ERROR_OR_STATUS_UNKNOWN, "[" + functionName + "]" + "Invalid function name, pattern not matches: " + ParserSymbol.nameTokenRegExp); } } - /** - * Constructor for function definition in natural math language, - * for instance providing on string "f(x,y) = sin(x) + cos(x)" - * is enough to define function "f" with parameters "x and y" - * and function body "sin(x) + cos(x)". - * - * @param functionDefinitionString Function definition in the form - * of one String, ie "f(x,y) = sin(x) + cos(x)" - * @param elements Optional elements list (variadic - comma separated) - * of types: Argument, Constant, Function - * - * @see PrimitiveElement - * - */ + /// + /// Constructor for function definition in natural math language, + /// for instance providing on string "f(x,y) = sin(x) + cos(x)" + /// is enough to define function "f" with parameters "x and y" + /// and function body "sin(x) + cos(x)". + /// + /// + /// Function definition in the form + /// of one String, ie "f(x,y) = sin(x) + cos(x)" + /// + /// + /// Optional elements list (variadic - comma separated) + /// of types: , , + /// + /// + /// + /// public Function(String functionDefinitionString, params PrimitiveElement[] elements) : base(Function.TYPE_ID) { parametersNumber = 0; if (mXparser.regexMatch(functionDefinitionString, ParserSymbol.functionDefStrRegExp)) { @@ -306,14 +288,14 @@ public Function(String functionDefinitionString, params PrimitiveElement[] eleme functionExpression.setSyntaxStatus(Expression.SYNTAX_ERROR_OR_STATUS_UNKNOWN, errorMessage); } } - /** - * Constructor for function definition based on - * your own source code - this is via implementation - * of FunctionExtension interface. - * - * @param functionName Function name - * @param functionExtension Your own source code - */ + /// + /// Constructor for function definition based on + /// your own source code - this is via implementation + /// of interface. + /// + /// + /// Function name + /// Your own source code public Function(String functionName, FunctionExtension functionExtension) : base(Function.TYPE_ID) { if (mXparser.regexMatch(functionName, ParserSymbol.nameOnlyTokenRegExp)) { this.functionName = functionName; @@ -330,14 +312,14 @@ public Function(String functionName, FunctionExtension functionExtension) : base functionExpression.setSyntaxStatus(SYNTAX_ERROR_OR_STATUS_UNKNOWN, "[" + functionName + "]" + "Invalid function name, pattern not matches: " + ParserSymbol.nameTokenRegExp); } } - /** - * Constructor for function definition based on - * your own source code - this is via implementation - * of FunctionExtensionVariadic interface. - * - * @param functionName Function name - * @param functionExtensionVariadic Your own source code - */ + /// + /// Constructor for function definition based on + /// your own source code - this is via implementation + /// of interface. + /// + /// + /// Function name + /// Your own source code public Function(String functionName, FunctionExtensionVariadic functionExtensionVariadic) : base(Function.TYPE_ID) { if ( mXparser.regexMatch(functionName, ParserSymbol.nameOnlyTokenRegExp) ) { this.functionName = functionName; @@ -354,12 +336,12 @@ public Function(String functionName, FunctionExtensionVariadic functionExtension functionExpression.setSyntaxStatus(SYNTAX_ERROR_OR_STATUS_UNKNOWN, "[" + functionName + "]" + "Invalid function name, pattern not matches: " + ParserSymbol.nameTokenRegExp); } } - /** - * Private constructor used for function cloning. - * - * @param function the function, which is going - * to be cloned. - */ + /// Private constructor used for function cloning. + /// + /// + /// the function, which is going + /// to be cloned. + /// private Function(Function function) : base(Function.TYPE_ID) { functionName = function.functionName; description = function.description; @@ -372,20 +354,25 @@ private Function(Function function) : base(Function.TYPE_ID) { if (function.functionExtensionVariadic != null) functionExtensionVariadic = function.functionExtensionVariadic.clone(); } } - /** - * Constructor for function definition in natural math language, - * for instance providing on string "f(x,y) = sin(x) + cos(x)" - * is enough to define function "f" with parameters "x and y" - * and function body "sin(x) + cos(x)". - * - * @param functionDefinitionString Function definition in the form - * of one String, ie "f(x,y) = sin(x) + cos(x)" - * @param elements Optional elements list (variadic - comma separated) - * of types: Argument, Constant, Function - * - * @see PrimitiveElement - * - */ + /// + /// Constructor for function definition in natural math language, + /// for instance providing on string "f(x,y) = sin(x) + cos(x)" + /// is enough to define function "f" with parameters "x and y" + /// and function body "sin(x) + cos(x)". + /// + /// + /// + /// Function definition in the form + /// of one String, ie "f(x,y) = sin(x) + cos(x)" + /// + /// + /// Optional elements list (variadic - comma separated) + /// of types: , , + /// + /// + /// + /// + /// public void setFunction(String functionDefinitionString, params PrimitiveElement[] elements) { parametersNumber = 0; if ( mXparser.regexMatch(functionDefinitionString, ParserSymbol.functionDefStrRegExp) ) { @@ -425,43 +412,33 @@ public void setFunction(String functionDefinitionString, params PrimitiveElement functionExpression.setSyntaxStatus(Expression.SYNTAX_ERROR_OR_STATUS_UNKNOWN, errorMessage); } } - /** - * Sets function description. - * - * @param description the function description - */ + /// Sets function description. + /// + /// the function description public void setDescription(String description) { this.description = description; } - /** - * Gets function description - * - * @return Function description as string - */ + /// Gets function description + /// + /// Function description as string public String getDescription() { return description; } - /** - * Gets function name. - * - * @return Function name as string. - */ + /// Gets function name. + /// + /// Function name as string. public String getFunctionName() { return functionName; } - /** - * Gets function expression string - * - * @return Function expression as string. - */ + /// Gets function expression string + /// + /// Function expression as string. public String getFunctionExpressionString() { return functionExpression.getExpressionString(); } - /** - * Sets function name. - * - * @param functionName the function name - */ + /// Sets function name. + /// + /// the function name public void setFunctionName(String functionName) { if (mXparser.regexMatch(functionName, ParserSymbol.nameOnlyTokenRegExp)) { this.functionName = functionName; @@ -469,13 +446,13 @@ public void setFunctionName(String functionName) { } else functionExpression.setSyntaxStatus(SYNTAX_ERROR_OR_STATUS_UNKNOWN, "[" + functionName + "]" + "Invalid function name, pattern not matches: " + ParserSymbol.nameTokenRegExp); } - /** - * Sets value of function argument (function parameter). - * - * @param argumentIndex the argument index (in accordance to - * arguments declaration sequence) - * @param argumentValue the argument value - */ + /// Sets value of function argument (function parameter). + /// + /// + /// the argument index (in accordance to + /// arguments declaration sequence) + /// + /// the argument value public void setArgumentValue(int argumentIndex, double argumentValue) { if (isVariadic == false) if (functionBodyType == BODY_RUNTIME) @@ -483,20 +460,18 @@ public void setArgumentValue(int argumentIndex, double argumentValue) { else if (isVariadic == false) functionExtension.setParameterValue(argumentIndex, argumentValue); } - /** - * Returns function body type: {@link Function#BODY_RUNTIME} {@link Function#BODY_EXTENDED} - * @return Returns function body type: {@link Function#BODY_RUNTIME} {@link Function#BODY_EXTENDED} - */ + /// Returns function body type: + /// + /// Returns function body type: public int getFunctionBodyType() { return functionBodyType; } - /** - * Checks function syntax - * - * @return syntax status: Function.NO_SYNTAX_ERRORS, - * Function.SYNTAX_ERROR_OR_STATUS_UNKNOWN - * - */ + /// Checks function syntax + /// + /// + /// syntax status: , + /// + /// public bool checkSyntax() { bool syntaxStatus = Function.NO_SYNTAX_ERRORS; if (functionBodyType != BODY_EXTENDED) @@ -504,26 +479,20 @@ public bool checkSyntax() { checkRecursiveMode(); return syntaxStatus; } - /** - * Returns error message after checking the syntax. - * - * @return Error message as string. - */ + /// Returns error message after checking the syntax. + /// + /// Error message as string. public String getErrorMessage() { return functionExpression.getErrorMessage(); } - /** - * clone method - */ + /// clone method internal Function clone() { Function newFunction = new Function(this); return newFunction; } - /** - * Calculates function value - * - * @return Function value as double. - */ + /// Calculates function value + /// + /// Function value as double. public double calculate() { if (functionBodyType == BODY_RUNTIME) return functionExpression.calculate(); @@ -541,13 +510,11 @@ public double calculate() { } else return Double.NaN; } } - /** - * Calculates function value - * - * @param params the function parameters values (as doubles) - * - * @return function value as double. - */ + /// Calculates function value + /// + /// the function parameters values (as doubles) + /// + /// function value as double. public double calculate(params double[] parameters) { if (parameters.Length > 0) { functionExpression.UDFVariadicParamsAtRunTime = new List(); @@ -575,13 +542,14 @@ public double calculate(params double[] parameters) { return Double.NaN; } } - /** - * Calculates function value - * - * @param arguments function parameters (as Arguments) - * - * @return function value as double - */ + /// Calculates function value + /// + /// + /// ]function parameters (as + /// Arguments) + /// + /// + /// function value as double public double calculate(params Argument[] arguments) { double[] parameters; if (arguments.Length > 0) { @@ -615,28 +583,36 @@ public double calculate(params Argument[] arguments) { return Double.NaN; } } - /** - * Adds user defined elements (such as: Arguments, Constants, Functions) - * to the function expressions. - * - * @param elements Elements list (variadic), where Argument, Constant, Function - * extend the same class PrimitiveElement - * - * @see PrimitiveElement - */ + /// + /// Adds user defined elements (such as: Arguments, + /// Constants, Functions) + /// to the function expressions. + /// + /// + /// + /// Elements list (variadic), where , + /// , + /// extend the same class + /// + /// + /// public void addDefinitions(params PrimitiveElement[] elements) { if (functionBodyType == Function.BODY_RUNTIME) functionExpression.addDefinitions(elements); } - /** - * Removes user defined elements (such as: Arguments, Constants, Functions) - * from the function expressions. - * - * @param elements Elements list (variadic), where Argument, Constant, Function - * extend the same class PrimitiveElement - * - * @see PrimitiveElement - */ + /// + /// Removes user defined elements (such as: Arguments, + /// Constants, Functions) + /// from the function expressions. + /// + /// + /// + /// Elements list (variadic), where , + /// , + /// extend the same class + /// + /// + /// public void removeDefinitions(params PrimitiveElement[] elements) { if (functionBodyType == Function.BODY_RUNTIME) functionExpression.removeDefinitions(elements); @@ -655,113 +631,113 @@ private int countRecursiveArguments() { if (argument.getArgumentType() == Argument.RECURSIVE_ARGUMENT) numOfRecursiveArguments++; return numOfRecursiveArguments; } - /** - * Adds arguments (variadic) to the function expression definition. - * - * @param arguments the arguments list - * (comma separated list) - * @see Argument - * @see RecursiveArgument - */ + /// Adds arguments (variadic) to the function expression definition. + /// + /// + /// the arguments list + /// (comma separated list) + /// + /// + /// + /// public void addArguments(params Argument[] arguments) { if (functionBodyType == Function.BODY_RUNTIME) { functionExpression.addArguments(arguments); parametersNumber = functionExpression.getArgumentsNumber() - countRecursiveArguments(); } } - /** - * Enables to define the arguments (associated with - * the function expression) based on the given arguments names. - * - * @param argumentsNames the arguments names (variadic) - * comma separated list - * - * @see Argument - * @see RecursiveArgument - */ + /// + /// Enables to define the arguments (associated with + /// the function expression) based on the given arguments names. + /// + /// + /// + /// the arguments names (variadic) + /// comma separated list + /// + /// + /// + /// public void defineArguments(params String[] argumentsNames) { if (functionBodyType == Function.BODY_RUNTIME) { functionExpression.defineArguments(argumentsNames); parametersNumber = functionExpression.getArgumentsNumber() - countRecursiveArguments(); } } - /** - * Enables to define the argument (associated with the function expression) - * based on the argument name and the argument value. - * - * @param argumentName the argument name - * @param argumentValue the the argument value - * - * @see Argument - * @see RecursiveArgument - */ + /// + /// Enables to define the argument (associated with the function expression) + /// based on the argument name and the argument value. + /// + /// + /// the argument name + /// the the argument value + /// + /// + /// public void defineArgument(String argumentName, double argumentValue) { if (functionBodyType == Function.BODY_RUNTIME) { functionExpression.defineArgument(argumentName, argumentValue); parametersNumber = functionExpression.getArgumentsNumber() - countRecursiveArguments(); } } - /** - * Gets argument index from the function expression. - * - * @param argumentName the argument name - * - * @return The argument index if the argument name was found, - * otherwise returns Argument.NOT_FOUND - * - * @see Argument - * @see RecursiveArgument - */ + /// Gets argument index from the function expression. + /// + /// the argument name + /// + /// + /// The argument index if the argument name was found, + /// otherwise returns + /// + /// + /// + /// public int getArgumentIndex(String argumentName) { if (functionBodyType == Function.BODY_RUNTIME) return functionExpression.getArgumentIndex(argumentName); else return -1; } - /** - * Gets argument from the function expression. - * - * - * @param argumentName the argument name - * - * @return The argument if the argument name was found, - * otherwise returns null. - * - * @see Argument - * @see RecursiveArgument - */ + /// Gets argument from the function expression + /// + /// the argument name + /// + /// + /// The argument if the argument name was found, + /// otherwise returns null. + /// + /// + /// + /// public Argument getArgument(String argumentName) { if (functionBodyType == Function.BODY_RUNTIME) return functionExpression.getArgument(argumentName); else return null; } - /** - * Gets argument from the function expression. - * - * @param argumentIndex the argument index - * - * @return Argument if the argument index is between 0 and - * the last available argument index (getArgumentsNumber()-1), - * otherwise returns null. - * - * @see Argument - * @see RecursiveArgument - */ + /// Gets argument from the function expression. + /// + /// the argument index + /// + /// + /// Argument if the argument index is between 0 and + /// the last available argument index (-1), + /// otherwise returns null. + /// + /// + /// + /// public Argument getArgument(int argumentIndex) { if (functionBodyType == Function.BODY_RUNTIME) return functionExpression.getArgument(argumentIndex); else return null; } - /** - * Gets number of parameters associated with the function expression. - * - * @return The number of function parameters (int >= 0) - * - * @see Argument - * @see RecursiveArgument - */ + /// Gets number of parameters associated with the function expression. + /// + /// The number of function parameters (int >= 0) + /// + /// + /// public int getParametersNumber() { if (isVariadic == false) return parametersNumber; @@ -772,24 +748,23 @@ public int getParametersNumber() { return -1; } } - /** - * Set parameters number. - * - * @param parametersNumber the number of function parameters (default = number of arguments - * (less number might be specified). - */ + /// Set parameters number. + /// + /// + /// the number of function parameters (default = number of arguments + /// (less number might be specified). + /// public void setParametersNumber(int parametersNumber) { if (functionBodyType == Function.BODY_RUNTIME) { this.parametersNumber = parametersNumber; functionExpression.setExpressionModifiedFlag(); } } - /** - * Gets user defined function parameter name - * - * @param parameterIndex Parameter index between 0 and n-1 - * @return If parameter exists returns parameters name, otherwise empty string is returned. - */ + /// Gets user defined function parameter name + /// + /// Parameter index between 0 and n-1 + /// + /// If parameter exists returns parameters name, otherwise empty string is returned. public String getParameterName(int parameterIndex) { if (parameterIndex < 0) return ""; if (parameterIndex >= parametersNumber) return ""; @@ -797,59 +772,58 @@ public String getParameterName(int parameterIndex) { if (functionBodyType == BODY_EXTENDED) return this.functionExtension.getParameterName(parameterIndex); return ""; } - /** - * Gets number of arguments associated with the function expression. - * - * @return The number of arguments (int >= 0) - * - * @see Argument - * @see RecursiveArgument - */ + /// Gets number of arguments associated with the function expression. + /// + /// The number of arguments (int >= 0) + /// + /// + /// public int getArgumentsNumber() { if (functionBodyType == Function.BODY_RUNTIME) return functionExpression.getArgumentsNumber(); else return 0; } - /** - * Removes first occurrences of the arguments - * associated with the function expression. - * - * @param argumentsNames the arguments names - * (variadic parameters) comma separated - * list - * - * @see Argument - * @see RecursiveArgument - */ + /// + /// Removes first occurrences of the arguments + /// associated with the function expression. + /// + /// + /// + /// the arguments names + /// (variadic parameters) comma separated list + /// + /// + /// + /// public void removeArguments(params String[] argumentsNames) { if (functionBodyType == Function.BODY_RUNTIME) { functionExpression.removeArguments(argumentsNames); parametersNumber = functionExpression.getArgumentsNumber() - countRecursiveArguments(); } } - /** - * Removes first occurrences of the arguments - * associated with the function expression. - * - * @param arguments the arguments (variadic parameters) - * comma separated list - * - * @see Argument - * @see RecursiveArgument - */ + /// + /// Removes first occurrences of the arguments + /// associated with the function expression. + /// + /// + /// + /// the arguments (variadic parameters) + /// comma separated list + /// + /// + /// + /// public void removeArguments(params Argument[] arguments) { if (functionBodyType == Function.BODY_RUNTIME) { functionExpression.removeArguments(arguments); parametersNumber = functionExpression.getArgumentsNumber() - countRecursiveArguments(); } } - /** - * Removes all arguments associated with the function expression. - * - * @see Argument - * @see RecursiveArgument - */ + /// Removes all arguments associated with the function expression. + /// + /// + /// public void removeAllArguments() { if (functionBodyType == Function.BODY_RUNTIME) { functionExpression.removeAllArguments(); @@ -863,127 +837,129 @@ public void removeAllArguments() { * *================================================= */ - /** - * Adds constants (variadic parameters) to the function expression definition. - * - * @param constants the constants - * (comma separated list) - * - * @see Constant - */ + /// Adds constants (variadic parameters) to the function expression definition. + /// + /// + /// the constants + /// (comma separated list) + /// + /// + /// public void addConstants(params Constant[] constants) { if (functionBodyType == Function.BODY_RUNTIME) functionExpression.addConstants(constants); } - /** - * Enables to define the constant (associated with - * the function expression) based on the constant name and - * constant value. - * - * @param constantName the constant name - * @param constantValue the constant value - * - * @see Constant - */ + /// + /// Enables to define the constant (associated with + /// the function expression) based on the constant name and + /// constant value. + /// + /// + /// the constant name + /// the constant value + /// + /// public void defineConstant(String constantName, double constantValue) { if (functionBodyType == Function.BODY_RUNTIME) functionExpression.defineConstant(constantName, constantValue); } - /** - * Gets constant index associated with the function expression. - * - * @param constantName the constant name - * - * @return Constant index if constant name was found, - * otherwise return Constant.NOT_FOUND. - * - * @see Constant - */ + /// Gets constant index associated with the function expression. + /// + /// the constant name + /// + /// + /// Constant index if constant name was found, + /// otherwise return . + /// + /// + /// public int getConstantIndex(String constantName) { if (functionBodyType == Function.BODY_RUNTIME) return functionExpression.getConstantIndex(constantName); else return -1; } - /** - * Gets constant associated with the function expression. - * - * @param constantName the constant name - * - * @return Constant if constant name was found, - * otherwise return null. - * - * @see Constant - */ + /// Gets constant associated with the function expression. + /// + /// the constant name + /// + /// + /// Constant if constant name was found, + /// otherwise return null. + /// + /// + /// public Constant getConstant(String constantName) { if (functionBodyType == Function.BODY_RUNTIME) return functionExpression.getConstant(constantName); else return null; } - /** - * Gets constant associated with the function expression. - * - * @param constantIndex the constant index - * - * @return Constant if the constantIndex is between - * 0 and the last available constant index - * (getConstantsNumber() - 1), - * otherwise it returns null. - * - * @see Constant - */ + /// Gets constant associated with the function expression. + /// + /// the constant index + /// + /// + /// Constant if the constantIndex is between + /// 0 and the last available constant index + /// ( - 1), + /// otherwise it returns null. + /// + /// + /// public Constant getConstant(int constantIndex) { if (functionBodyType == Function.BODY_RUNTIME) return functionExpression.getConstant(constantIndex); else return null; } - /** - * Gets number of constants associated with the function expression. - * - * @return number of constants (int >= 0) - * - * @see Constant - */ + /// Gets number of constants associated with the function expression. + /// + /// number of constants (int >= 0) + /// + /// public int getConstantsNumber() { if (functionBodyType == Function.BODY_RUNTIME) return functionExpression.getConstantsNumber(); else return 0; } - /** - * Removes first occurrences of the constants - * associated with the function expression. - * - * @param constantsNames the constants names (variadic parameters) - * comma separated list - * - * @see Constant - */ + /// + /// Removes first occurrences of the constants + /// associated with the function expression. + /// + /// + /// + /// the constants names (variadic parameters) + /// comma separated list + /// + /// + /// public void removeConstants(params String[] constantsNames) { if (functionBodyType == Function.BODY_RUNTIME) functionExpression.removeConstants(constantsNames); } - /** - * Removes first occurrences of the constants - * associated with the function expression - * - * @param constants the constants (variadic parameters) - * comma separated list - * - * @see Constant - */ + /// + /// Removes first occurrences of the constants + /// associated with the function expression + /// + /// + /// + /// the constants (variadic parameters) + /// comma separated list + /// + /// + /// public void removeConstants(params Constant[] constants) { if (functionBodyType == Function.BODY_RUNTIME) functionExpression.removeConstants(constants); } - /** - * Removes all constants - * associated with the function expression - * - * @see Constant - */ + /// + /// Removes all constants + /// associated with the function expression + /// + /// + /// public void removeAllConstants() { functionExpression.removeAllConstants(); } @@ -994,130 +970,134 @@ public void removeAllConstants() { * *================================================= */ - /** - * Adds functions (variadic parameters) to the function expression definition. - * - * @param functions the functions - * (variadic parameters) comma separated list - * - * @see Function - */ + /// Adds functions (variadic parameters) to the function expression definition. + /// + /// + /// the functions + /// (variadic parameters) comma separated list + /// + /// + /// public void addFunctions(params Function[] functions) { if (functionBodyType == Function.BODY_RUNTIME) functionExpression.addFunctions(functions); } - /** - * Enables to define the function (associated with - * the function expression) based on the function name, - * function expression string and arguments names (variadic parameters). - * - * @param functionName the function name - * @param functionExpressionString the expression string - * @param argumentsNames the function arguments names - * (variadic parameters) - * comma separated list - * - * @see Function - */ + /// + /// Enables to define the function (associated with + /// the function expression) based on the function name, + /// function expression string and arguments names (variadic parameters). + /// + /// + /// the function name + /// the expression string + /// + /// the function arguments names + /// (variadic parameters) + /// comma separated list + /// + /// + /// public void defineFunction(String functionName, String functionExpressionString, params String[] argumentsNames) { if (functionBodyType == Function.BODY_RUNTIME) functionExpression.defineFunction(functionName, functionExpressionString, argumentsNames); } - /** - * Gets index of function associated with the function expression. - * - * @param functionName the function name - * - * @return Function index if function name was found, - * otherwise returns Function.NOT_FOUND - * - * @see Function - */ + /// Gets index of function associated with the function expression. + /// + /// the function name + /// + /// + /// Function index if function name was found, + /// otherwise returns + /// + /// + /// public int getFunctionIndex(String functionName) { if (functionBodyType == Function.BODY_RUNTIME) return functionExpression.getFunctionIndex(functionName); else return -1; } - /** - * Gets function associated with the function expression. - * - * @param functionName the function name - * - * @return Function if function name was found, - * otherwise returns null. - * - * @see Function - */ + /// Gets function associated with the function expression. + /// + /// the function name + /// + /// + /// Function if function name was found, + /// otherwise returns null. + /// + /// + /// public Function getFunction(String functionName) { if (functionBodyType == Function.BODY_RUNTIME) return functionExpression.getFunction(functionName); else return null; } - /** - * Gets function associated with the function expression. - * - * @param functionIndex the function index - * - * @return Function if function index is between 0 and - * the last available function index (getFunctionsNumber()-1), - * otherwise returns null. - * - * @see Function - */ + /// Gets function associated with the function expression. + /// + /// the function index + /// + /// + /// Function if function index is between 0 and + /// the last available function index (-1), + /// otherwise returns null. + /// + /// + /// public Function getFunction(int functionIndex) { if (functionBodyType == Function.BODY_RUNTIME) return functionExpression.getFunction(functionIndex); else return null; } - /** - * Gets number of functions associated with the function expression. - * - * @return number of functions (int >= 0) - * - * @see Function - */ + /// Gets number of functions associated with the function expression. + /// + /// number of functions (int >= 0) + /// + /// public int getFunctionsNumber() { if (functionBodyType == Function.BODY_RUNTIME) return functionExpression.getFunctionsNumber(); else return 0; } - /** - * Removes first occurrences of the functions - * associated with the function expression. - * - * @param functionsNames the functions names (variadic parameters) - * comma separated list - * - * @see Function - */ + /// + /// Removes first occurrences of the functions + /// associated with the function expression. + /// + /// + /// + /// the functions names (variadic parameters) + /// comma separated list + /// + /// + /// public void removeFunctions(params String[] functionsNames) { if (functionBodyType == Function.BODY_RUNTIME) functionExpression.removeFunctions(functionsNames); } - /** - * Removes first occurrences of the functions - * associated with the function expression. - * - * @param functions the functions (variadic parameters) - * comma separated list. - * - * @see Function - */ + /// + /// Removes first occurrences of the functions + /// associated with the function expression. + /// + /// + /// + /// the functions (variadic parameters) + /// comma separated list. + /// + /// + /// public void removeFunctions(params Function[] functions) { if (functionBodyType == Function.BODY_RUNTIME) functionExpression.removeFunctions(functions); } - /** - * Removes all functions - * associated with the function expression. - * - * @see Function - */ + /// + /// Removes all functions + /// associated with the function expression. + /// + /// + /// public void removeAllFunctions() { if (functionBodyType == Function.BODY_RUNTIME) functionExpression.removeAllFunctions(); @@ -1125,31 +1105,27 @@ public void removeAllFunctions() { /* * --------------------------------------------- */ - /** - * Enables verbose function mode - */ + /// Enables verbose function mode public void setVerboseMode() { functionExpression.setVerboseMode(); } - /** - * Disables function verbose mode (sets default silent mode) - */ + /// Disables function verbose mode (sets default silent mode) public void setSilentMode() { functionExpression.setSilentMode(); } - /** - * Returns verbose mode status - * - * @return true if verbose mode is on, - * otherwise returns false - */ + /// Returns verbose mode status + /// + /// + /// true if verbose mode is on, + /// otherwise returns false + /// public bool getVerboseMode() { return functionExpression.getVerboseMode(); } - /** - * Checks whether function name appears in function body - * if yes the recursive mode is being set - */ + /// + /// Checks whether function name appears in function body + /// if yes the recursive mode is being set + /// internal void checkRecursiveMode() { if (functionBodyType == Function.BODY_RUNTIME) { List functionExpressionTokens = functionExpression.getInitialTokens(); @@ -1162,45 +1138,37 @@ internal void checkRecursiveMode() { } } } - /** - * Gets recursive mode status - * - * @return true if recursive mode is enabled, - * otherwise returns false - * - */ + /// Gets recursive mode status + /// + /// + /// true if recursive mode is enabled, + /// otherwise returns false + /// + /// public bool getRecursiveMode() { return functionExpression.getRecursiveMode(); } - /** - * Gets computing time - * - * @return computing time in seconds. - */ + /// Gets computing time + /// + /// computing time in seconds. public double getComputingTime() { return functionExpression.getComputingTime(); } - /** - * Adds related expression. - * - * @param expression the related expression - */ + /// Adds related expression. + /// + /// the related expression internal void addRelatedExpression(Expression expression) { if (functionBodyType == Function.BODY_RUNTIME) functionExpression.addRelatedExpression(expression); } - /** - * Removes related expression. - * - * @param expression the related expression - */ + /// Removes related expression. + /// + /// the related expression internal void removeRelatedExpression(Expression expression) { if (functionBodyType == Function.BODY_RUNTIME) functionExpression.removeRelatedExpression(expression); } - /** - * Set expression modified flags in the related expressions. - */ + /// Set expression modified flags in the related expressions. internal void setExpressionModifiedFlags() { if (functionBodyType == Function.BODY_RUNTIME) functionExpression.setExpressionModifiedFlag(); From d23e042dd3b79d4701b36922bd2335b5f5b3af3b Mon Sep 17 00:00:00 2001 From: Adam Spofford Date: Mon, 19 Aug 2019 17:16:49 -0700 Subject: [PATCH 07/15] Document FunctionExtension.cs --- .../math/mxparser/FunctionExtension.cs | 121 +++++++++--------- 1 file changed, 57 insertions(+), 64 deletions(-) diff --git a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/FunctionExtension.cs b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/FunctionExtension.cs index ee693136..b8324c21 100644 --- a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/FunctionExtension.cs +++ b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/FunctionExtension.cs @@ -56,76 +56,69 @@ using System; namespace org.mariuszgromada.math.mxparser { - /** - * FunctionExtension provides interface for function algorithm definition. - * In this case algorithm definition is based on source code using - * JAVA (for JAVA / Android) or .NET. If implemented Function Extension - * object can be further used while Function object - * construction, which means it can extend mXparser math collection. - * mXparser extension with your own implementation can be achieved - * by implementing FunctionExtension interface, creating an FunctionExtension - * object, creating Function object based on FunctionExtension, adding Function - * object to Expression / mXparser definition. - * - * @author Mariusz Gromada
- * mariuszgromada.org@gmail.com
- * MathSpace.pl
- * MathParser.org - mXparser project page
- * mXparser on GitHub
- * mXparser on SourceForge
- * mXparser on Bitbucket
- * mXparser on CodePlex
- * Janet Sudoku - project web page
- * Janet Sudoku on GitHub
- * Janet Sudoku on CodePlex
- * Janet Sudoku on SourceForge
- * Janet Sudoku on BitBucket
- * Scalar Free
- * Scalar Pro
- * ScalarMath.org
- * - * @version 4.1.0 - * - * @see Function - * - */ + /// + /// FunctionExtension provides interface for function algorithm definition. + /// In this case algorithm definition is based on source code using + /// JAVA (for JAVA / Android) or .NET. If implemented Function Extension + /// object can be further used while object + /// construction, which means it can extend math collection. + /// mXparser extension with your own implementation can be achieved + /// by implementing FunctionExtension interface, creating an FunctionExtension + /// object, creating object based on FunctionExtension, adding + /// object to / definition. + /// + /// + /// + /// Author: Mariusz Gromada
+ /// mariuszgromada.org@gmail.com
+ /// MathSpace.pl
+ /// MathParser.org - mXparser project page
+ /// mXparser on GitHub
+ /// mXparser on SourceForge
+ /// mXparser on Bitbucket
+ /// mXparser on CodePlex
+ /// Janet Sudoku - project web page
+ /// Janet Sudoku on GitHub
+ /// Janet Sudoku on CodePlex
+ /// Janet Sudoku on SourceForge
+ /// Janet Sudoku on BitBucket
+ /// Scalar Free
+ /// Scalar Pro
+ /// ScalarMath.org + /// + /// Version: 4.1.0 + ///
+ /// + /// [CLSCompliant(true)] public interface FunctionExtension { - /** - * Gets parameters number. - * - * @return Returns parameters number. - */ + /// Gets parameters number. + /// + /// Returns parameters number. int getParametersNumber(); - /** - * Sets value of function parameter - * - * @param parameterIndex - parameter index (from 0 to n-1) - * @param parameterValue - parameter value - */ + /// Sets value of function parameter + /// + /// parameter index (from 0 to n-1) + /// parameter value void setParameterValue(int parameterIndex, double parameterValue); - /** - * Gets parameter name - * - * @param parameterIndex - parameter index (from 0 to n-1) - * @return Returns parameter name - */ + /// Gets parameter name + /// + /// parameter index (from 0 to n-1) + /// + /// Returns parameter name String getParameterName(int parameterIndex); - /** - * Actual algorithm implementation. - * - * @param params Function parameters. - * @return Function Extension value. - */ + /// Actual algorithm implementation + /// + /// Function Extension value. double calculate(); - /** - * Cloning in case of usage in Expression - * with recursive statements. - * - * @return Returns FunctionExtension object that was cloned. - * - * @see Expression#getRecursiveMode() - */ + /// + /// Cloning in case of usage in Expression + /// with recursive statements. + /// + /// + /// Returns FunctionExtension object that was cloned. + /// + /// FunctionExtension clone(); } } \ No newline at end of file From 60bd5c073f8fecb784c910bf210ba65c011dc4f8 Mon Sep 17 00:00:00 2001 From: Adam Spofford Date: Mon, 19 Aug 2019 17:22:08 -0700 Subject: [PATCH 08/15] Document FunctionExtensionVariadic.cs --- .../mxparser/FunctionExtensionVariadic.cs | 106 +++++++++--------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/FunctionExtensionVariadic.cs b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/FunctionExtensionVariadic.cs index 6ae8f3b7..29458e83 100644 --- a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/FunctionExtensionVariadic.cs +++ b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/FunctionExtensionVariadic.cs @@ -56,62 +56,62 @@ using System; namespace org.mariuszgromada.math.mxparser { - /** - * FunctionExtensionVariadic similarly to FunctionExtension - * provides interface for function algorithm definition. - * FunctionExtension is used for user defined functions with - * fixed number of parameters, where FunctionExtensionVariadic - * is used for user defined function with variadic number of - * parameters. Algorithm definition is based on source code using - * JAVA (for JAVA / Android) or .NET. If implemented Function Extension - * object can be further used while Function object - * construction, which means it can extend mXparser math collection. - * mXparser extension with your own implementation can be achieved - * by implementing FunctionExtensionVariadic interface, - * creating FunctionExtensionVariadic object, creating Function object - * based on FunctionExtensionVariadic, adding Function - * object to Expression / mXparser definition. - * - * @author Mariusz Gromada
- * mariuszgromada.org@gmail.com
- * MathSpace.pl
- * MathParser.org - mXparser project page
- * mXparser on GitHub
- * mXparser on SourceForge
- * mXparser on Bitbucket
- * mXparser on CodePlex
- * Janet Sudoku - project web page
- * Janet Sudoku on GitHub
- * Janet Sudoku on CodePlex
- * Janet Sudoku on SourceForge
- * Janet Sudoku on BitBucket
- * Scalar Free
- * Scalar Pro
- * ScalarMath.org
- * - * @version 4.2.0 - * - * @see FunctionExtension - * @see Function - * - */ + /// + /// FunctionExtensionVariadic similarly to + /// provides interface for function algorithm definition. + /// is used for user defined functions with + /// fixed number of parameters, where FunctionExtensionVariadic + /// is used for user defined function with variadic number of + /// parameters. Algorithm definition is based on source code using + /// JAVA (for JAVA / Android) or .NET. If implemented Function Extension + /// object can be further used while object + /// construction, which means it can extend math collection. + /// extension with your own implementation can be achieved + /// by implementing FunctionExtensionVariadic interface, + /// creating FunctionExtensionVariadic object, creating object + /// based on FunctionExtensionVariadic, adding + /// object to / definition. + /// + /// + /// + /// Author: Mariusz Gromada
+ /// mariuszgromada.org@gmail.com
+ /// MathSpace.pl
+ /// MathParser.org - mXparser project page
+ /// mXparser on GitHub
+ /// mXparser on SourceForge
+ /// mXparser on Bitbucket
+ /// mXparser on CodePlex
+ /// Janet Sudoku - project web page
+ /// Janet Sudoku on GitHub
+ /// Janet Sudoku on CodePlex
+ /// Janet Sudoku on SourceForge
+ /// Janet Sudoku on BitBucket
+ /// Scalar Free
+ /// Scalar Pro
+ /// ScalarMath.org + /// + /// Version: 4.2.0 + ///
+ /// + /// + /// [CLSCompliant(true)] public interface FunctionExtensionVariadic { - /** - * Actual algorithm implementation. - * @param parameters Variadic list of parameters - * - * @return Function Extension value. - */ + /// Actual algorithm implementation. + /// + /// Variadic list of parameters + /// + /// Function Extension value. double calculate(params double[] parameters); - /** - * Cloning in case of usage in Expression - * with recursive statements. - * - * @return Returns FunctionExtension object that was cloned. - * - * @see Expression#getRecursiveMode() - */ + /// + /// Cloning in case of usage in Expression + /// with recursive statements. + /// + /// + /// Returns FunctionExtension object that was cloned. + /// + /// FunctionExtensionVariadic clone(); } } \ No newline at end of file From e217f1571dc2e8eb3bbc6f5aa74894945cfec991 Mon Sep 17 00:00:00 2001 From: Adam Spofford Date: Mon, 19 Aug 2019 17:31:13 -0700 Subject: [PATCH 09/15] Unify header comments --- .../src/org/mariuszgromada/math/mxparser/Argument.cs | 7 ++++--- .../src/org/mariuszgromada/math/mxparser/Expression.cs | 3 +-- .../src/org/mariuszgromada/math/mxparser/Function.cs | 3 +-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Argument.cs b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Argument.cs index 26686c80..1372a84c 100644 --- a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Argument.cs +++ b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Argument.cs @@ -92,8 +92,7 @@ namespace org.mariuszgromada.math.mxparser { /// by the parser for this particular expression. Parser is case sensitive. /// /// - /// Authors:
- /// Mariusz Gromada
+ /// Author: Mariusz Gromada
/// mariuszgromada.org@gmail.com
/// MathSpace.pl
/// MathParser.org - mXparser project page
@@ -108,7 +107,9 @@ namespace org.mariuszgromada.math.mxparser { /// Janet Sudoku on BitBucket
/// Scalar Free
/// Scalar Pro
- /// ScalarMath.org
+ /// ScalarMath.org + /// + /// Version: 4.3.0 /// [CLSCompliant(true)] public class Argument : PrimitiveElement { diff --git a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Expression.cs b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Expression.cs index f801626e..15a37a9f 100644 --- a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Expression.cs +++ b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Expression.cs @@ -81,8 +81,7 @@ namespace org.mariuszgromada.math.mxparser { /// /// Class provides easy way to define multivariate arithmetic expression. /// - /// Authors:
- /// Mariusz Gromada
+ /// Author: Mariusz Gromada
/// mariuszgromada.org@gmail.com
/// MathSpace.pl
/// MathParser.org - mXparser project page
diff --git a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Function.cs b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Function.cs index e4cc01c6..0f849794 100644 --- a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Function.cs +++ b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Function.cs @@ -81,8 +81,7 @@ namespace org.mariuszgromada.math.mxparser { /// It means that it could not be the same as any other key word known /// by the parser for this particular expression. /// - /// Author:
- /// Mariusz Gromada
+ /// Author: Mariusz Gromada
/// mariuszgromada.org@gmail.com
/// MathSpace.pl
/// MathParser.org - mXparser project page
From b6c704ee15072de005132c11df901dee7bfa52b2 Mon Sep 17 00:00:00 2001 From: Adam Spofford Date: Mon, 19 Aug 2019 17:39:46 -0700 Subject: [PATCH 10/15] Document Miscellaneous.cs --- .../math/mxparser/Miscellaneous.cs | 85 ++++++++----------- 1 file changed, 35 insertions(+), 50 deletions(-) diff --git a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Miscellaneous.cs b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Miscellaneous.cs index 77ded3bc..95a09df8 100644 --- a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Miscellaneous.cs +++ b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/Miscellaneous.cs @@ -64,9 +64,7 @@ namespace org.mariuszgromada.math.mxparser { * *================================================= */ - /** - * Package level class for handling function parameters. - */ + /// Package level class for handling function parameters. internal class FunctionParameter { internal List tokens; internal String paramStr; @@ -83,9 +81,7 @@ internal FunctionParameter(List tokens, } } - /** - * Package level class for generating iterative operator parameters - */ + /// Package level class for generating iterative operator parameters internal class IterativeOperatorParameters { internal FunctionParameter indexParam; internal FunctionParameter fromParam; @@ -134,9 +130,7 @@ internal IterativeOperatorParameters(List functionParameters) } } } - /** - * Handling argument parameters - */ + /// Handling argument parameters internal class ArgumentParameter { internal Argument argument; internal double initialValue; @@ -150,11 +144,11 @@ internal ArgumentParameter() { presence = Expression.NOT_FOUND; } } - /** - * Internal token class - * which is used with stack while - * evaluation of tokens levels - */ + /// + /// Internal token class + /// which is used with stack while + /// evaluation of tokens levels + /// internal class TokenStackElement { internal int tokenIndex; internal int tokenId; @@ -175,47 +169,40 @@ internal SyntaxStackElement(String tokenStr, int tokenLevel) { * Comparators for sorting * --------------------------------------------------------- */ - /** - * Comparator for key word list sorting by key word string. - * This king of sorting is used while checking the syntax - * (duplicated key word error) - */ + /// + /// Comparator for key word list sorting by key word string. + /// This king of sorting is used while checking the syntax + /// (duplicated key word error) + /// class KwStrComparator : IComparer { - /** - * - */ + /// public int Compare(KeyWord kw1, KeyWord kw2) { String s1 = kw1.wordString; String s2 = kw2.wordString; return s1.CompareTo(s2); } } - /** - * Comparator for key word list sorting by - * descending key word length - * . - * This king of sorting is used while tokenizing - * (best match) - */ + /// + /// Comparator for key word list sorting by + /// descending key word length + /// + /// This king of sorting is used while tokenizing + /// (best match) + /// class DescKwLenComparator : IComparer { - /** - * - */ + /// public int Compare(KeyWord kw1, KeyWord kw2) { int l1 = kw1.wordString.Length; int l2 = kw2.wordString.Length; return l2 - l1; } } - /** - * Comparator for key word list sorting by - * type of the key word - * - */ + /// + /// Comparator for key word list sorting by + /// type of the key word + /// class KwTypeComparator : IComparer { - /** - * - */ + /// public int Compare(KeyWord kw1, KeyWord kw2) { int t1 = kw1.wordTypeId * 1000000 + kw1.wordId * 1000 + kw1.wordString.Length; int t2 = kw2.wordTypeId * 1000000 + kw2.wordId * 1000 + kw2.wordString.Length; @@ -227,13 +214,13 @@ public int Compare(KeyWord kw1, KeyWord kw2) { * Grouping constants by interfaces * --------------------------------------------------------- */ - /* - * Package level class to be used - * while function, argument, constant definition - * using only one string, ie: - * Function "f(x,y) = sin(x) + cos(y)" - * Constant "a = 5/20" - */ + /// + /// Package level class to be used + /// while function, argument, constant definition + /// using only one string, ie:
+ /// Function "f(x,y) = sin(x) + cos(y)"
+ /// Constant "a = 5/20" + ///
internal class HeadEqBody { private const bool ONLY_PARSER_KEYWORDS = true; internal String headStr; @@ -265,9 +252,7 @@ internal HeadEqBody(String definitionString) { } } } - /** - * Data structure used internally for token to be modified list - */ + /// Data structure used internally for token to be modified list internal class TokenModification { internal String currentToken; internal String newToken; From 29d2c97e631df70b4e7759f2410147e4bcb96357 Mon Sep 17 00:00:00 2001 From: Adam Spofford Date: Mon, 19 Aug 2019 18:29:47 -0700 Subject: [PATCH 11/15] Document mXparser.cs --- .../mariuszgromada/math/mxparser/mXparser.cs | 1460 ++++++++--------- 1 file changed, 709 insertions(+), 751 deletions(-) diff --git a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/mXparser.cs b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/mXparser.cs index 0eda7914..15e1a23f 100644 --- a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/mXparser.cs +++ b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/mXparser.cs @@ -63,180 +63,171 @@ [assembly: CLSCompliant(true)] namespace org.mariuszgromada.math.mxparser { - /** - * mXparser class provides usefull methods when parsing, calculating or - * parameters transforming. - * - * @author Mariusz Gromada
- * mariuszgromada.org@gmail.com
- * MathSpace.pl
- * MathParser.org - mXparser project page
- * mXparser on GitHub
- * mXparser on SourceForge
- * mXparser on Bitbucket
- * mXparser on CodePlex
- * Janet Sudoku - project web page
- * Janet Sudoku on GitHub
- * Janet Sudoku on CodePlex
- * Janet Sudoku on SourceForge
- * Janet Sudoku on BitBucket
- * Scalar Free
- * Scalar Pro
- * ScalarMath.org
- * - * @version 4.3.0 - * - * @see RecursiveArgument - * @see Expression - * @see Function - * @see Constant - */ + /// + /// mXparser class provides usefull methods when parsing, calculating or + /// parameters transforming. + /// + /// + /// + /// Author: Mariusz Gromada
+ /// mariuszgromada.org@gmail.com
+ /// MathSpace.pl
+ /// MathParser.org - mXparser project page
+ /// mXparser on GitHub
+ /// mXparser on SourceForge
+ /// mXparser on Bitbucket
+ /// mXparser on CodePlex
+ /// Janet Sudoku - project web page
+ /// Janet Sudoku on GitHub
+ /// Janet Sudoku on CodePlex
+ /// Janet Sudoku on SourceForge
+ /// Janet Sudoku on BitBucket
+ /// Scalar Free
+ /// Scalar Pro
+ /// ScalarMath.org + /// + /// Version: 4.3.0 + ///
+ /// + /// + /// + /// + /// [CLSCompliant(true)] public sealed class mXparser { - /** - * mXparser version - */ + /// mXparser version public const String VERSION = "4.3.0"; public const String VERSION_CODE_NAME = "Caprica"; public const String VERSION_NAME = VERSION + " " + VERSION_CODE_NAME; - /** - * FOUND / NOT_FOUND - * used for matching purposes - */ + /// + /// / + /// used for matching purposes + /// internal const int NOT_FOUND = -1; internal const int FOUND = 0; - /** - * Console output string for below methods - * - * @see mXparser.#consolePrintln(Object) - * @see mXparser.#consolePrint(Object) - */ + /// Console output string for below methods + /// + /// + /// private static volatile String CONSOLE_OUTPUT = ""; private static volatile String CONSOLE_PREFIX = "[mXparser-v." + VERSION + "] "; private static volatile String CONSOLE_OUTPUT_PREFIX = CONSOLE_PREFIX; private static volatile int CONSOLE_ROW_NUMBER = 1; - /** - * Prime numbers cache - */ + /// Prime numbers cache public static PrimesCache primesCache; public const int PRIMES_CACHE_NOT_INITIALIZED = -1; - /** - * Threads number settings - */ + /// Threads number settings private static int THREADS_NUMBER = Environment.ProcessorCount; - /** - * Empty expression for general help purposes. - */ + /// Empty expression for general help purposes. internal static volatile Expression mXparserExp = new Expression(); - /** - * Double floating-point precision arithmetic causes - * rounding problems, i.e. 0.1 + 0.1 + 0.1 is different than 0.3 - * - * mXparser provides intelligent ULP rounding to avoid this - * type of errors. - */ + /// + /// Double floating-point precision arithmetic causes + /// rounding problems, i.e. 0.1 + 0.1 + 0.1 is different than 0.3 + /// + /// mXparser provides intelligent ULP rounding to avoid this + /// type of errors. + /// internal volatile static bool ulpRounding = true; - /** - * Indicator marking whether to round final result - * to precise integer when result is very close - * to integer, solves problems like - * sin(pi) = 0 - */ + /// + /// Indicator marking whether to round final result + /// to precise integer when result is very close + /// to integer, solves problems like + /// sin(pi) = 0 + /// internal volatile static bool almostIntRounding = true; internal const int DEFAULT_MAX_RECURSION_CALLS = 200; - /** - * Internal limit for counter to avoid infinite loops while calculating - * expression defined in the way shown 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); - */ + /// + /// Internal limit for counter to avoid infinite loops while calculating + /// expression defined in the way shown 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); + /// + /// internal volatile static int MAX_RECURSION_CALLS = DEFAULT_MAX_RECURSION_CALLS; - /** - * List of built-in tokens to remove. - */ + /// List of built-in tokens to remove. internal volatile static List tokensToRemove = new List(); - /** - * List of built-in tokens to modify - */ + /// List of built-in tokens to modify internal volatile static List tokensToModify = new List(); - /** - * Indicator whether mXparser operates in radians / degrees mode - * true - degrees mode - * false - radians mode - * - * Default false (radians mode) - */ + /// + /// Indicator whether mXparser operates in radians / degrees mode + /// + /// truedegrees mode + /// falseradians mode + /// + /// + /// + /// Default false (radians mode) + /// internal volatile static bool degreesMode = false; - /** - * Indicator whether user defined tokens should override - * built-in tokens. - */ + /// + /// Indicator whether user defined tokens should override + /// built-in tokens. + /// internal volatile static bool overrideBuiltinTokens = false; - /** - * Options changeset - */ + /// Options changeset internal volatile static int optionsChangesetNumber = 0; - /** - * Indicator whether to call cancel current calculation - */ + /// Indicator whether to call cancel current calculation private static volatile bool cancelCurrentCalculationFlag = false; - /** - * Initialization of prime numbers cache. - * Cache size according to {@link PrimesCache#DEFAULT_MAX_NUM_IN_CACHE} - * @see PrimesCache - */ + /// + /// Initialization of prime numbers cache. + /// Cache size according to + /// + /// public static void initPrimesCache() { primesCache = new PrimesCache(); } - /** - * Returns true in case when primes cache initialization was successful, - * otherwise returns false. - * - * @return Returns true in case when primes cache initialization was successful, - * otherwise returns false. - */ + /// + /// Returns true in case when primes cache initialization was successful, + /// otherwise returns false. + /// + /// + /// Returns true in case when primes cache initialization was successful, + /// otherwise returns false. + /// public static bool isInitPrimesCacheSuccessful() { if (primesCache == null) return false; lock (primesCache) { return primesCache.isInitSuccessful(); } } - /** - * Initialization of prime numbers cache. - * @param mximumNumberInCache The maximum integer number that - * will be stored in cache. - * @see PrimesCache - */ + /// Initialization of prime numbers cache. + /// + /// + /// The maximum integer number that + /// will be stored in cache. + /// + /// + /// public static void initPrimesCache(int mximumNumberInCache) { primesCache = new PrimesCache(mximumNumberInCache); } - /** - * Initialization of prime numbers cache. - * @param primesCache The primes cache object - * @see PrimesCache - */ + /// Initialization of prime numbers cache. + /// + /// The primes cache object + /// + /// public static void initPrimesCache(PrimesCache primesCache) { mXparser.primesCache = primesCache; } - /** - * Sets {@link mXparser#primesCache} to null - */ + /// Sets to null public static void setNoPrimesCache() { primesCache = null; } - /** - * Returns maximum integer number in primes cache - * @return If primes cache was initialized then maximum number in - * primes cache, otherwise {@link mXparser#PRIMES_CACHE_NOT_INITIALIZED} - */ + /// Returns maximum integer number in primes cache + /// + /// + /// If primes cache was initialized then maximum number in + /// primes cache, otherwise + /// public static int getMaxNumInPrimesCache() { if (primesCache != null) { lock (primesCache) { @@ -245,23 +236,17 @@ public static int getMaxNumInPrimesCache() { } else return PRIMES_CACHE_NOT_INITIALIZED; } - /** - * Gets maximum threads number - * @return Threads number. - */ + /// Gets maximum threads number + /// + /// Threads number. public static int getThreadsNumber() { return THREADS_NUMBER; } - /** - * Sets default threads number - * @param threadsNumber Thread number. - */ + /// Sets default threads number public static void setDefaultThreadsNumber() { THREADS_NUMBER = Environment.ProcessorCount; } - /** - * Sets threads number - */ + /// Sets threads number public static void setThreadsNumber(int threadsNumber) { if (threadsNumber > 0) THREADS_NUMBER = threadsNumber; } @@ -271,29 +256,24 @@ public static void setThreadsNumber(int threadsNumber) { public static long currentTimeMillis() { return (long)(DateTime.UtcNow - Jan1st1970).TotalMilliseconds; } - /** - * Calculates function f(x0) (given as expression) assigning Argument x = x0; - * - * - * @param f the expression - * @param x the argument - * @param x0 the argument value - * - * @return f.calculate() - * - * @see Expression - */ + /// Calculates function f(x0) (given as expression) assigning Argument x = x0; + /// + /// the expression + /// the argument + /// the argument value + /// + /// f.calculate() + /// + /// public static double getFunctionValue(Expression f, Argument x, double x0) { x.setArgumentValue(x0); return f.calculate(); } - /** - * Converts List of double to double[] - * - * @param numbers the numbers list - * - * @return numbers array - */ + /// Converts List of double to double[] + /// + /// the numbers list + /// + /// numbers array public static double[] arrayList2double(List numbers) { if (numbers == null) return null; @@ -303,17 +283,18 @@ public static double[] arrayList2double(List numbers) { newNumbers[i] = numbers[i]; return newNumbers; } - /** - * Returns array of double values of the function f(i) - * calculated on the range: i = from to i = to by step = delta - * - * @param f Function expression - * @param index Index argument - * @param from 'from' value - * @param to 'to' value - * @param delta 'delta' step definition - * @return Array of function values - */ + /// + /// Returns array of double values of the function f(i) + /// calculated on the range: i = from to i = to by step = delta + /// + /// + /// Function expression + /// Index argument + /// 'from' value + /// 'to' value + /// 'delta' step definition + /// + /// Array of function values public static double[] getFunctionValues(Expression f, Argument index, double from, double to, double delta) { if ((Double.IsNaN(delta)) || (Double.IsNaN(from)) || (Double.IsNaN(to)) || (delta == 0)) return null; @@ -348,262 +329,265 @@ public static double[] getFunctionValues(Expression f, Argument index, double fr } else values = null; return values; } - /** - * Modifies random generator used by the ProbabilityDistributions class. - * - * @param randomGenerator Random generator. - * @see ProbabilityDistributions - * @see ProbabilityDistributions#randomGenerator - */ + /// Modifies random generator used by the ProbabilityDistributions class. + /// + /// Random generator. + /// + /// + /// public static void setRandomGenerator(Random randomGenerator) { if (randomGenerator != null) ProbabilityDistributions.randomGenerator = randomGenerator; } - /** - * Sets comparison mode to EXACT. - * @see BinaryRelations - */ + /// Sets comparison mode to EXACT. + /// + /// public static void setExactComparison() { BinaryRelations.setExactComparison(); } - /** - * Sets comparison mode to EPSILON. - * @see BinaryRelations - */ + /// Sets comparison mode to EPSILON. + /// + /// public static void setEpsilonComparison() { BinaryRelations.setEpsilonComparison(); } - /** - * Sets epsilon value. - * @param epsilon Epsilon value (grater than 0). - * - * @see #setEpsilonComparison() - * @see BinaryRelations - */ + /// Sets epsilon value. + /// + /// Epsilon value (grater than 0). + /// + /// + /// public static void setEpsilon(double epsilon) { BinaryRelations.setEpsilon(epsilon); } - /** - * Sets default epsilon value. - * - * @see #setEpsilonComparison() - * @see BinaryRelations#DEFAULT_COMPARISON_EPSILON - * @see BinaryRelations - */ + /// Sets default epsilon value. + /// + /// + /// + /// public static void setDefaultEpsilon() { BinaryRelations.setDefaultEpsilon(); } - /** - * Returns current epsilon value. - * @return Returns current epsilon value. - * - * @see #setEpsilonComparison() - * @see BinaryRelations - */ + /// Returns current epsilon value. + /// + /// Returns current epsilon value. + /// + /// + /// public static double getEpsilon() { return BinaryRelations.getEpsilon(); } - /** - * Checks if epsilon comparison mode is active; - * @return True if epsilon mode is active, otherwise returns false. - * @see #setEpsilonComparison() - * @see #setExactComparison() - * @see BinaryRelations - */ + /// Checks if epsilon comparison mode is active; + /// + /// True if epsilon mode is active, otherwise returns false. + /// + /// + /// + /// public static bool checkIfEpsilonMode() { return BinaryRelations.checkIfEpsilonMode(); } - /** - * Checks if exact comparison mode is active; - * @return True if exact mode is active, otherwise returns false. - * @see #setEpsilonComparison() - * @see #setExactComparison() - * @see BinaryRelations - */ + /// Checks if exact comparison mode is active; + /// + /// True if exact mode is active, otherwise returns false. + /// + /// + /// + /// public static bool checkIfExactMode() { return BinaryRelations.checkIfExactMode(); } - /** - * Double floating-point precision arithmetic causes - * rounding problems, i.e. 0.1 + 0.1 + 0.1 is slightly different than 0.3, - * additionally doubles are having a lot of advantages - * providing flexible number representation regardless of - * number size. mXparser is fully based on double numbers - * and that is why is providing intelligent ULP rounding - * to minimize misleading results. By default this option is - * enabled resulting in automatic rounding only in some cases. - * Using this mode 0.1 + 0.1 + 0.1 = 0.3 - */ + /// + /// Double floating-point precision arithmetic causes + /// rounding problems, i.e. 0.1 + 0.1 + 0.1 is slightly different than 0.3, + /// additionally doubles are having a lot of advantages + /// providing flexible number representation regardless of + /// number size. mXparser is fully based on double numbers + /// and that is why is providing intelligent ULP rounding + /// to minimize misleading results. By default this option is + /// enabled resulting in automatic rounding only in some cases. + /// Using this mode 0.1 + 0.1 + 0.1 = 0.3 + /// public static void enableUlpRounding() { ulpRounding = true; } - /** - * Double floating-point precision arithmetic causes - * rounding problems, i.e. 0.1 + 0.1 + 0.1 is slightly different than 0.3, - * additionally doubles are having a lot of advantages - * providing flexible number representation regardless of - * number size. mXparser is fully based on double numbers - * and that is why is providing intelligent ULP rounding - * to minimize misleading results. By default this option is - * enabled resulting in automatic rounding only in some cases. - * Disabling this mode 0.1 + 0.1 + 0.1 will be slightly different than 0.3. - */ + /// + /// Double floating-point precision arithmetic causes + /// rounding problems, i.e. 0.1 + 0.1 + 0.1 is slightly different than 0.3, + /// additionally doubles are having a lot of advantages + /// providing flexible number representation regardless of + /// number size. mXparser is fully based on double numbers + /// and that is why is providing intelligent ULP rounding + /// to minimize misleading results. By default this option is + /// enabled resulting in automatic rounding only in some cases. + /// Disabling this mode 0.1 + 0.1 + 0.1 will be slightly different than 0.3. + /// public static void disableUlpRounding() { ulpRounding = false; } - /** - * Double floating-point precision arithmetic causes - * rounding problems, i.e. 0.1 + 0.1 + 0.1 is slightly different than 0.3, - * additionally doubles are having a lot of advantages - * providing flexible number representation regardless of - * number size. mXparser is fully based on double numbers - * and that is why is providing intelligent ULP rounding - * to minimize misleading results. By default this option is - * enabled resulting in automatic rounding only in some cases. - * Using this mode 0.1 + 0.1 + 0.1 = 0.3 - * - * @return True if ULP rounding is enabled, otherwise false. - */ + /// + /// Double floating-point precision arithmetic causes + /// rounding problems, i.e. 0.1 + 0.1 + 0.1 is slightly different than 0.3, + /// additionally doubles are having a lot of advantages + /// providing flexible number representation regardless of + /// number size. mXparser is fully based on double numbers + /// and that is why is providing intelligent ULP rounding + /// to minimize misleading results. By default this option is + /// enabled resulting in automatic rounding only in some cases. + /// Using this mode 0.1 + 0.1 + 0.1 = 0.3 + /// + /// + /// True if ULP rounding is enabled, otherwise false. public static bool checkIfUlpRounding() { return ulpRounding; } - /** - * Enables almost integer rounding option causing - * rounding final calculation result to precise integer - * if and only if result is very close to integer. - * Very close condition depends on epsilon. - * - * @see mXparser#setEpsilon(double) - * @see mXparser#getEpsilon() - * @see Expression#calculate() - */ + /// + /// Enables almost integer rounding option causing + /// rounding final calculation result to precise integer + /// if and only if result is very close to integer. + /// Very close condition depends on epsilon. + /// + /// + /// + /// + /// public static void enableAlmostIntRounding() { almostIntRounding = true; } - /** - * Disables almost integer rounding option causing - * rounding final calculation result to precise integer - * if and only if result is very close to integer. - * Very close condition depends on epsilon. - * - * @see mXparser#setEpsilon(double) - * @see mXparser#getEpsilon() - * @see Expression#calculate() - */ + /// + /// Disables almost integer rounding option causing + /// rounding final calculation result to precise integer + /// if and only if result is very close to integer. + /// Very close condition depends on epsilon. + /// + /// + /// + /// + /// public static void disableAlmostIntRounding() { almostIntRounding = false; } - /** - * Returns state of almost integer rounding option causing - * rounding final calculation result to precise integer - * if and only if result is very close to integer. - * Very close condition depends on epsilon. - * - * @return true if option enabled, false otherwise - * - * @see mXparser#setEpsilon(double) - * @see mXparser#getEpsilon() - * @see Expression#calculate() - */ + /// + /// Returns state of almost integer rounding option causing + /// rounding final calculation result to precise integer + /// if and only if result is very close to integer. + /// Very close condition depends on epsilon. + /// + /// + /// true if option enabled, false otherwise + /// + /// + /// + /// public static bool checkIfAlmostIntRounding() { return almostIntRounding; } - /** - * Internal limit to avoid infinite loops while calculating - * expression defined in the way shown 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); - * - * Currently does not affect properly defined recursive mode. - * - * @param maxAllowedRecursionDepth - */ + /// + /// Internal limit to avoid infinite loops while calculating + /// expression defined in the way shown 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); + /// + /// Currently does not affect properly defined recursive mode. + /// + /// + /// public static void setMaxAllowedRecursionDepth(int maxAllowedRecursionDepth) { MAX_RECURSION_CALLS = maxAllowedRecursionDepth; } - /** - * Internal limit to avoid infinite loops while calculating - * expression defined in the way shown 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); - * - * Currently does not affect properly defined recursive mode. - */ + /// + /// Internal limit to avoid infinite loops while calculating + /// expression defined in the way shown 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); + /// + /// Currently does not affect properly defined recursive mode. + /// public static int getMaxAllowedRecursionDepth() { return MAX_RECURSION_CALLS; } - /** - * Set mXparser to operate in radians mode for - * trigonometric functions - */ + /// + /// Set mXparser to operate in radians mode for + /// trigonometric functions + /// public static void setRadiansMode() { degreesMode = false; } - /** - * Set mXparser to operate in degrees mode for - * trigonometric functions - */ + /// + /// Set mXparser to operate in degrees mode for + /// trigonometric functions + /// public static void setDegreesMode() { degreesMode = true; } - /** - * Checks whether mXparser operates in radians mode for - * trigonometric functions. - * - * @return true - if radians mode, false - otherwise - */ + /// + /// Checks whether mXparser operates in radians mode for + /// trigonometric functions. + /// + /// + /// + /// + /// trueif radians mode + /// falseotherwise + /// + /// public static bool checkIfRadiansMode() { return !degreesMode; } - /** - * Checks whether mXparser operates in degrees mode for - * trigonometric functions. - * - * @return true - if degrees mode, false - otherwise - */ + /// + /// Checks whether mXparser operates in degrees mode for + /// trigonometric functions. + /// + /// + /// + /// + /// trueif degrees mode + /// falseotherwise + /// + /// public static bool checkIfDegreesMode() { return degreesMode; } - /** - * Sets initial search size for the toFraction method - * - * @param n initial search size, has to be non-zero positive. - * @see NumberTheory#toFraction(double) - */ + /// Sets initial search size for the toFraction method + /// + /// initial search size, has to be non-zero positive. + /// + /// public static void setToFractionInitSearchSize(long n) { NumberTheory.setToFractionInitSearchSize(n); } - /** - * Gets initial search size used by the toFraction method - * - * @return initial search size used by the toFraction method - * @see NumberTheory#toFraction(double) - */ + /// Gets initial search size used by the toFraction method + /// + /// initial search size used by the toFraction method + /// + /// public static long getToFractionInitSearchSize() { return NumberTheory.getToFractionInitSearchSize(); } - /** - * Removes built-in tokens form the list of tokens recognized by the parsers. - * Procedure affects only tokens classified to built-in functions, built-in - * constants, built-in units, built-in random variables. - * - * @param tokens List of tokens to remove. - */ + /// + /// Removes built-in tokens form the list of tokens recognized by the parsers. + /// Procedure affects only tokens classified to built-in functions, built-in + /// constants, built-in units, built-in random variables. + /// + /// + /// List of tokens to remove. public static void removeBuiltinTokens(params String[] tokens) { if (tokens == null) return; lock (tokensToRemove) { @@ -615,10 +599,9 @@ public static void removeBuiltinTokens(params String[] tokens) { optionsChangesetNumber++; } } - /** - * Un-marks tokens previously marked to be removed. - * @param tokens List of tokens to un-mark. - */ + /// Un-marks tokens previously marked to be removed. + /// + /// List of tokens to un-mark. public static void unremoveBuiltinTokens(params String[] tokens) { if (tokens == null) return; if (tokens.Length == 0) return; @@ -630,19 +613,16 @@ public static void unremoveBuiltinTokens(params String[] tokens) { optionsChangesetNumber++; } } - /** - * Un-marks all tokens previously marked to be removed. - */ + /// Un-marks all tokens previously marked to be removed. public static void unremoveAllBuiltinTokens() { lock (tokensToRemove) { tokensToRemove.Clear(); optionsChangesetNumber++; } } - /** - * Returns current list of tokens marked to be removed. - * @return Current list of tokens marked to be removed - */ + /// Returns current list of tokens marked to be removed. + /// + /// Current list of tokens marked to be removed public static String[] getBuiltinTokensToRemove() { lock (tokensToRemove) { int tokensNum = tokensToRemove.Count; @@ -652,15 +632,16 @@ public static String[] getBuiltinTokensToRemove() { return tokensToRemoveArray; } } - /** - * Method to change definition of built-in token - more precisely - * using this method allows to modify token string recognized by the parser - * (i.e. sin(x) -> sinus(x)). - * Procedure affects only tokens classified to built-in functions, built-in - * constants, built-in units, built-in random variables. - * @param currentToken Current token name - * @param newToken New token name - */ + /// + /// Method to change definition of built-in token - more precisely + /// using this method allows to modify token string recognized by the parser + /// (i.e. sin(x) -> sinus(x)). + /// Procedure affects only tokens classified to built-in functions, built-in + /// constants, built-in units, built-in random variables. + /// + /// + /// Current token name + /// New token name public static void modifyBuiltinToken(String currentToken, String newToken) { if (currentToken == null) return; if (currentToken.Length == 0) return; @@ -677,16 +658,17 @@ public static void modifyBuiltinToken(String currentToken, String newToken) { optionsChangesetNumber++; } } - /** - * Method to change definition of built-in token - more precisely - * using this method allows to modify token string recognized by the parser - * (i.e. sin(x) -> sinus(x)). - * Procedure affects only tokens classified to built-in functions, built-in - * constants, built-in units, built-in random variables. - * @param currentToken Current token name - * @param newToken New token name - * @param newTokenDescription New token description (if null the previous one will be used) - */ + /// + /// Method to change definition of built-in token - more precisely + /// using this method allows to modify token string recognized by the parser + /// (i.e. sin(x) -> sinus(x)). + /// Procedure affects only tokens classified to built-in functions, built-in + /// constants, built-in units, built-in random variables. + /// + /// + /// Current token name + /// New token name + /// New token description (if null the previous one will be used public static void modifyBuiltinToken(String currentToken, String newToken, String newTokenDescription) { if (currentToken == null) return; if (currentToken.Length == 0) return; @@ -703,10 +685,9 @@ public static void modifyBuiltinToken(String currentToken, String newToken, Stri optionsChangesetNumber++; } } - /** - * Un-marks tokens previously marked to be modified. - * @param currentOrNewTokens List of tokens to be un-marked (current or modified). - */ + /// Un-marks tokens previously marked to be modified. + /// + /// List of tokens to be un-marked (current or modified). public static void unmodifyBuiltinTokens(params String[] currentOrNewTokens) { if (currentOrNewTokens == null) return; if (currentOrNewTokens.Length == 0) return; @@ -724,20 +705,19 @@ public static void unmodifyBuiltinTokens(params String[] currentOrNewTokens) { optionsChangesetNumber++; } } - /** - * Un-marks all tokens previously marked to be modified. - */ + /// Un-marks all tokens previously marked to be modified. public static void unmodifyAllBuiltinTokens() { lock (tokensToModify) { tokensToModify.Clear(); optionsChangesetNumber++; } } - /** - * Return details on tokens marked to be modified. - * @return String[i][0] - current token, String[i][1] - new token, - * String[i][2] - new token description. - */ + /// Return details on tokens marked to be modified. + /// + /// + /// String[i][0] - current token, String[i][1] - new token, + /// String[i][2] - new token description. + /// public static String[,] getBuiltinTokensToModify() { lock (tokensToModify) { int tokensNum = tokensToModify.Count; @@ -751,35 +731,32 @@ public static void unmodifyAllBuiltinTokens() { return tokensToModifyArray; } } - /** - * Sets mXparser to override built-in tokens - * by user defined tokens. - */ + /// + /// Sets mXparser to override built-in tokens + /// by user defined tokens. + /// public static void setToOverrideBuiltinTokens() { overrideBuiltinTokens = true; optionsChangesetNumber++; } - /** - * Sets mXparser not to override built-in tokens - * by user defined tokens. - */ + /// + /// Sets mXparser not to override built-in tokens + /// by user defined tokens. + /// public static void setNotToOverrideBuiltinTokens() { overrideBuiltinTokens = false; optionsChangesetNumber++; } - /** - * Checks whether mXparser is set to override built-in tokens. - * - * @return True if mXparser is set to override built-in tokens by - * user defined tokens, otherwise false. - */ + /// Checks whether mXparser is set to override built-in tokens. + /// + /// + /// True if mXparser is set to override built-in tokens by + /// user defined tokens, otherwise false. + /// public static bool checkIfsetToOverrideBuiltinTokens() { return overrideBuiltinTokens; } - /** - * Sets default mXparser options - * - */ + /// Sets default mXparser options public static void setDefaultOptions() { enableUlpRounding(); enableAlmostIntRounding(); @@ -793,12 +770,11 @@ public static void setDefaultOptions() { setToFractionInitSearchSize(NumberTheory.DEFAULT_TO_FRACTION_INIT_SEARCH_SIZE); optionsChangesetNumber++; } - /** - * Returns token type description. - * - * @param tokenTypeId Token type id - * @return String representing token type description. - */ + /// Returns token type description. + /// + /// Token type id + /// + /// String representing token type description. public static String getTokenTypeDescription(int tokenTypeId) { String type = ""; switch (tokenTypeId) { @@ -823,40 +799,38 @@ public static String getTokenTypeDescription(int tokenTypeId) { } return type; } - /** - * Converts integer number to hex string (plain text) - * - * @param number Integer number - * @return Hex string (i.e. FF23) - */ + /// Converts integer number to hex string (plain text) + /// + /// Integer number + /// + /// Hex string (i.e. FF23) public static String numberToHexString(int number) { return number.ToString("X"); } - /** - * Converts long number to hex string (plain text) - * - * @param number Long number - * @return Hex string (i.e. FF23) - */ + /// Converts long number to hex string (plain text) + /// + /// Long number + /// + /// Hex string (i.e. FF23) public static String numberToHexString(long number) { return number.ToString("X"); } - /** - * Converts (long)double number to hex string (plain text) - * - * @param number Double number - * @return Hex string (i.e. FF23) - */ + /// Converts (long)double number to hex string (plain text) + /// + /// Double number + /// + /// Hex string (i.e. FF23) public static String numberToHexString(double number) { return numberToHexString((long)number); } - /** - * Converts hex string into ASCII string, where each letter is - * represented by two hex digits (byte) from the hex string. - * - * @param hexString Hex string (i.e. 48656C6C6F) - * @return ASCII string (i.e. '48656C6C6F' = 'Hello') - */ + /// + /// Converts hex string into ASCII string, where each letter is + /// represented by two hex digits (byte) from the hex string. + /// + /// + /// Hex string (i.e. 48656C6C6F) + /// + /// ASCII string (i.e. '48656C6C6F' = 'Hello') public static String hexString2AsciiString(String hexString) { String hexByteStr; int hexByteInt; @@ -868,204 +842,219 @@ public static String hexString2AsciiString(String hexString) { } return asciiString; } - /** - * Converts number into ASCII string, where each letter is - * represented by two hex digits (byte) from the hex representation - * of the original number - * - * @param number Integer number (i.e. 310939249775 = '48656C6C6F') - * @return ASCII string (i.e. '48656C6C6F' = 'Hello') - */ + /// + /// Converts number into ASCII string, where each letter is + /// represented by two hex digits (byte) from the hex representation + /// of the original number + /// + /// + /// Integer number (i.e. 310939249775 = '48656C6C6F') + /// + /// ASCII string (i.e. '48656C6C6F' = 'Hello') public static String numberToAsciiString(int number) { return hexString2AsciiString(numberToHexString(number)); } - /** - * Converts number into ASCII string, where each letter is - * represented by two hex digits (byte) from the hex representation - * of the original number - * - * @param number Long number (i.e. 310939249775 = '48656C6C6F') - * @return ASCII string (i.e. '48656C6C6F' = 'Hello') - */ + /// + /// Converts number into ASCII string, where each letter is + /// represented by two hex digits (byte) from the hex representation + /// of the original number + /// + /// + /// Long number (i.e. 310939249775 = '48656C6C6F') + /// + /// ASCII string (i.e. '48656C6C6F' = 'Hello') public static String numberToAsciiString(long number) { return hexString2AsciiString(numberToHexString(number)); } - /** - * Converts (long)double number into ASCII string, where each letter is - * represented by two hex digits (byte) from the hex representation - * of the original number casted to long type. - * - * @param number Double number (i.e. 310939249775 = '48656C6C6F') - * @return ASCII string (i.e. '48656C6C6F' = 'Hello') - */ + /// + /// Converts (long)double number into ASCII string, where each letter is + /// represented by two hex digits (byte) from the hex representation + /// of the original number casted to long type. + /// + /// + /// Double number (i.e. 310939249775 = '48656C6C6F') + /// + /// ASCII string (i.e. '48656C6C6F' = 'Hello') public static String numberToAsciiString(double number) { return hexString2AsciiString(numberToHexString(number)); } - /** - * Other base (base between 1 and 36) number literal conversion to decimal number. - * - * @param numberLiteral Number literal in given numeral system with base between - * 1 and 36. Digits: 0:0, 1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, - * 8:8, 9:9, 10:A, 11:B, 12:C, 13:D, 14:E, 15:F, 16:G, 17:H, - * 18:I, 19:J, 20:K, 21:L, 22:M, 23:N, 24:O, 25:P, 26:Q, 27:R, - * 28:S, 29:T, 30:U, 31:V, 32:W, 33:X, 34:Y, 35:Z - * @param numeralSystemBase Numeral system base, between 1 and 36 - * @return Decimal number after conversion. If conversion was not - * possible the Double.NaN is returned. - */ + /// Other base (base between 1 and 36) number literal conversion to decimal number. + /// + /// + /// Number literal in given numeral system with base between + /// 1 and 36. Digits: 0:0, 1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, + /// 8:8, 9:9, 10:A, 11:B, 12:C, 13:D, 14:E, 15:F, 16:G, 17:H, + /// 18:I, 19:J, 20:K, 21:L, 22:M, 23:N, 24:O, 25:P, 26:Q, 27:R, + /// 28:S, 29:T, 30:U, 31:V, 32:W, 33:X, 34:Y, 35:Z + /// + /// Numeral system base, between 1 and 36 + /// + /// + /// Decimal number after conversion. If conversion was not + /// possible the is returned. + /// public static double convOthBase2Decimal(String numberLiteral, int numeralSystemBase) { return NumberTheory.convOthBase2Decimal(numberLiteral, numeralSystemBase); } - /** - * Other base (base between 1 and 36) number literal conversion to decimal number. - * Base specification included in number literal. - * - * Examples: 2 for b2.1001 or b.1001, 1 for b1.111, 23 for b23.123afg - * 16 for b16.123acdf or h.123acdf. - * - * @param numberLiteral Number literal string. - * - * Base format: b1. b2. b. b3. b4. b5. b6. b7. b8. o. b9. b10. b11. b12. - * b13. b14. b15. b16. h. b17. b18. b19. b20. b21. b22. b23. b24. b25. b26. - * b27. b28. b29. b30. b31. b32. b33. b34. b35. b36. - * - * Digits: 0:0, 1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, 10:A, 11:B, 12:C, - * 13:D, 14:E, 15:F, 16:G, 17:H, 18:I, 19:J, 20:K, 21:L, 22:M, 23:N, 24:O, 25:P, - * 26:Q, 27:R, 28:S, 29:T, 30:U, 31:V, 32:W, 33:X, 34:Y, 35:Z - * - * @return Decimal number after conversion. If conversion was not - * possible the Double.NaN is returned. - */ + /// + /// Other base (base between 1 and 36) number literal conversion to decimal number. + /// Base specification included in number literal. + /// + /// + /// Examples: 2 for b2.1001 or b.1001, 1 for b1.111, 23 for b23.123afg + /// 16 for b16.123acdf or h.123acdf. + /// + /// + /// + /// Number literal string. + /// + /// Base format: b1. b2. b. b3. b4. b5. b6. b7. b8. o. b9. b10. b11. b12. + /// b13. b14. b15. b16. h. b17. b18. b19. b20. b21. b22. b23. b24. b25. b26. + /// b27. b28. b29. b30. b31. b32. b33. b34. b35. b36. + /// + /// Digits: 0:0, 1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, 10:A, 11:B, 12:C, + /// 13:D, 14:E, 15:F, 16:G, 17:H, 18:I, 19:J, 20:K, 21:L, 22:M, 23:N, 24:O, 25:P, + /// 26:Q, 27:R, 28:S, 29:T, 30:U, 31:V, 32:W, 33:X, 34:Y, 35:Z + /// + /// + /// + /// Decimal number after conversion. If conversion was not + /// possible the is returned. + /// public static double convOthBase2Decimal(String numberLiteral) { return NumberTheory.convOthBase2Decimal(numberLiteral); } - /** - * Other base to decimal conversion. - * - * @param numeralSystemBase Numeral system base has to be above 0. - * @param digits List of digits - * @return Number after conversion. If conversion is not possible then - * Double.NaN is returned. - */ + /// Other base to decimal conversion. + /// + /// Numeral system base has to be above 0. + /// List of digits + /// + /// + /// Number after conversion. If conversion is not possible then + /// is returned. + /// public static double convOthBase2Decimal(int numeralSystemBase, params int[] digits) { return NumberTheory.convOthBase2Decimal(numeralSystemBase, digits); } - /** - * Other base to decimal conversion. - * - * @param numeralSystemBase Numeral system base has to be above 0. - * @param digits List of digits - * @return Number after conversion. If conversion is not possible then - * Double.NaN is returned. - */ + /// Other base to decimal conversion. + /// + /// Numeral system base has to be above 0. + /// List of digits + /// + /// + /// Number after conversion. If conversion is not possible then + /// is returned. + /// public static double convOthBase2Decimal(double numeralSystemBase, params double[] digits) { return NumberTheory.convOthBase2Decimal(numeralSystemBase, digits); } - /** - * Decimal number to other numeral system conversion with base - * between 1 and 36. - * - * @param decimalNumber Decimal number - * @param numeralSystemBase Numeral system base between 1 and 36 - * @return Number literal representing decimal number in - * given numeral numeral system. Digits - * 0:0, 1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, - * 9:9, 10:A, 11:B, 12:C, 13:D, 14:E, 15:F, 16:G, - * 17:H, 18:I, 19:J, 20:K, 21:L, 22:M, 23:N, 24:O, - * 25:P, 26:Q, 27:R, 28:S, 29:T, 30:U, 31:V, 32:W, - * 33:X, 34:Y, 35:Z. If conversion was not possible - * the "NaN" string is returned. - */ + /// + /// Decimal number to other numeral system conversion with base + /// between 1 and 36. + /// + /// + /// Decimal number + /// Numeral system base between 1 and 36 + /// + /// + /// Number literal representing decimal number in + /// given numeral numeral system. Digits + /// 0:0, 1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, + /// 9:9, 10:A, 11:B, 12:C, 13:D, 14:E, 15:F, 16:G, + /// 17:H, 18:I, 19:J, 20:K, 21:L, 22:M, 23:N, 24:O, + /// 25:P, 26:Q, 27:R, 28:S, 29:T, 30:U, 31:V, 32:W, + /// 33:X, 34:Y, 35:Z. If conversion was not possible + /// the "NaN" string is returned. + /// public static String convDecimal2OthBase(double decimalNumber, int numeralSystemBase) { return NumberTheory.convDecimal2OthBase(decimalNumber, numeralSystemBase); } - /** - * Decimal number to other numeral system conversion with base - * between 1 and 36. - * - * @param decimalNumber Decimal number - * @param numeralSystemBase Numeral system base between 1 and 36 - * @param format If 1 then always bxx. is used, i.e. b1. or b16. - * If 2 then for binary b. is used, for octal o. is used, - * for hexadecimal h. is used, otherwise bxx. is used - * where xx is the numeral system base specification. - * - * @return Number literal representing decimal number in - * given numeral numeral system. - * - * Base format: b1. b2. b. b3. b4. b5. b6. b7. b8. o. b9. b10. b11. b12. - * b13. b14. b15. b16. h. b17. b18. b19. b20. b21. b22. b23. b24. b25. b26. - * b27. b28. b29. b30. b31. b32. b33. b34. b35. b36. - * - * Digits: 0:0, 1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, 10:A, 11:B, 12:C, - * 13:D, 14:E, 15:F, 16:G, 17:H, 18:I, 19:J, 20:K, 21:L, 22:M, 23:N, 24:O, 25:P, - * 26:Q, 27:R, 28:S, 29:T, 30:U, 31:V, 32:W, 33:X, 34:Y, 35:Z - * - * If conversion was not possible the "NaN" string is returned. - */ + /// + /// Decimal number to other numeral system conversion with base + /// between 1 and 36. + /// + /// + /// Decimal number + /// Numeral system base between 1 and 36 + /// + /// If 1 then always bxx. is used, i.e. b1. or b16. + /// If 2 then for binary b. is used, for octal o. is used, + /// for hexadecimal h. is used, otherwise bxx. is used + /// where xx is the numeral system base specification. + /// + /// + /// + /// Number literal representing decimal number in + /// given numeral numeral system. + /// + /// Base format: b1. b2. b. b3. b4. b5. b6. b7. b8. o. b9. b10. b11. b12. + /// b13. b14. b15. b16. h. b17. b18. b19. b20. b21. b22. b23. b24. b25. b26. + /// b27. b28. b29. b30. b31. b32. b33. b34. b35. b36. + /// + /// Digits: 0:0, 1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, 10:A, 11:B, 12:C, + /// 13:D, 14:E, 15:F, 16:G, 17:H, 18:I, 19:J, 20:K, 21:L, 22:M, 23:N, 24:O, 25:P, + /// 26:Q, 27:R, 28:S, 29:T, 30:U, 31:V, 32:W, 33:X, 34:Y, 35:Z + /// + /// If conversion was not possible the "NaN" string is returned. + /// public static String convDecimal2OthBase(double decimalNumber, int numeralSystemBase, int format) { return NumberTheory.convDecimal2OthBase(decimalNumber, numeralSystemBase, format); } - /** - * Converts double value to its fraction representation. - * - * @param value Value to be converted - * - * @return Array representing fraction. Sign at index 0, - * numerator at index 1, denominator at index 2. - * If conversion is not possible then Double.NaN is - * assigned to all the fields. - */ + /// Converts double value to its fraction representation. + /// + /// @param value Value to be converted + /// + /// @return Array representing fraction. Sign at index 0, + /// numerator at index 1, denominator at index 2. + /// If conversion is not possible then Double.NaN is + /// assigned to all the fields. public static double[] toFraction(double value) { return NumberTheory.toFraction(value); } - /** - * Converts double value to its mixed fraction representation. - * - * @param value Value to be converted - * - * @return Array representing fraction. - * Sign at index 0, whole number at index 1, - * numerator at index 2, denominator at index 3. - * If conversion is not possible then Double.NaN is - * assigned to both numerator and denominator. - */ + /// Converts double value to its mixed fraction representation. + /// + /// Value to be converted + /// + /// + /// Array representing fraction. + /// Sign at index 0, whole number at index 1, + /// numerator at index 2, denominator at index 3. + /// If conversion is not possible then is + /// assigned to both numerator and denominator. + /// public static double[] toMixedFraction(double value) { return NumberTheory.toMixedFraction(value); } - /** - * Converts array representing fraction to fraction string representation. - * - * @param fraction Array representing fraction (including mix fractions) - * @return String representation of fraction. - * - * @see NumberTheory#toFraction(double) - * @see NumberTheory#toMixedFraction(double) - */ + /// Converts array representing fraction to fraction string representation. + /// + /// Array representing fraction (including mix fractions) + /// + /// String representation of fraction. + /// + /// + /// public static String fractionToString(double[] fraction) { return NumberTheory.fractionToString(fraction); } - /** - * Converts number to its fraction string representation. - * - * @param value Given number - * @return String representation of fraction. - * - * @see NumberTheory#toFraction(double) - * @see NumberTheory#fractionToString(double[]) - */ + /// Converts number to its fraction string representation. + /// + /// Given number + /// + /// String representation of fraction. + /// + /// + /// public static String toFractionString(double value) { return NumberTheory.toFractionString(value); } - /** - * Converts number to its mixed fraction string representation. - * - * @param value Given number - * @return String representation of fraction. - * - * @see NumberTheory#toMixedFraction(double) - * @see NumberTheory#fractionToString(double[]) - */ + /// Converts number to its mixed fraction string representation. + /// + /// Given number + /// + /// String representation of fraction. + /// + /// + /// public static String toMixedFractionString(double value) { return NumberTheory.toMixedFractionString(value); } @@ -1092,11 +1081,9 @@ private static void consoleWrite(Object o) { Console.Write(o); #endif } - /** - * Prints object.toString to the Console + new line - * - * @param o Object to print - */ + /// Prints to the Console + new line + /// + /// Object to print public static void consolePrintln(Object o) { lock (CONSOLE_OUTPUT) { if ((CONSOLE_ROW_NUMBER == 1) && (CONSOLE_OUTPUT.Equals(""))) { @@ -1109,11 +1096,9 @@ public static void consolePrintln(Object o) { CONSOLE_OUTPUT = CONSOLE_OUTPUT + o + "\n" + CONSOLE_OUTPUT_PREFIX; } } - /** - * Prints array of strings - * - * @param stringArray array of strinfs - */ + /// Prints array of strings + /// + /// array of strinfs public static void consolePrintln(String[] stringArray) { if (stringArray == null) { consolePrintln("null"); @@ -1122,10 +1107,7 @@ public static void consolePrintln(String[] stringArray) { foreach (String s in stringArray) consolePrintln(s); } - /** - * Prints new line to the Console, no new line - * - */ + /// Prints new line to the Console, no new line public static void consolePrintln() { lock (CONSOLE_OUTPUT) { if ((CONSOLE_ROW_NUMBER == 1) && (CONSOLE_OUTPUT.Equals(""))) { @@ -1138,11 +1120,9 @@ public static void consolePrintln() { CONSOLE_OUTPUT = CONSOLE_OUTPUT + "\n" + CONSOLE_OUTPUT_PREFIX; } } - /** - * Prints object.toString to the Console, no new line - * - * @param o Object to print - */ + /// Prints to the Console, no new line + /// + /// Object to print public static void consolePrint(Object o) { lock (CONSOLE_OUTPUT) { if ((CONSOLE_ROW_NUMBER == 1) && (CONSOLE_OUTPUT.Equals(""))) { @@ -1153,161 +1133,147 @@ public static void consolePrint(Object o) { CONSOLE_OUTPUT = CONSOLE_OUTPUT + o; } } - /** - * Resets console output string, console output - * string is being built by consolePrintln(), consolePrint(). - * - * @see mXparser#consolePrint(Object) - * @see mXparser#consolePrintln(Object) - * @see mXparser#consolePrintln() - * @see mXparser#resetConsoleOutput() - */ + /// + /// Resets console output string, console output + /// string is being built by consolePrintln(), consolePrint(). + /// + /// + /// + /// + /// + /// public static void resetConsoleOutput() { lock (CONSOLE_OUTPUT) { CONSOLE_OUTPUT = ""; CONSOLE_ROW_NUMBER = 1; } } - /** - * Sets default console prefix. - */ + /// Sets default console prefix. public static void setDefaultConsolePrefix() { lock (CONSOLE_PREFIX) { CONSOLE_PREFIX = "[mXparser-v." + VERSION + "] "; } } - /** - * Sets default console output string prefix. - */ + /// Sets default console output string prefix. public static void setDefaultConsoleOutputPrefix() { lock (CONSOLE_OUTPUT_PREFIX) { CONSOLE_OUTPUT_PREFIX = "[mXparser-v." + VERSION + "] "; } } - /** - * Sets console prefix. - * @param consolePrefix String containing console prefix definition. - */ + /// Sets console prefix. + /// + /// String containing console prefix definition. public static void setConsolePrefix(String consolePrefix) { lock (CONSOLE_PREFIX) { CONSOLE_PREFIX = consolePrefix; } } - /** - * Sets console output string prefix. - * @param consoleOutputPrefix String containing console output prefix definition. - */ + /// Sets console output string prefix. + /// + /// String containing console output prefix definition. public static void setConsoleOutputPrefix(String consoleOutputPrefix) { lock (CONSOLE_OUTPUT_PREFIX) { CONSOLE_OUTPUT_PREFIX = consoleOutputPrefix; } } - /** - * Returns console output string, console output string - * is being built by consolePrintln(), consolePrint(). - * - * @return Console output string - * - * @see mXparser#consolePrint(Object) - * @see mXparser#consolePrintln(Object) - * @see mXparser#consolePrintln(); - * @see mXparser#resetConsoleOutput(); - */ + /// + /// Returns console output string, console output string + /// is being built by , . + /// + /// + /// Console output string + /// + /// + /// + /// + /// public static String getConsoleOutput() { return CONSOLE_OUTPUT; } - /** - * General mXparser expression help - * - * @return String with all general help content - */ + /// General mXparser expression help + /// + /// String with all general help content public static String getHelp() { lock (mXparserExp) { return mXparserExp.getHelp(); } } - /** - * General mXparser expression help - in-line key word searching - * @param word Key word to be searched - * @return String with all help content - * lines containing given keyword - */ + /// General mXparser expression help - in-line key word searching + /// + /// Key word to be searched + /// + /// + /// String with all help content + /// lines containing given keyword + /// public static String getHelp(String word) { lock (mXparserExp) { return mXparserExp.getHelp(word); } } - /** - * Prints all help content. - */ + /// Prints all help content. public static void consolePrintHelp() { consoleWriteLine(getHelp()); } - /** - * Prints filtered help content. - * @param word Key word. - */ + /// Prints filtered help content. + /// + /// Key word. public static void consolePrintHelp(String word) { consoleWriteLine(getHelp(word)); } - /** - * Returns list of key words known to the parser - * - * @return List of keywords known to the parser. - * - * @see KeyWord - * @see KeyWord#wordTypeId - * @see mXparser#getHelp() - */ + /// Returns list of key words known to the parser + /// + /// List of keywords known to the parser. + /// + /// + /// + /// public static List getKeyWords() { lock (mXparserExp) { return mXparserExp.getKeyWords(); } } - /** - * Returns list of key words known to the parser - * - * @param query Give any string to filter list of key words against this string. - * User more precise syntax: str=tokenString, desc=tokenDescription, - * syn=TokenSyntax, sin=tokenSince, wid=wordId, tid=wordTypeId - * to narrow the result. - * - * @return List of keywords known to the parser filter against query string. - * - * @see KeyWord - * @see KeyWord#wordTypeId - * @see mXparser#getHelp(String) - */ + /// Returns list of key words known to the parser + /// + /// + /// Give any string to filter list of key words against this string. + /// User more precise syntax: str=tokenString, desc=tokenDescription, + /// syn=TokenSyntax, sin=tokenSince, wid=wordId, tid=wordTypeId + /// to narrow the result. + /// + /// + /// List of keywords known to the parser filter against query string. + /// + /// + /// + /// public static List getKeyWords(String query) { lock (mXparserExp) { return mXparserExp.getKeyWords(query); } } - /** - * Function used to introduce some compatibility - * between JAVA and C# while regexp matching. - * - * @param str String - * @param pattern Pattern (regexp) - * - * @return True if pattern matches entirely, False otherwise - */ + /// + /// Function used to introduce some compatibility + /// between JAVA and C# while regexp matching. + /// + /// + /// String + /// Pattern (regexp) + /// + /// True if pattern matches entirely, False otherwise public static bool regexMatch(String str, String pattern){ return Regex.IsMatch(str, "^(" + pattern + ")$"); } - /** - * Prints tokens to the console. - * @param tokens Tokens list. - * - * @see Expression#getCopyOfInitialTokens() - * @see Token - */ + /// Prints tokens to the console. + /// + /// Tokens list. + /// + /// + /// public static void consolePrintTokens(List tokens) { Expression.showTokens(tokens); } - /** - * License info. - */ + /// License info. public const String LICENSE = " mXparser - version " + VERSION + "\n" + " A flexible mathematical eXpressions parser for C#.\n" + @@ -1354,19 +1320,15 @@ public static void consolePrintTokens(List tokens) { " http://mxparser.codeplex.com/\n" + " http://janetsudoku.mariuszgromada.org/\n" ; - /** - * Gets license info - * - * @return license info as string. - */ + /// Gets license info + /// + /// license info as string. public static String getLicense() { return mXparser.LICENSE; } - /** - * Waits given number of milliseconds - * - * @param n Number of milliseconds - */ + /// Waits given number of milliseconds + /// + /// Number of milliseconds public static void wait(int n) { long t0, t1; t0 = DateTime.Now.Millisecond; @@ -1374,28 +1336,24 @@ public static void wait(int n) { t1 = DateTime.Now.Millisecond; } while (t1 - t0 < n); } - /** - * Method give a signal to other methods to cancel current calculation. This is a flag, - * remember to reset this flag after process is cancelled and you are going to start - * new calculation process. - */ + /// + /// Method give a signal to other methods to cancel current calculation. This is a flag, + /// remember to reset this flag after process is cancelled and you are going to start + /// new calculation process. + /// public static void cancelCurrentCalculation() { cancelCurrentCalculationFlag = true; } - /** - * Resets a flag giving signal to the engine to cancel current calculation. - * - * @see {@link #cancelCurrentCalculation()} - */ + /// Resets a flag giving signal to the engine to cancel current calculation. + /// + /// public static void resetCancelCurrentCalculationFlag() { cancelCurrentCalculationFlag = false; } - /** - * Check whether a flag to cancel current calculation process is set. - * - * @see {@link #cancelCurrentCalculation()} - * @see {@link #resetCancelCurrentCalculationFlag()} - */ + /// Check whether a flag to cancel current calculation process is set. + /// + /// + /// public static bool isCurrentCalculationCancelled() { return cancelCurrentCalculationFlag; } From bc512a7214a33cf5fcbf786af504520ce6f03825 Mon Sep 17 00:00:00 2001 From: Adam Spofford Date: Tue, 20 Aug 2019 07:49:35 -0700 Subject: [PATCH 12/15] Document PrimitiveElement.cs --- .../math/mxparser/PrimitiveElement.cs | 111 +++++++++--------- 1 file changed, 54 insertions(+), 57 deletions(-) diff --git a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/PrimitiveElement.cs b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/PrimitiveElement.cs index 64c671c6..59493c5c 100644 --- a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/PrimitiveElement.cs +++ b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/PrimitiveElement.cs @@ -56,69 +56,66 @@ using System; namespace org.mariuszgromada.math.mxparser { - /** - * Class used for connecting all basic elements such as: Argument, Constant, - * Function. Class not used by the end user. - * - * - * @author Mariusz Gromada
- * mariuszgromada.org@gmail.com
- * MathSpace.pl
- * MathParser.org - mXparser project page
- * mXparser on GitHub
- * mXparser on SourceForge
- * mXparser on Bitbucket
- * mXparser on CodePlex
- * Janet Sudoku - project web page
- * Janet Sudoku on GitHub
- * Janet Sudoku on CodePlex
- * Janet Sudoku on SourceForge
- * Janet Sudoku on BitBucket
- * Scalar Free
- * Scalar Pro
- * ScalarMath.org
- * - * @version 3.0.0 - * - * @see Argument - * @see Constant - * @see Function - * @see RecursiveArgument - * @see Expression#addDefinitions(PrimitiveElement...) - * @see Expression#removeDefinitions(PrimitiveElement...) - */ + /// + /// Class used for connecting all basic elements such as: , , + /// . Class not used by the end user. + /// + /// + /// + /// Author: Mariusz Gromada
+ /// mariuszgromada.org@gmail.com
+ /// MathSpace.pl
+ /// MathParser.org - mXparser project page
+ /// mXparser on GitHub
+ /// mXparser on SourceForge
+ /// mXparser on Bitbucket
+ /// mXparser on CodePlex
+ /// Janet Sudoku - project web page
+ /// Janet Sudoku on GitHub
+ /// Janet Sudoku on CodePlex
+ /// Janet Sudoku on SourceForge
+ /// Janet Sudoku on BitBucket
+ /// Scalar Free
+ /// Scalar Pro
+ /// ScalarMath.org + /// + /// Version: 3.0.0 + ///
+ /// + /// + /// + /// + /// + /// + /// [CLSCompliant(true)] public class PrimitiveElement { - /** - * Element type id - * - * @see Argument.TYPE_ID - * @see Constant.TYPE_ID - * @see Function.TYPE_ID - */ + /// Element type id + /// + /// + /// + /// private int myTypeId; - /** - * Default constructor setting element type id - * - * @param typeId Element type id - * - * @see Argument.TYPE_ID - * @see Constant.TYPE_ID - * @see Function.TYPE_ID - */ + /// Default constructor setting element type id + /// + /// Element type id + /// + /// + /// + /// public PrimitiveElement(int typeId) { myTypeId = typeId; } - /** - * Returns element type id - * - * @return Element type id as int Function.TYPE_ID, Argument.TYPE_ID, Function.TYPE_ID - * - * @see Argument.TYPE_ID - * @see Constant.TYPE_ID - * @see Function.TYPE_ID - * - */ + /// Returns element type id + /// + /// + /// Element type id as int , + /// , + /// + /// + /// + /// + /// public int getMyTypeId() { return myTypeId; } From d1b041f16abcd70b1b4dd33a853af8cdb177bc8f Mon Sep 17 00:00:00 2001 From: Adam Spofford Date: Tue, 20 Aug 2019 08:00:56 -0700 Subject: [PATCH 13/15] Document RecursiveArgument.cs --- .../math/mxparser/RecursiveArgument.cs | 229 +++++++++--------- 1 file changed, 112 insertions(+), 117 deletions(-) diff --git a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/RecursiveArgument.cs b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/RecursiveArgument.cs index e6bf1059..fcfaaeff 100644 --- a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/RecursiveArgument.cs +++ b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/RecursiveArgument.cs @@ -58,83 +58,81 @@ using System.Collections.Generic; namespace org.mariuszgromada.math.mxparser { - /** - * RecursiveArgument class enables to declare the argument - * (variable) which is defined in a recursive way. Such an argument - * can be used in further processing in expressions, functions and dependent - * or recursive arguments.
- * - * For example: - *
    - *
  • 'fib(n) = fin(n-1)+fib(n-2), fib(0) = 0, fib(1) = 1' - *
  • 'factorial(n) = n*factorial(n-1), factorial(0) = 1' - *
- *

- * When creating an argument you should avoid: - *

    - *
  • names reserved as parser keywords, in general words known in mathematical language - * as function names, operators (for example: - * sin, cos, +, -, etc...). Please be informed that after associating - * the argument with the expression, function or dependent/recursive argument - * its name will be recognized by the parser as reserved key word. - * It means that it could not be the same as any other key word known - * by the parser for this particular expression. - *
  • defining statements with increasing index: 'a(n) = a(n+1) + ... ', otherwise - * you will get Double.NaN - *
  • if recursion is not properly defined you will get Double.NaN in the result. - * This is due to the recursion counter inside of the recursive argument. Calculating - * n-th element requires no more than n recursion steps (usually less than n). - *
  • For negative 'n' you will get Double.NaN. - * - *
- * - * @author Mariusz Gromada
- * mariuszgromada.org@gmail.com
- * MathSpace.pl
- * MathParser.org - mXparser project page
- * mXparser on GitHub
- * mXparser on SourceForge
- * mXparser on Bitbucket
- * mXparser on CodePlex
- * Janet Sudoku - project web page
- * Janet Sudoku on GitHub
- * Janet Sudoku on CodePlex
- * Janet Sudoku on SourceForge
- * Janet Sudoku on BitBucket
- * Scalar Free
- * Scalar Pro
- * ScalarMath.org
- * - * @version 4.2.0 - * - * @see Argument - * @see Expression - * @see Function - * @see Constant - */ + /// + /// RecursiveArgument class enables to declare the argument + /// (variable) which is defined in a recursive way. Such an argument + /// can be used in further processing in expressions, functions and dependent + /// or recursive arguments. + /// + /// For example: + /// + /// 'fib(n) = fin(n-1)+fib(n-2), fib(0) = 0, fib(1) = 1' + /// 'factorial(n) = n*factorial(n-1), factorial(0) = 1' + /// + /// + /// + /// When creating an argument you should avoid: + /// + /// + /// names reserved as parser keywords, in general words known in mathematical language + /// as function names, operators (for example: + /// sin, cos, +, -, etc...). Please be informed that after associating + /// the argument with the expression, function or dependent/recursive argument + /// its name will be recognized by the parser as reserved key word. + /// It means that it could not be the same as any other key word known + /// by the parser for this particular expression. + /// + /// + /// defining statements with increasing index: 'a(n) = a(n+1) + ... ', otherwise + /// you will get + /// + /// + /// if recursion is not properly defined you will get in the result. + /// This is due to the recursion counter inside of the recursive argument. Calculating + /// n-th element requires no more than n recursion steps (usually less than n). + /// + /// For negative 'n' you will get . + /// + /// + /// Author: Mariusz Gromada
+ /// mariuszgromada.org@gmail.com
+ /// MathSpace.pl
+ /// MathParser.org - mXparser project page
+ /// mXparser on GitHub
+ /// mXparser on SourceForge
+ /// mXparser on Bitbucket
+ /// mXparser on CodePlex
+ /// Janet Sudoku - project web page
+ /// Janet Sudoku on GitHub
+ /// Janet Sudoku on CodePlex
+ /// Janet Sudoku on SourceForge
+ /// Janet Sudoku on BitBucket
+ /// Scalar Free
+ /// Scalar Pro
+ /// ScalarMath.org + /// + /// Version: 4.2.0 + ///
+ /// + /// + /// + /// + /// [CLSCompliant(true)] public class RecursiveArgument : Argument { - /** - * Type identifier for recursive arguments. - */ + /// Type identifier for recursive arguments. public const int TYPE_ID_RECURSIVE = 102; public const String TYPE_DESC_RECURSIVE = "User defined recursive argument"; - /** - * Base values - */ + /// Base values private List baseValues; - /** - * To avoid never ending loops - */ + /// To avoid never ending loops private int recursiveCounter; private int startingIndex; - /** - * Constructor - creates recursive argument. - * - * @param argumentName the argument name - * @param recursiveExpressionString the recursive expression string - * @param indexName index argument name - */ + /// Constructor - creates recursive argument. + /// + /// the argument name + /// the recursive expression string + /// index argument name public RecursiveArgument(String argumentName, String recursiveExpressionString, String indexName) : base(argumentName, recursiveExpressionString) { @@ -148,18 +146,19 @@ public RecursiveArgument(String argumentName, String recursiveExpressionString, recursiveCounter = -1; } } - /** - * Constructor - creates recursive argument. - * - * @param argumentName the argument name - * @param recursiveExpressionString the recursive expression string - * @param n the index argument - * @param elements Optional elements list (variadic - comma - * separated) of types: Argument, Constant, Function - * - * @see PrimitiveElement - * @see Argument - */ + /// Constructor - creates recursive argument. + /// + /// the argument name + /// the recursive expression string + /// the index argument + /// + /// Optional elements list (variadic - comma + /// separated) of types: , + /// , + /// + /// + /// + /// public RecursiveArgument(String argumentName, String recursiveExpressionString, Argument n, params PrimitiveElement[] elements) : base(argumentName, recursiveExpressionString) { @@ -174,25 +173,27 @@ public RecursiveArgument(String argumentName, String recursiveExpressionString, recursiveCounter = -1; } } - /** - * Constructor - creates argument based on the argument definition string. - * - * @param argumentDefinitionString Argument definition string, i.e.: - *
    - *
  • 'x' - only argument name - *
  • 'x=5' - argument name and argument value - *
  • 'x=2*5' - argument name and argument value given as simple expression - *
  • 'x=2*y' - argument name and argument expression (dependent argument 'x' on argument 'y') - *
  • 'x(n)=x(n-1)+x(n-2)' - for recursive arguments) - *
- * - * @param elements Optional elements list - * (variadic - comma separated) of types: Argument, - * Constant, Function - * - * @see PrimitiveElement - * @see Argument - */ + /// Constructor - creates argument based on the argument definition string. + /// + /// + /// Argument definition string, i.e.: + /// + /// 'x' - only argument name + /// 'x=5' - argument name and argument value + /// 'x=2*5' - argument name and argument value given as simple expression + /// 'x=2*y' - argument name and argument expression (dependent argument 'x' on argument 'y') + /// 'x(n)=x(n-1)+x(n-2)' - for recursive arguments) + /// + /// + /// + /// + /// Optional elements list + /// (variadic - comma separated) of types: , + /// , + /// + /// + /// + /// public RecursiveArgument(String argumentDefinitionString, params PrimitiveElement[] elements) : base(argumentDefinitionString) { if (mXparser.regexMatch(argumentDefinitionString, ParserSymbol.function1ArgDefStrRegExp)) { @@ -209,12 +210,10 @@ public RecursiveArgument(String argumentDefinitionString, params PrimitiveElemen base.argumentExpression.setSyntaxStatus(SYNTAX_ERROR_OR_STATUS_UNKNOWN, "[" + argumentDefinitionString + "] " + "Invalid argument definition (patterns: f(n) = f(n-1) ... )."); } } - /** - * Adds base case - * - * @param index the base case index - * @param value the base case value - */ + /// Adds base case + /// + /// the base case index + /// the base case value public void addBaseCase(int index, double value) { int recSize = baseValues.Count; if (index > recSize-1) { @@ -227,21 +226,17 @@ public void addBaseCase(int index, double value) { } else baseValues[index] = value; } - /** - * Clears all based cases and stored calculated values - */ + /// Clears all based cases and stored calculated values public void resetAllCases() { baseValues.Clear(); recursiveCounter = -1; } - /** - * Gets recursive argument value - * - * @param index the index - * - * @return value as double - */ + /// Gets recursive argument value + /// + /// the index + /// + /// value as double public double getArgumentValue(double index) { /* * Remember starting index From 317b3b99e9cd3321c46f658a6d08bce97303e1f2 Mon Sep 17 00:00:00 2001 From: Adam Spofford Date: Tue, 20 Aug 2019 08:06:19 -0700 Subject: [PATCH 14/15] Document AstronomicalConstants.cs --- .../mathcollection/AstronomicalConstants.cs | 184 ++++++------------ 1 file changed, 57 insertions(+), 127 deletions(-) diff --git a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/mathcollection/AstronomicalConstants.cs b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/mathcollection/AstronomicalConstants.cs index a7bcf0f8..9c9555d8 100644 --- a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/mathcollection/AstronomicalConstants.cs +++ b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/mathcollection/AstronomicalConstants.cs @@ -56,169 +56,99 @@ using System; namespace org.mariuszgromada.math.mxparser.mathcollection { - /** - * AstronomicalConstants - class representing the most important astronomical constants. - * - * @author Mariusz Gromada
- * mariuszgromada.org@gmail.com
- * MathSpace.pl
- * MathParser.org - mXparser project page
- * mXparser on GitHub
- * mXparser on SourceForge
- * mXparser on Bitbucket
- * mXparser on CodePlex
- * Janet Sudoku - project web page
- * Janet Sudoku on GitHub
- * Janet Sudoku on CodePlex
- * Janet Sudoku on SourceForge
- * Janet Sudoku on BitBucket
- * Scalar Free
- * Scalar Pro
- * ScalarMath.org
- * - * @version 4.0.0 - */ + /// AstronomicalConstants - class representing the most important astronomical constants. + /// + /// + /// Author: Mariusz Gromada
+ /// mariuszgromada.org@gmail.com
+ /// MathSpace.pl
+ /// MathParser.org - mXparser project page
+ /// mXparser on GitHub
+ /// mXparser on SourceForge
+ /// mXparser on Bitbucket
+ /// mXparser on CodePlex
+ /// Janet Sudoku - project web page
+ /// Janet Sudoku on GitHub
+ /// Janet Sudoku on CodePlex
+ /// Janet Sudoku on SourceForge
+ /// Janet Sudoku on BitBucket
+ /// Scalar Free
+ /// Scalar Pro
+ /// ScalarMath.org + /// + /// Version: 4.0.0 + ///
[CLSCompliant(true)] public sealed class AstronomicalConstants { - /** - * Light year - */ + /// Light year public const double LIGHT_YEAR = PhysicalConstants.LIGHT_SPEED * Units.JULIAN_YEAR; - /** - * Astronomical unit - */ + /// Astronomical unit public const double ASTRONOMICAL_UNIT = 149597870700.0 * Units.METRE; - /** - * Parsec - */ + /// Parsec public const double PARSEC = 206264.806247096 * ASTRONOMICAL_UNIT; - /** - * Kiloparsec - */ + /// Kiloparsec public const double KILOPARSEC = Units.KILO * PARSEC; - /** - * Earth equatorial radius - */ + /// Earth equatorial radius public const double EARTH_RADIUS_EQUATORIAL = 6378.1370 * Units.KILOMETRE; - /** - * Earth polar radius - */ + /// Earth polar radius public const double EARTH_RADIUS_POLAR = 6356.7523 * Units.KILOMETRE; - /** - * Earth mean radius - */ + /// Earth mean radius public const double EARTH_RADIUS_MEAN = 6371.0088 * Units.KILOMETRE; - /** - * Earth mass - */ + /// Earth mass public const double EARTH_MASS = 5.9722 * Units.YOTTA * Units.KILOGRAM; - /** - * Earth semi-major axis - */ + /// Earth semi-major axis public const double EARTH_SEMI_MAJOR_AXIS = 1.000001018 * ASTRONOMICAL_UNIT; - /** - * Moon mean radius - */ + /// Moon mean radius public const double MOON_RADIUS_MEAN = 1737.1 * Units.KILOMETRE; - /** - * Moon mass - */ + /// Moon mass public const double MOON_MASS = 0.012300037 * EARTH_MASS; - /** - * Moon semi-major axis - */ + /// Moon semi-major axis public const double MONN_SEMI_MAJOR_AXIS = 384399 * Units.KILOMETRE; - /** - * Solar radius - */ + /// Solar radius public const double SOLAR_RADIUS = 695700 * Units.KILOMETRE; - /** - * Solar mass - */ + /// Solar mass public const double SOLAR_MASS = 332946.0487 * EARTH_MASS; - /** - * Mercury radius - */ + /// Mercury radius public const double MERCURY_RADIUS_MEAN = 2439.7 * Units.KILOMETRE; - /** - * Mercury mass - */ + /// Mercury mass public const double MERCURY_MASS = 0.0553 * EARTH_MASS; - /** - * Mercury semi-major axis - */ + /// Mercury semi-major axis public const double MERCURY_SEMI_MAJOR_AXIS = 0.387098 * ASTRONOMICAL_UNIT; - /** - * Venus radius - */ + /// Venus radius public const double VENUS_RADIUS_MEAN = 6051.8 * Units.KILOMETRE; - /** - * Venus mass - */ + /// Venus mass public const double VENUS_MASS = 0.815 * EARTH_MASS; - /** - * Venus semi-major axis - */ + /// Venus semi-major axis public const double VENUS_SEMI_MAJOR_AXIS = 0.723332 * ASTRONOMICAL_UNIT; - /** - * Mars radius - */ + /// Mars radius public const double MARS_RADIUS_MEAN = 3389.5 * Units.KILOMETRE; - /** - * Mars mass - */ + /// Mars mass public const double MARS_MASS = 0.107 * EARTH_MASS; - /** - * Mars semi-major axis - */ + /// Mars semi-major axis public const double MARS_SEMI_MAJOR_AXIS = 1.523679 * ASTRONOMICAL_UNIT; - /** - * Jupiter radius - */ + /// Jupiter radius public const double JUPITER_RADIUS_MEAN = 69911 * Units.KILOMETRE; - /** - * Jupiter mass - */ + /// Jupiter mass public const double JUPITER_MASS = 317.8 * EARTH_MASS; - /** - * Jupiter semi-major axis - */ + /// Jupiter semi-major axis public const double JUPITER_SEMI_MAJOR_AXIS = 5.20260 * ASTRONOMICAL_UNIT; - /** - * Saturn radius - */ + /// Saturn radius public const double SATURN_RADIUS_MEAN = 58232 * Units.KILOMETRE; - /** - * Saturn mass - */ + /// Saturn mass public const double SATURN_MASS = 95.159 * EARTH_MASS; - /** - * Saturn semi-major axis - */ + /// Saturn semi-major axis public const double SATURN_SEMI_MAJOR_AXIS = 9.5549 * ASTRONOMICAL_UNIT; - /** - * Uranus radius - */ + /// Uranus radius public const double URANUS_RADIUS_MEAN = 25362 * Units.KILOMETRE; - /** - * Uranus mass - */ + /// Uranus mass public const double URANUS_MASS = 14.536 * EARTH_MASS; - /** - * Uranus semi-major axis - */ + /// Uranus semi-major axis public const double URANUS_SEMI_MAJOR_AXIS = 19.2184 * ASTRONOMICAL_UNIT; - /** - * Neptune radius - */ + /// Neptune radius public const double NEPTUNE_RADIUS_MEAN = 24622 * Units.KILOMETRE; - /** - * Neptune mass - */ + /// Neptune mass public const double NEPTUNE_MASS = 17.147 * EARTH_MASS; - /** - * Neptune semi-major axis - */ + /// Neptune semi-major axis public const double NEPTUNE_SEMI_MAJOR_AXIS = 30.110387 * ASTRONOMICAL_UNIT; } } \ No newline at end of file From b6a191ad32c64562185016e577353eec335efdf5 Mon Sep 17 00:00:00 2001 From: Adam Spofford Date: Tue, 20 Aug 2019 08:15:36 -0700 Subject: [PATCH 15/15] Document BinaryRelations.cs --- .../mathcollection/BinaryRelations.cs | 244 +++++++++--------- 1 file changed, 117 insertions(+), 127 deletions(-) diff --git a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/mathcollection/BinaryRelations.cs b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/mathcollection/BinaryRelations.cs index c93efc0f..d056daec 100644 --- a/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/mathcollection/BinaryRelations.cs +++ b/CURRENT/c-sharp/src/org/mariuszgromada/math/mxparser/mathcollection/BinaryRelations.cs @@ -56,109 +56,94 @@ using System; namespace org.mariuszgromada.math.mxparser.mathcollection { - /** - * BinaryRelations - class for dealing with binary relations on integers or doubles. - * - * @author Mariusz Gromada
- * mariuszgromada.org@gmail.com
- * MathSpace.pl
- * MathParser.org - mXparser project page
- * mXparser on GitHub
- * mXparser on SourceForge
- * mXparser on Bitbucket
- * mXparser on CodePlex
- * Janet Sudoku - project web page
- * Janet Sudoku on GitHub
- * Janet Sudoku on CodePlex
- * Janet Sudoku on SourceForge
- * Janet Sudoku on BitBucket
- * Scalar Free
- * Scalar Pro
- * ScalarMath.org
- * - * @version 4.1.0 - */ + /// BinaryRelations - class for dealing with binary relations on integers or doubles. + /// + /// + /// Author: Mariusz Gromada
+ /// mariuszgromada.org@gmail.com
+ /// MathSpace.pl
+ /// MathParser.org - mXparser project page
+ /// mXparser on GitHub
+ /// mXparser on SourceForge
+ /// mXparser on Bitbucket
+ /// mXparser on CodePlex
+ /// Janet Sudoku - project web page
+ /// Janet Sudoku on GitHub
+ /// Janet Sudoku on CodePlex
+ /// Janet Sudoku on SourceForge
+ /// Janet Sudoku on BitBucket
+ /// Scalar Free
+ /// Scalar Pro
+ /// ScalarMath.org + /// + /// Version: 4.1.0 + ///
[CLSCompliant(true)] public sealed class BinaryRelations { - /** - * Default epsilon for comparison - */ + /// Default epsilon for comparison public static readonly double DEFAULT_COMPARISON_EPSILON = 0.00000000000001; - /** - * Epsilon for comparison - */ + /// Epsilon for comparison internal static double epsilon = DEFAULT_COMPARISON_EPSILON; - /** - * COmparison mode indicator - */ + /// COmparison mode indicator internal static bool epsilonComparison = true; - /** - * Sets comparison mode to EXACT. - */ + /// Sets comparison mode to EXACT. public static void setExactComparison() { epsilonComparison = false; } - /** - * Sets comparison mode to EPSILON. - */ + /// Sets comparison mode to EPSILON. public static void setEpsilonComparison() { epsilonComparison = true; } - /** - * Sets epsilon value. - * @param epsilon Epsilon value (grater than 0). - * - * @see #setEpsilonComparison() - */ + /// Sets epsilon value. + /// + /// Epsilon value (grater than 0). + /// + /// public static void setEpsilon(double epsilon) { if (epsilon > 0) BinaryRelations.epsilon = epsilon; } - /** - * Sets default epsilon value. - * - * @see #setEpsilonComparison() - * @see #DEFAULT_COMPARISON_EPSILON - */ + /// Sets default epsilon value. + /// + /// + /// public static void setDefaultEpsilon() { BinaryRelations.epsilon = DEFAULT_COMPARISON_EPSILON; } - /** - * Returns current epsilon value. - * @return Returns current epsilon value. - * - * @see #setEpsilonComparison() - */ + /// Returns current epsilon value. + /// + /// Returns current epsilon value. + /// + /// public static double getEpsilon() { return epsilon; } - /** - * Checks if epsilon comparison mode is active; - * @return True if epsilon mode is active, otherwise returns false. - * @see #setEpsilonComparison() - * @see #setExactComparison() - */ + /// Checks if epsilon comparison mode is active; + /// + /// True if epsilon mode is active, otherwise returns false. + /// + /// + /// public static bool checkIfEpsilonMode() { return epsilonComparison; } - /** - * Checks if exact comparison mode is active; - * @return True if exact mode is active, otherwise returns false. - * @see #setEpsilonComparison() - * @see #setExactComparison() - */ + /// Checks if exact comparison mode is active; + /// @return True if exact mode is active, otherwise returns false. + /// + /// public static bool checkIfExactMode() { return !epsilonComparison; } - /** - * Equality relation. - * - * @param a the a number (a = b) - * @param b the b number (a = b) - * - * @return if a = Double.NaN or b = Double.NaN return Double.NaN, - * else if a = b return 1, - * otherwise return 0. - */ + /// Equality relation. + /// + /// the a number (a = b) + /// the b number (a = b) + /// + /// + /// if a = or b = + /// return , + /// else if a = b return 1, + /// otherwise return 0. + /// public static double eq(double a, double b) { if ((Double.IsNaN(a)) || (Double.IsNaN(b))) return Double.NaN; double eps = NumberTheory.max(epsilon, MathFunctions.ulp(b)); @@ -169,16 +154,17 @@ public static double eq(double a, double b) { } else if (a == b) result = BooleanAlgebra.TRUE; return result; } - /** - * Inequality relation. - * - * @param a the a number (a <> b) - * @param b the b number (a <> b) - * - * @return if a = Double.NaN or b = Double.NaN return Double.NaN, - * else if a <> b return 1, - * otherwise return 0. - */ + /// Inequality relation. + /// + /// the a number (a <> b) + /// the b number (a <> b) + /// + /// + /// if a = or b = + /// return , + /// else if a <> b return 1, + /// otherwise return 0. + /// public static double neq(double a, double b) { if ((Double.IsNaN(a)) || (Double.IsNaN(b))) return Double.NaN; double eps = NumberTheory.max(epsilon, MathFunctions.ulp(b)); @@ -189,16 +175,17 @@ public static double neq(double a, double b) { } else if (a != b) result = BooleanAlgebra.TRUE; return result; } - /** - * Lower than relation. - * - * @param a the a number (a < b) - * @param b the b number (a < b) - * - * @return if a = Double.NaN or b = Double.NaN return Double.NaN, - * else if a < b return 1, - * otherwise return 0. - */ + /// Lower than relation. + /// + /// the a number (a < b) + /// the b number (a < b) + /// + /// + /// if a = or b = + /// return , + /// else if a < b return 1, + /// otherwise return 0. + /// public static double lt(double a, double b) { if ((Double.IsNaN(a)) || (Double.IsNaN(b))) return Double.NaN; double eps = NumberTheory.max(epsilon, MathFunctions.ulp(b)); @@ -209,16 +196,17 @@ public static double lt(double a, double b) { } else if (a < b) result = BooleanAlgebra.TRUE; return result; } - /** - * Greater than relation. - * - * @param a the a number (a > b) - * @param b the b number (a > b) - * - * @return if a = Double.NaN or b = Double.NaN return Double.NaN, - * else if a > b return 1, - * otherwise return 0. - */ + /// Greater than relation. + /// + /// the a number (a > b) + /// the b number (a > b) + /// + /// + /// if a = or b = + /// return , + /// else if a > b return 1, + /// otherwise return 0. + /// public static double gt(double a, double b) { if ((Double.IsNaN(a)) || (Double.IsNaN(b))) return Double.NaN; double eps = NumberTheory.max(epsilon, MathFunctions.ulp(b)); @@ -229,16 +217,17 @@ public static double gt(double a, double b) { } else if (a > b) result = BooleanAlgebra.TRUE; return result; } - /** - * Lower or equal relation. - * - * @param a the a number (a <= b) - * @param b the b number (a <= b) - * - * @return if a = Double.NaN or b = Double.NaN return Double.NaN, - * else if a <= b return 1, - * otherwise return 0. - */ + /// Lower or equal relation. + /// + /// the a number (a <= b) + /// the b number (a <= b) + /// + /// + /// if a = or b = + /// return , + /// else if a <= b return 1, + /// otherwise return 0. + /// public static double leq(double a, double b) { if ((Double.IsNaN(a)) || (Double.IsNaN(b))) return Double.NaN; double eps = NumberTheory.max(epsilon, MathFunctions.ulp(b)); @@ -249,16 +238,17 @@ public static double leq(double a, double b) { } else if (a <= b) result = BooleanAlgebra.TRUE; return result; } - /** - * Greater or equal relation. - * - * @param a the a number (a >= b) - * @param b the b number (a >= b) - * - * @return if a = Double.NaN or b = Double.NaN return Double.NaN, - * else if a >= b return 1, - * otherwise return 0. - */ + /// Greater or equal relation. + /// + /// the a number (a >= b) + /// the b number (a >= b) + /// + /// + /// if a = or b = + /// return , + /// else if a >= b return 1, + /// otherwise return 0. + /// public static double geq(double a, double b) { if ((Double.IsNaN(a)) || (Double.IsNaN(b))) return Double.NaN; double eps = NumberTheory.max(epsilon, MathFunctions.ulp(b));