Class mXparser
java.lang.Object
org.mariuszgromada.math.mxparser.mXparser
mXparser class provides usefull methods when parsing, calculating or
parameters transforming.
- Version:
- 6.1.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static booleanIndicator marking whether to round final result to precise integer when result is very close to integer, solves problems like sin(pi) = 0(package private) static booleanInternal indicator informing the parser whether to try to fix the expression String.static final StringFramework used to compile mXparser(package private) static booleanIndicator whether to call cancel current calculation(package private) static booleanDouble floating-point precision arithmetic causes rounding problems, i.e.private static StringBuilderConsole output string for below methodsprivate static Stringprivate static Stringprivate static int(package private) static final int(package private) static booleanIndicator whether mXparser operates in radians / degrees mode true - degrees mode false - radians mode Default false (radians mode)(package private) static final intThe maximum error message length in expression(package private) static final intThe maximum number of expected tokens presented in error message when lexical error was encountered(package private) static final int(package private) static ExpressionEmpty expression for general help purposes.(package private) static booleanImplied multiplication modestatic final StringThe terms of MathParser.org-mXparser DUAL LICENSE AGREEMENT.(package private) static intInternal 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);static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String(package private) static final intFOUND / NOT_FOUND used for matching purposes(package private) static intOptions changeset(package private) static booleanIndicator whether user defined tokens should override built-in tokens.static final intstatic PrimesCachePrime numbers cache(package private) static booleanIndicator whether to select best matching language to OS localeprivate static intThreads number settings(package private) static List<TokenModification> List of built-in tokens to modifyList of built-in tokens to remove.(package private) static booleanDouble floating-point precision arithmetic causes mXparser provides intelligent ULP rounding to avoid some type of this errors.(package private) static booleanInternal indicator informing hte parser that unicode know keywords are enabled and will be recognized by the parser as built-in functions or operatorsstatic final Stringstatic final Stringstatic final intmXparser versionstatic final intstatic final Stringstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic double[]arrayList2double(List<Double> numbers) Converts List of double to double[]static voidMethod give a signal to other methods to cancel current calculation.static voidchangeLanguageTo(String language) Changes language to the one that best matches provided language code.static voidchangeLanguageTo(Locale locale) Changes language to the one that best matches provided language code in locale.static voidChanges language to the one that best matches current OS locale.static booleanReturns state of almost integer rounding option causing rounding final calculation result to precise integer if and only if result is very close to integer.static booleanGets attempt to fix expression string modestatic booleanDouble floating-point precision arithmetic causes rounding problems, i.e.static booleanChecks whether mXparser operates in degrees mode for trigonometric functions.static booleanChecks if epsilon comparison mode is active;static booleanChecks if exact comparison mode is active;static booleanGets implied multiplication statusstatic booleanChecks whether mXparser operates in radians mode for trigonometric functions.static booleanChecks if mode of selection of best matching language based on the current OS locale is enabled.static booleanChecks whether mXparser is set to override built-in tokens.static booleanChecks if special case recognition is enabled.static booleanDouble floating-point precision arithmetic causes rounding problems, i.e.static booleanGets unicode built-in parser keywords modestatic voidPrints object.toString to the Consolestatic voidconsolePrint(List<Token> tokens) Prints tokens to the console.static voidPrints all help content.static voidconsolePrintHelp(String query) Prints filtered help content.static voidPrints to the console the terms of MathParser.org-mXparser DUAL LICENSE AGREEMENTstatic voidPrints new line to the Console, no new linestatic voidPrints object.toString to the Console + new linestatic voidconsolePrintln(String[] stringArray) Prints array of stringsstatic voidconsolePrintln(List<Token> tokens) Prints tokens to the console.static voidstatic voidconsolePrintSettings(String prefix) static voidconsolePrintTokens(List<Token> tokens) Prints tokens to the console.static StringconvDecimal2OthBase(double decimalNumber, int numeralSystemBase) Decimal number to other numeral system conversion with base between 1 and 36.static StringconvDecimal2OthBase(double decimalNumber, int numeralSystemBase, int format) Decimal number to other numeral system conversion with base between 1 and 36.static doubleconvOthBase2Decimal(double numeralSystemBase, double... digits) Other base to decimal conversion.static doubleconvOthBase2Decimal(int numeralSystemBase, int... digits) Other base to decimal conversion.static doubleconvOthBase2Decimal(String numberLiteral) Other base (base between 1 and 36) number literal conversion to decimal number.static doubleconvOthBase2Decimal(String numberLiteral, int numeralSystemBase) Other base (base between 1 and 36) number literal conversion to decimal number.static voidDisables almost integer rounding option causing rounding final calculation result to precise integer if and only if result is very close to integer.static voidDisables attempt to fix the expression String.static voidDisables canonical rounding.static voidDisables implied multiplicationstatic voidDisables mode of selection of best matching language based on the current OS locale.static voidDisables special case recognition options, e.g.static voidDisables ULP rounding.static voidDisables unicode built-in parser keywords, this flag informs the parser that built-in unicode keywords are not supported and will not be recognized as functions or operators.static voidEnables almost integer rounding option causing rounding final calculation result to precise integer if and only if result is very close to integer.static voidEnables attempt to fix the expression String.static voidEnables canonical rounding.static voidSets implied multiplicationstatic voidOption that enables selection of best matching language based on the current OS locale.static voidEnables special case recognition options, e.g.static voidEnables ULP rounding.static voidEnables unicode built-in parser keywords, this flag informs the parser that built-in unicode keywords are supported and will be recognized as functions or operators.static StringfractionToString(double[] fraction) Converts array representing fraction to fraction string representation.static String[][]Return details on tokens marked to be modified.static String[]Returns current list of tokens marked to be removed.static StringReturns console output string, console output string is being built by consolePrintln(), consolePrint().static doubleReturns current epsilon value.static doublegetFunctionValue(Expression f, Argument x, double x0) Deprecated.static double[]getFunctionValues(Expression f, Argument index, double from, double to, double delta) Deprecated.Planned to be removed, useMathFunctions.getFunctionValues(Expression, Argument, double, double, double)insteadstatic StringgetHelp()Returns detailed user help on the syntax of mathematical expressions.static StringReturns detailed user help on the syntax of mathematical expressions.static StringReturns detailed user help on the syntax of mathematical expressions.static StringReturns detailed user help on the syntax of mathematical expressions.static StringReturns (as CSV) detailed user help on the syntax of mathematical expressions.static StringgetHelpAsCsv(String query) Returns (as CSV) detailed user help on the syntax of mathematical expressions.static StringgetHelpAsCsv(String quote, String delimiter, boolean addHeader) Returns (as CSV) detailed user help on the syntax of mathematical expressions.static StringgetHelpAsCsv(String query, String quote, String delimiter, boolean addHeader) Returns (as CSV) detailed user help on the syntax of mathematical expressions.static StringReturns (as HTML table) detailed user help on the syntax of mathematical expressions.static StringgetHelpAsHtmlTable(boolean addHeader, boolean addCaption, boolean addFigure, String caption, String cssClass) Returns (as HTML table) detailed user help on the syntax of mathematical expressions.static StringgetHelpAsHtmlTable(String query) Returns (as HTML table) detailed user help on the syntax of mathematical expressions.static StringgetHelpAsHtmlTable(String query, boolean addHeader, boolean addCaption, boolean addFigure, String caption, String cssClass) Returns (as HTML table) detailed user help on the syntax of mathematical expressions.static StringReturns (as Json) detailed user help on the syntax of mathematical expressions.static StringgetHelpAsJson(boolean addCaption, String caption) Returns (as Json) detailed user help on the syntax of mathematical expressions.static StringgetHelpAsJson(String query) Returns (as Json) detailed user help on the syntax of mathematical expressions.static StringgetHelpAsJson(String query, boolean addCaption, String caption) Returns (as Json) detailed user help on the syntax of mathematical expressions.static StringReturns (as Markdown table) detailed user help on the syntax of mathematical expressions.static StringgetHelpAsMarkdownTable(boolean addHeader, boolean addCaption, String caption) Returns (as Markdown table) detailed user help on the syntax of mathematical expressions.static StringgetHelpAsMarkdownTable(String query) Returns (as Markdown table) detailed user help on the syntax of mathematical expressions.static StringgetHelpAsMarkdownTable(String query, boolean addHeader, boolean addCaption, String caption) Returns (as Markdown table) detailed user help on the syntax of mathematical expressions.Returns list of keywords known to the parsergetKeyWords(String query) Returns list of keywords known to the parser.static StringGets license infostatic intInternal limit to avoid infinite loops while calculating expression defined in the way shown by below examples.static intReturns maximum integer number in primes cachestatic intGets maximum threads numberstatic longGets initial search size used by the toFraction methodstatic StringgetTokenTypeDescription(int tokenTypeId) Deprecated.Planned to be removed, useToken.getTokenTypeDescription(int)insteadstatic StringhexString2AsciiString(String hexString) Deprecated.Planned to be removed, useStringUtils.hexString2AsciiString(String)insteadprivate static voidstatic voidInitialization of prime numbers cache.static voidinitPrimesCache(int mximumNumberInCache) Initialization of prime numbers cache.static voidinitPrimesCache(PrimesCache primesCache) Initialization of prime numbers cache.static booleanCheck whether a flag to cancel current calculation process is set.static booleanReturns true in case when primes cache initialization was successful, otherwise returns false.static voidmodifyBuiltinToken(String currentToken, String newToken) Method to change definition of built-in token - more precisely using this method allows to modify token string recognized by the parser (i.e.static voidmodifyBuiltinToken(String currentToken, String newToken, String newTokenDescription) Method to change definition of built-in token - more precisely using this method allows to modify token string recognized by the parser (i.e.static StringnumberToAsciiString(double number) Deprecated.Planned to be removed, useStringUtils.numberToAsciiString(double)insteadstatic StringnumberToAsciiString(int number) Deprecated.Planned to be removed, useStringUtils.numberToAsciiString(int)insteadstatic StringnumberToAsciiString(long number) Deprecated.Planned to be removed, useStringUtils.numberToAsciiString(long)insteadstatic StringnumberToHexString(double number) Deprecated.Planned to be removed, useStringUtils.numberToHexString(double)insteadstatic StringnumberToHexString(int number) Deprecated.Planned to be removed, useStringUtils.numberToHexString(int)insteadstatic StringnumberToHexString(long number) Deprecated.Planned to be removed, useStringUtils.numberToHexString(long)instead(package private) static voidstatic booleanregexMatch(String str, String pattern) Deprecated.Planned to be removed, useStringUtils.regexMatch(String, String)insteadstatic voidremoveBuiltinTokens(String... tokens) Removes built-in tokens form the list of tokens recognized by the parsers.static voidResets a flag giving signal to the engine to cancel current calculation.static voidResets console output string, console output string is being built by consolePrintln(), consolePrint().static voidsetAlmostIntRounding(boolean almostIntRoundingState) Enables / disables almost integer rounding option causing rounding final calculation result to precise integer if and only if result is very close to integer.static voidsetCanonicalRounding(boolean canonicalRoundingState) Enables / disables canonical rounding.static voidsetConsoleOutputPrefix(String consoleOutputPrefix) Sets console output string prefix.static voidsetConsolePrefix(String consolePrefix) Sets console prefix.static voidSets default console output string prefix.static voidSets default console prefix.static voidSets default epsilon value.static voidInternal default limit to avoid infinite loops while calculating expression defined in the way shown by below examples.static voidSets default mXparser optionsstatic voidSets default threads numberstatic voidSet mXparser to operate in degrees mode for trigonometric functionsstatic voidsetEpsilon(double epsilon) Sets epsilon value used in the EPSILON comparison mode and the almost integer rounding mode.static voidSets comparison mode to EPSILON.static voidSets comparison mode to EXACT.static voidsetMaxAllowedRecursionDepth(int maxAllowedRecursionDepth) Internal limit to avoid infinite loops while calculating expression defined in the way shown by below examples.static voidSetsprimesCacheto nullstatic voidSets mXparser not to override built-in tokens by user defined tokens.static voidSet mXparser to operate in radians mode for trigonometric functionsstatic voidsetRandomGenerator(Random randomGenerator) Modifies random generator used by the ProbabilityDistributions class.static voidsetSpecialCases(boolean specialCasesState) Enables special case recognition options, e.g.static voidsetThreadsNumber(int threadsNumber) Sets threads numberstatic voidsetToFractionInitSearchSize(long n) Sets initial search size for the toFraction methodstatic voidSets mXparser to override built-in tokens by user defined tokens.static voidsetUlpRounding(boolean ulpRoundingState) Enables / disables ULP rounding.static double[]toFraction(double value) Converts double value to its fraction representation.static StringtoFractionString(double value) Converts number to its fraction string representation.static double[]toMixedFraction(double value) Converts double value to its mixed fraction representation.static StringtoMixedFractionString(double value) Converts number to its mixed fraction string representation.static voidUn-marks all tokens previously marked to be modified.static voidunmodifyBuiltinTokens(String... currentOrNewTokens) Un-marks tokens previously marked to be modified.static voidUn-marks all tokens previously marked to be removed.static voidunremoveBuiltinTokens(String... tokens) Un-marks tokens previously marked to be removed.static voidwait(int timeMillis) Waits given number of milliseconds
-
Field Details
-
VERSION_MAJOR
public static final int VERSION_MAJORmXparser version- See Also:
-
VERSION_MINOR
public static final int VERSION_MINOR- See Also:
-
VERSION_PATCH
public static final int VERSION_PATCH- See Also:
-
VERSION
- See Also:
-
VERSION_CODE_NAME
- See Also:
-
VERSION_NAME
- See Also:
-
BUIT_FOR
-
NOT_FOUND
static final int NOT_FOUNDFOUND / NOT_FOUND used for matching purposes- See Also:
-
FOUND
static final int FOUND- See Also:
-
CONSOLE_OUTPUT
Console output string for below methods- See Also:
-
CONSOLE_PREFIX
-
CONSOLE_OUTPUT_PREFIX
-
CONSOLE_ROW_NUMBER
private static volatile int CONSOLE_ROW_NUMBER -
primesCache
Prime numbers cache -
PRIMES_CACHE_NOT_INITIALIZED
public static final int PRIMES_CACHE_NOT_INITIALIZED- See Also:
-
THREADS_NUMBER
private static int THREADS_NUMBERThreads number settings -
ulpRounding
static volatile boolean ulpRoundingDouble floating-point precision arithmetic causes mXparser provides intelligent ULP rounding to avoid some type of this errors. -
canonicalRounding
static volatile boolean canonicalRoundingDouble floating-point precision arithmetic causes rounding problems, i.e. 0.1 + 0.1 + 0.1 is different than 0.3 mXparser provides intelligent canonical rounding to avoid majority of this errors. -
almostIntRounding
static volatile boolean almostIntRoundingIndicator marking whether to round final result to precise integer when result is very close to integer, solves problems like sin(pi) = 0 -
DEFAULT_MAX_RECURSION_CALLS
static final int DEFAULT_MAX_RECURSION_CALLS- See Also:
-
MAX_RECURSION_CALLS
static volatile int MAX_RECURSION_CALLSInternal 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); -
ERROR_MESSAGE_MAXIMUM_LENGTH
static final int ERROR_MESSAGE_MAXIMUM_LENGTHThe maximum error message length in expression- See Also:
-
ERROR_MESSAGE_MAXIMUM_NUMBER_OF_EXPECTED_TOKENS
static final int ERROR_MESSAGE_MAXIMUM_NUMBER_OF_EXPECTED_TOKENSThe maximum number of expected tokens presented in error message when lexical error was encountered- See Also:
-
tokensToRemove
-
tokensToModify
List of built-in tokens to modify -
degreesMode
static volatile boolean degreesModeIndicator whether mXparser operates in radians / degrees mode true - degrees mode false - radians mode Default false (radians mode) -
overrideBuiltinTokens
static volatile boolean overrideBuiltinTokensIndicator whether user defined tokens should override built-in tokens. -
impliedMultiplicationMode
static volatile boolean impliedMultiplicationModeImplied multiplication mode -
unicodeKeyWordsEnabled
static volatile boolean unicodeKeyWordsEnabledInternal indicator informing hte parser that unicode know keywords are enabled and will be recognized by the parser as built-in functions or operators -
attemptToFixExpStrEnabled
static volatile boolean attemptToFixExpStrEnabledInternal indicator informing the parser whether to try to fix the expression String. For example, situations such as: "++" change to "+", "+-" changed to "-" "-+" changed to "-" "--" changed to "-" -
optionsChangesetNumber
static volatile int optionsChangesetNumberOptions changeset -
cancelCurrentCalculationFlag
static volatile boolean cancelCurrentCalculationFlagIndicator whether to call cancel current calculation -
selectBestMatchingLanguage
static volatile boolean selectBestMatchingLanguageIndicator whether to select best matching language to OS locale -
HELP_EXPRESSION
Empty expression for general help purposes. -
LICENSE
The terms of MathParser.org-mXparser DUAL LICENSE AGREEMENT.- See Also:
-
NAMEv10
- See Also:
-
NAMEv20
- See Also:
-
NAMEv23
- See Also:
-
NAMEv24
- See Also:
-
NAMEv30
- See Also:
-
NAMEv40
- See Also:
-
NAMEv41
- See Also:
-
NAMEv42
- See Also:
-
NAMEv43
- See Also:
-
NAMEv44
- See Also:
-
NAMEv50
- See Also:
-
NAMEv51
- See Also:
-
NAMEv52
- See Also:
-
NAMEv60
- See Also:
-
NAMEv61
- See Also:
-
-
Constructor Details
-
mXparser
public mXparser()
-
-
Method Details
-
refreshHelp
static void refreshHelp() -
initPrimesCache
public static void initPrimesCache()Initialization of prime numbers cache. Cache size according toPrimesCache.DEFAULT_MAX_NUM_IN_CACHE- See Also:
-
initPrimesCache
public static void initPrimesCache(int mximumNumberInCache) Initialization of prime numbers cache.- Parameters:
mximumNumberInCache- The maximum integer number that will be stored in cache.- See Also:
-
initPrimesCache
Initialization of prime numbers cache.- Parameters:
primesCache- The primes cache object- See Also:
-
isInitPrimesCacheSuccessful
public static boolean isInitPrimesCacheSuccessful()Returns true in case when primes cache initialization was successful, otherwise returns false.- Returns:
- Returns true in case when primes cache initialization was successful, otherwise returns false.
-
setNoPrimesCache
public static void setNoPrimesCache()SetsprimesCacheto null -
getMaxNumInPrimesCache
public static int getMaxNumInPrimesCache()Returns maximum integer number in primes cache- Returns:
- If primes cache was initialized then maximum number in
primes cache, otherwise
PRIMES_CACHE_NOT_INITIALIZED
-
getThreadsNumber
public static int getThreadsNumber()Gets maximum threads number- Returns:
- Threads number.
-
setDefaultThreadsNumber
public static void setDefaultThreadsNumber()Sets default threads number -
setThreadsNumber
public static void setThreadsNumber(int threadsNumber) Sets threads number- Parameters:
threadsNumber- Thread number.
-
getFunctionValue
Deprecated.Planned to be removed, useMathFunctions.getFunctionValue(Expression, Argument, double)insteadCalculates function f(x0) (given as expression) assigning Argument x = x0;- Parameters:
f- the expressionx- the argumentx0- the argument value- Returns:
- f.calculate()
- See Also:
-
arrayList2double
-
getFunctionValues
@Deprecated public static double[] getFunctionValues(Expression f, Argument index, double from, double to, double delta) Deprecated.Planned to be removed, useMathFunctions.getFunctionValues(Expression, Argument, double, double, double)insteadReturns array of double values of the function f(i) calculated on the range: i = from to i = to by step = delta- Parameters:
f- Function expressionindex- Index argumentfrom- 'from' valueto- 'to' valuedelta- 'delta' step definition- Returns:
- Array of function values
-
setRandomGenerator
Modifies random generator used by the ProbabilityDistributions class.- Parameters:
randomGenerator- Random generator.- See Also:
-
setExactComparison
public static void setExactComparison()Sets comparison mode to EXACT.- See Also:
-
setEpsilonComparison
public static void setEpsilonComparison()Sets comparison mode to EPSILON.- See Also:
-
setEpsilon
public static void setEpsilon(double epsilon) Sets epsilon value used in the EPSILON comparison mode and the almost integer rounding mode.- Parameters:
epsilon- Epsilon value (grater than 0).- See Also:
-
setDefaultEpsilon
public static void setDefaultEpsilon()Sets default epsilon value.- See Also:
-
getEpsilon
public static double getEpsilon()Returns current epsilon value.- Returns:
- Returns current epsilon value.
- See Also:
-
checkIfEpsilonMode
public static boolean checkIfEpsilonMode()Checks if epsilon comparison mode is active;- Returns:
- True if epsilon mode is active, otherwise returns false.
- See Also:
-
checkIfExactMode
public static boolean checkIfExactMode()Checks if exact comparison mode is active;- Returns:
- True if exact mode is active, otherwise returns false.
- See Also:
-
enableUlpRounding
public static void enableUlpRounding()Enables ULP rounding. Double floating-point precision arithmetic causes rounding problems, i.e. 0.1 + 0.1 + 0.1 is slightly different from 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 -
disableUlpRounding
public static void disableUlpRounding()Disables ULP rounding. Double floating-point precision arithmetic causes rounding problems, i.e. 0.1 + 0.1 + 0.1 is slightly different from 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 from 0.3. -
setUlpRounding
public static void setUlpRounding(boolean ulpRoundingState) Enables / disables ULP rounding. Double floating-point precision arithmetic causes rounding problems, i.e. 0.1 + 0.1 + 0.1 is slightly different from 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 from 0.3.- Parameters:
ulpRoundingState- True to enable, false to disable
-
checkIfUlpRounding
public static boolean checkIfUlpRounding()Double floating-point precision arithmetic causes rounding problems, i.e. 0.1 + 0.1 + 0.1 is slightly different from 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- Returns:
- True if ULP rounding is enabled, otherwise false.
-
enableCanonicalRounding
public static void enableCanonicalRounding()Enables canonical rounding. Double floating-point precision arithmetic causes rounding problems, i.e. 0.1 + 0.1 + 0.1 is slightly different from 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 canonical rounding to minimize misleading results. By default, this option is enabled resulting in automatic rounding only in some cases. Using this mode 2.5 - 2.2 = 0.3 -
disableCanonicalRounding
public static void disableCanonicalRounding()Disables canonical rounding. Double floating-point precision arithmetic causes rounding problems, i.e. 0.1 + 0.1 + 0.1 is slightly different from 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 canonical rounding to minimize misleading results. By default, this option is enabled resulting in automatic rounding only in some cases. Using this mode 2.5 - 2.2 = 0.3 -
setCanonicalRounding
public static void setCanonicalRounding(boolean canonicalRoundingState) Enables / disables canonical rounding. Double floating-point precision arithmetic causes rounding problems, i.e. 0.1 + 0.1 + 0.1 is slightly different from 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 from 0.3.- Parameters:
canonicalRoundingState- True to enable, false to disable
-
checkIfCanonicalRounding
public static boolean checkIfCanonicalRounding()Double floating-point precision arithmetic causes rounding problems, i.e. 0.1 + 0.1 + 0.1 is slightly different from 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 canonical rounding to minimize misleading results. By default, this option is enabled resulting in automatic rounding only in some cases. Using this mode 2.5 - 2.2 = 0.3- Returns:
- True if Canonical rounding is enabled, otherwise false.
-
enableAlmostIntRounding
public static void enableAlmostIntRounding()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 Also:
-
disableAlmostIntRounding
public static void disableAlmostIntRounding()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 Also:
-
setAlmostIntRounding
public static void setAlmostIntRounding(boolean almostIntRoundingState) Enables / 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.- Parameters:
almostIntRoundingState- True to enable, false to disable
-
checkIfAlmostIntRounding
public static boolean checkIfAlmostIntRounding()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.- Returns:
- true if option enabled, false otherwise
- See Also:
-
enableSpecialCases
public static void enableSpecialCases()Enables special case recognition options, e.g. tan(pi/2) = NaN. Default behaviour is 'enableSpecialCases'. -
disableSpecialCases
public static void disableSpecialCases()Disables special case recognition options, e.g. tan(pi/2) will return value according to the standard math library implementation. Default behaviour is 'enableSpecialCases'. -
setSpecialCases
public static void setSpecialCases(boolean specialCasesState) Enables special case recognition options, e.g. tan(pi/2) = NaN or disables special case recognition options, e.g. tan(pi/2) will return value according to the standard math library implementation. Default behaviour is 'enableSpecialCases'.- Parameters:
specialCasesState- true to enable, false to disable.
-
checkIfSpecialCases
public static boolean checkIfSpecialCases()Checks if special case recognition is enabled.- Returns:
- true in case if special case recognition is enabled, otherwise false.
-
setMaxAllowedRecursionDepth
public static void setMaxAllowedRecursionDepth(int 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);- Parameters:
maxAllowedRecursionDepth- Maximum number of allowed recursion calls
-
setDefaultMaxAllowedRecursionDepth
public static void setDefaultMaxAllowedRecursionDepth()Internal default 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); -
getMaxAllowedRecursionDepth
public static int getMaxAllowedRecursionDepth()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.- Returns:
- Max allowed recursion calls
-
setRadiansMode
public static void setRadiansMode()Set mXparser to operate in radians mode for trigonometric functions -
setDegreesMode
public static void setDegreesMode()Set mXparser to operate in degrees mode for trigonometric functions -
checkIfRadiansMode
public static boolean checkIfRadiansMode()Checks whether mXparser operates in radians mode for trigonometric functions.- Returns:
- true - if radians mode, false - otherwise
-
checkIfDegreesMode
public static boolean checkIfDegreesMode()Checks whether mXparser operates in degrees mode for trigonometric functions.- Returns:
- true - if degrees mode, false - otherwise
-
enableImpliedMultiplicationMode
public static void enableImpliedMultiplicationMode()Sets implied multiplication -
disableImpliedMultiplicationMode
public static void disableImpliedMultiplicationMode()Disables implied multiplication -
checkIfImpliedMultiplicationMode
public static boolean checkIfImpliedMultiplicationMode()Gets implied multiplication status- Returns:
- true if implied multiplication is enabled, otherwise returns false.
-
enableUnicodeBuiltinKeyWordsMode
public static void enableUnicodeBuiltinKeyWordsMode()Enables unicode built-in parser keywords, this flag informs the parser that built-in unicode keywords are supported and will be recognized as functions or operators. -
disableUnicodeBuiltinKeyWordsMode
public static void disableUnicodeBuiltinKeyWordsMode()Disables unicode built-in parser keywords, this flag informs the parser that built-in unicode keywords are not supported and will not be recognized as functions or operators. -
checkIfUnicodeBuiltinKeyWordsMode
public static boolean checkIfUnicodeBuiltinKeyWordsMode()Gets unicode built-in parser keywords mode- Returns:
- true if unicode built-in parser keywords is enabled, otherwise returns false.
-
enableAttemptToFixExpStrMode
public static void enableAttemptToFixExpStrMode()Enables attempt to fix the expression String. For example, situations such as: "++" change to "+", "+-" changed to "-" "-+" changed to "-" "--" changed to "+" -
disableAttemptToFixExpStrMode
public static void disableAttemptToFixExpStrMode()Disables attempt to fix the expression String. For example, situations such as: "++" change to "+", "+-" changed to "-" "-+" changed to "-" "--" changed to "+" -
checkIfAttemptToFixExpStrMode
public static boolean checkIfAttemptToFixExpStrMode()Gets attempt to fix expression string mode- Returns:
- true attempt to fix expression string mode is enabled, otherwise returns false.
-
enableSelectBestMatchingLanguage
public static void enableSelectBestMatchingLanguage()Option that enables selection of best matching language based on the current OS locale. Supported languages: English, French, German, Italian, Polish, Portuguese, Spanish. If OS language is not supported, then English is selected.- See Also:
-
disableSelectBestMatchingLanguage
public static void disableSelectBestMatchingLanguage()Disables mode of selection of best matching language based on the current OS locale. Returns to the English language.- See Also:
-
checkIfSelectBestMatchingLanguage
public static boolean checkIfSelectBestMatchingLanguage()Checks if mode of selection of best matching language based on the current OS locale is enabled.- Returns:
- True if mode of selection of best matching language is enabled, otherwise false.
- See Also:
-
changeLanguageTo
Changes language to the one that best matches provided language code. Supported languages: English, French, German, Italian, Polish, Portuguese, Spanish. If language code does not belong to the supported language codes English language is selected.- Parameters:
language- Supported language codes: en, fr, de, it, pl, pt, es.- See Also:
-
changeLanguageTo
Changes language to the one that best matches provided language code in locale. Supported languages: English, French, German, Italian, Polish, Portuguese, Spanish. If language code does not belong to the supported language codes English language is selected.- Parameters:
locale- Supported locale language codes: en, fr, de, it, pl, pt, es.- See Also:
-
changeLanguageToBestMatching
public static void changeLanguageToBestMatching()Changes language to the one that best matches current OS locale. Supported languages: English, French, German, Italian, Polish, Portuguese, Spanish. If OS language is not supported, then English is selected.- See Also:
-
setToFractionInitSearchSize
public static void setToFractionInitSearchSize(long n) Sets initial search size for the toFraction method- Parameters:
n- initial search size, has to be non-zero positive.- See Also:
-
getToFractionInitSearchSize
public static long getToFractionInitSearchSize()Gets initial search size used by the toFraction method- Returns:
- initial search size used by the toFraction method
- See Also:
-
removeBuiltinTokens
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.- Parameters:
tokens- List of tokens to remove.
-
unremoveBuiltinTokens
Un-marks tokens previously marked to be removed.- Parameters:
tokens- List of tokens to un-mark.
-
unremoveAllBuiltinTokens
public static void unremoveAllBuiltinTokens()Un-marks all tokens previously marked to be removed. -
getBuiltinTokensToRemove
Returns current list of tokens marked to be removed.- Returns:
- Current list of tokens marked to be removed
-
modifyBuiltinToken
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) to sinus(x)). Procedure affects only tokens classified to built-in functions, built-in constants, built-in units, built-in random variables.- Parameters:
currentToken- Current token namenewToken- New token name
-
modifyBuiltinToken
public static void modifyBuiltinToken(String currentToken, String newToken, String newTokenDescription) 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) to sinus(x)). Procedure affects only tokens classified to built-in functions, built-in constants, built-in units, built-in random variables.- Parameters:
currentToken- Current token namenewToken- New token namenewTokenDescription- New token description (if null the previous one will be used)
-
unmodifyBuiltinTokens
Un-marks tokens previously marked to be modified.- Parameters:
currentOrNewTokens- List of tokens to be un-marked (current or modified).
-
unmodifyAllBuiltinTokens
public static void unmodifyAllBuiltinTokens()Un-marks all tokens previously marked to be modified. -
getBuiltinTokensToModify
Return details on tokens marked to be modified.- Returns:
- String[i][0] - current token, String[i][1] - new token, String[i][2] - new token description.
-
setToOverrideBuiltinTokens
public static void setToOverrideBuiltinTokens()Sets mXparser to override built-in tokens by user defined tokens. -
setNotToOverrideBuiltinTokens
public static void setNotToOverrideBuiltinTokens()Sets mXparser not to override built-in tokens by user defined tokens. -
checkIfsetToOverrideBuiltinTokens
public static boolean checkIfsetToOverrideBuiltinTokens()Checks whether mXparser is set to override built-in tokens.- Returns:
- True if mXparser is set to override built-in tokens by user defined tokens, otherwise false.
-
setDefaultOptions
public static void setDefaultOptions()Sets default mXparser options -
getTokenTypeDescription
Deprecated.Planned to be removed, useToken.getTokenTypeDescription(int)insteadReturns token type description.- Parameters:
tokenTypeId- Token type id- Returns:
- String representing token type description.
-
numberToHexString
Deprecated.Planned to be removed, useStringUtils.numberToHexString(int)insteadConverts integer number to hex string (plain text)- Parameters:
number- Integer number- Returns:
- Hex string (i.e. FF23)
-
numberToHexString
Deprecated.Planned to be removed, useStringUtils.numberToHexString(long)insteadConverts long number to hex string (plain text)- Parameters:
number- Long number- Returns:
- Hex string (i.e. FF23)
-
numberToHexString
Deprecated.Planned to be removed, useStringUtils.numberToHexString(double)insteadConverts (long)double number to hex string (plain text)- Parameters:
number- Double number- Returns:
- Hex string (i.e. FF23)
-
hexString2AsciiString
Deprecated.Planned to be removed, useStringUtils.hexString2AsciiString(String)insteadConverts hex string into ASCII string, where each letter is represented by two hex digits (byte) from the hex string.- Parameters:
hexString- Hex string (i.e. 48656C6C6F)- Returns:
- ASCII string (i.e. '48656C6C6F' = 'Hello')
-
numberToAsciiString
Deprecated.Planned to be removed, useStringUtils.numberToAsciiString(int)insteadConverts number into ASCII string, where each letter is represented by two hex digits (byte) from the hex representation of the original number- Parameters:
number- Integer number (i.e. 310939249775 = '48656C6C6F')- Returns:
- ASCII string (i.e. '48656C6C6F' = 'Hello')
-
numberToAsciiString
Deprecated.Planned to be removed, useStringUtils.numberToAsciiString(long)insteadConverts number into ASCII string, where each letter is represented by two hex digits (byte) from the hex representation of the original number- Parameters:
number- Long number (i.e. 310939249775 = '48656C6C6F')- Returns:
- ASCII string (i.e. '48656C6C6F' = 'Hello')
-
numberToAsciiString
Deprecated.Planned to be removed, useStringUtils.numberToAsciiString(double)insteadConverts (long)double number into ASCII string, where each letter is represented by two hex digits (byte) from the hex representation of the original number cast to long type.- Parameters:
number- Double number (i.e. 310939249775 = '48656C6C6F')- Returns:
- ASCII string (i.e. '48656C6C6F' = 'Hello')
-
convOthBase2Decimal
Other base (base between 1 and 36) number literal conversion to decimal number.- Parameters:
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:ZnumeralSystemBase- Numeral system base, between 1 and 36- Returns:
- Decimal number after conversion. If conversion was not possible the Double.NaN is returned.
-
convOthBase2Decimal
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.- Parameters:
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- Returns:
- Decimal number after conversion. If conversion was not possible the Double.NaN is returned.
-
convOthBase2Decimal
public static double convOthBase2Decimal(int numeralSystemBase, int... digits) Other base to decimal conversion.- Parameters:
numeralSystemBase- Numeral system base has to be above 0.digits- List of digits- Returns:
- Number after conversion. If conversion is not possible then Double.NaN is returned.
-
convOthBase2Decimal
public static double convOthBase2Decimal(double numeralSystemBase, double... digits) Other base to decimal conversion.- Parameters:
numeralSystemBase- Numeral system base has to be above 0.digits- List of digits- Returns:
- Number after conversion. If conversion is not possible then Double.NaN is returned.
-
convDecimal2OthBase
Decimal number to other numeral system conversion with base between 1 and 36.- Parameters:
decimalNumber- Decimal numbernumeralSystemBase- Numeral system base between 1 and 36- Returns:
- Number literal representing decimal number in given 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.
-
convDecimal2OthBase
Decimal number to other numeral system conversion with base between 1 and 36.- Parameters:
decimalNumber- Decimal numbernumeralSystemBase- Numeral system base between 1 and 36format- 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.- Returns:
- Number literal representing decimal number in given 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.
-
toFraction
public static double[] toFraction(double value) Converts double value to its fraction representation.- Parameters:
value- Value to be converted- Returns:
- 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.
-
toMixedFraction
public static double[] toMixedFraction(double value) Converts double value to its mixed fraction representation.- Parameters:
value- Value to be converted- Returns:
- 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.
-
fractionToString
Converts array representing fraction to fraction string representation.- Parameters:
fraction- Array representing fraction (including mix fractions)- Returns:
- String representation of fraction.
- See Also:
-
toFractionString
Converts number to its fraction string representation.- Parameters:
value- Given number- Returns:
- String representation of fraction.
- See Also:
-
toMixedFractionString
Converts number to its mixed fraction string representation.- Parameters:
value- Given number- Returns:
- String representation of fraction.
- See Also:
-
initConsoleOutput
private static void initConsoleOutput() -
consolePrintln
Prints object.toString to the Console + new line- Parameters:
o- Object to print
-
consolePrintln
Prints array of strings- Parameters:
stringArray- array of strinfs
-
consolePrintln
public static void consolePrintln()Prints new line to the Console, no new line -
consolePrint
Prints object.toString to the Console- Parameters:
o- Object to print
-
consolePrintSettings
-
consolePrintSettings
public static void consolePrintSettings() -
resetConsoleOutput
public static void resetConsoleOutput()Resets console output string, console output string is being built by consolePrintln(), consolePrint().- See Also:
-
setDefaultConsolePrefix
public static void setDefaultConsolePrefix()Sets default console prefix. -
setDefaultConsoleOutputPrefix
public static void setDefaultConsoleOutputPrefix()Sets default console output string prefix. -
setConsolePrefix
Sets console prefix.- Parameters:
consolePrefix- String containing console prefix definition.
-
setConsoleOutputPrefix
Sets console output string prefix.- Parameters:
consoleOutputPrefix- String containing console output prefix definition.
-
getConsoleOutput
Returns console output string, console output string is being built by consolePrintln(), consolePrint().- Returns:
- Console output string
- See Also:
-
getHelp
Returns detailed user help on the syntax of mathematical expressions.- Returns:
- One string value containing all the help.
-
getHelp
Returns detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.- Returns:
- One string value containing all the help.
-
getHelp
Returns detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
addHeader- Indicator whether to add a header.addCaption- Indicator whether to add caption.caption- If a non-standard caption is to be added, any string other than "" will replace the standard caption with the one specified by the user.- Returns:
- One string value containing all the help.
-
getHelp
Returns detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.addHeader- Indicator whether to add a header.addCaption- Indicator whether to add caption.caption- If a non-standard caption is to be added, any string other than ""- Returns:
- One string value containing all the help.
-
getHelpAsCsv
Returns (as CSV) detailed user help on the syntax of mathematical expressions.- Returns:
- One string value in CSV format containing all the help.
-
getHelpAsCsv
Returns (as CSV) detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.- Returns:
- One string value in CSV format containing all the help.
-
getHelpAsCsv
Returns (as CSV) detailed user help on the syntax of mathematical expressions.- Parameters:
quote- Text qualifier.delimiter- Delimiter.addHeader- Indicator whether to add a header.- Returns:
- One string value in CSV format containing all the help.
-
getHelpAsCsv
Returns (as CSV) detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.quote- Text qualifier.delimiter- Delimiter.addHeader- Indicator whether to add a header.- Returns:
- One string value in CSV format containing all the help.
-
getHelpAsHtmlTable
Returns (as HTML table) detailed user help on the syntax of mathematical expressions.- Returns:
- One string value containing all the help. String in HTML table format.
-
getHelpAsHtmlTable
Returns (as HTML table) detailed user help on the syntax of mathematical expressions.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.- Returns:
- One string value containing all the help. String in HTML table format.
-
getHelpAsHtmlTable
public static String getHelpAsHtmlTable(boolean addHeader, boolean addCaption, boolean addFigure, String caption, String cssClass) Returns (as HTML table) detailed user help on the syntax of mathematical expressions.- Parameters:
addHeader- Indicator whether to add a header.addCaption- Indicator whether to add caption.addFigure- Indicator whether to add a FIGURE tag.caption- If a non-standard caption is to be added, use any string other than "".cssClass- If CSS class is to be added, use any string other than "".- Returns:
- One string value containing all the help. String in HTML table format.
-
getHelpAsHtmlTable
public static String getHelpAsHtmlTable(String query, boolean addHeader, boolean addCaption, boolean addFigure, String caption, String cssClass) Returns (as HTML table) detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.addHeader- Indicator whether to add a header.addCaption- Indicator whether to add caption.addFigure- Indicator whether to add a FIGURE tag.caption- If a non-standard caption is to be added, use any string other than "".cssClass- If CSS class is to be added, use any string other than "".- Returns:
- One string value containing all the help. String in HTML table format.
-
getHelpAsMarkdownTable
Returns (as Markdown table) detailed user help on the syntax of mathematical expressions.- Returns:
- One string value containing all the help. String in Markdown table format.
-
getHelpAsMarkdownTable
Returns (as Markdown table) detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.- Returns:
- One string value containing all the help. String in Markdown table format.
-
getHelpAsMarkdownTable
Returns (as Markdown table) detailed user help on the syntax of mathematical expressions.- Parameters:
addHeader- Indicator whether to add a header.addCaption- Indicator whether to add caption.caption- If a non-standard caption is to be added, use any string other than "".- Returns:
- One string value containing all the help. String in Markdown table format.
-
getHelpAsMarkdownTable
public static String getHelpAsMarkdownTable(String query, boolean addHeader, boolean addCaption, String caption) Returns (as Markdown table) detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.addHeader- Indicator whether to add a header.addCaption- Indicator whether to add caption.caption- If a non-standard caption is to be added, use any string other than "".- Returns:
- One string value containing all the help. String in Markdown table format.
-
getHelpAsJson
Returns (as Json) detailed user help on the syntax of mathematical expressions.- Returns:
- One string value containing all the help. String in Json format.
-
getHelpAsJson
Returns (as Json) detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.- Returns:
- One string value containing all the help. String in Json format.
-
getHelpAsJson
Returns (as Json) detailed user help on the syntax of mathematical expressions.- Parameters:
addCaption- Indicator whether to add caption.caption- If a non-standard caption is to be added, use any string other than "".- Returns:
- One string value containing all the help. String in Json format.
-
getHelpAsJson
Returns (as Json) detailed user help on the syntax of mathematical expressions. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.addCaption- Indicator whether to add caption.caption- If a non-standard caption is to be added, use any string other than "".- Returns:
- One string value containing all the help. String in Json format.
-
consolePrintHelp
public static void consolePrintHelp()Prints all help content. -
consolePrintHelp
Prints filtered help content. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.
-
getKeyWords
-
getKeyWords
Returns list of keywords known to the parser. Allows simple and advanced searches.- Parameters:
query- For a simple search, simply enter a word (e.g.: "sine"). Advanced search is also possible, please use one of the tags below: "key=" - keyword (e.g.: "key=sin"), "desc=" - description (e.g.: "desc=trigonometric"), "syn=" - syntax (e.g.: "syn=sin"), "type=" - type (e.g.: "type=unit"), "since=" - since (e.g.: "since=4.1"), "typeid=" - please refer to parser tokens (e.g.: "typeid=3"), "keyid=" - please refer to parser tokens (e.g.: "keyid=1004"). Only one tag can be used per search.- Returns:
- List of keywords known to the parser filter against query string.
- See Also:
-
regexMatch
Deprecated.Planned to be removed, useStringUtils.regexMatch(String, String)insteadFunction used to introduce some compatibility between JAVA and C# while regexp matching.- Parameters:
str- Stringpattern- Pattern (regexp)- Returns:
- True if pattern matches entirely, False otherwise
-
consolePrintTokens
-
consolePrint
-
consolePrintln
-
consolePrintLicense
public static void consolePrintLicense()Prints to the console the terms of MathParser.org-mXparser DUAL LICENSE AGREEMENT -
getLicense
-
wait
public static void wait(int timeMillis) Waits given number of milliseconds- Parameters:
timeMillis- Number of milliseconds
-
cancelCurrentCalculation
public static void cancelCurrentCalculation()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. -
resetCancelCurrentCalculationFlag
public static void resetCancelCurrentCalculationFlag()Resets a flag giving signal to the engine to cancel current calculation.cancelCurrentCalculation() -
isCurrentCalculationCancelled
public static boolean isCurrentCalculationCancelled()Check whether a flag to cancel current calculation process is set.cancelCurrentCalculation()resetCancelCurrentCalculationFlag()- Returns:
- true in case cancel calculation flag is active, otherwise false
-
MathFunctions.getFunctionValue(Expression, Argument, double)instead