Class mXparser

    • Constructor Summary

      Constructors 
      Constructor Description
      mXparser()  
    • Method Summary

      Modifier and Type Method Description
      static double[] arrayList2double​(java.util.List<java.lang.Double> numbers)
      Converts List of double to double[]
      static void cancelCurrentCalculation()
      Method give a signal to other methods to cancel current calculation.
      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.
      static boolean checkIfCanonicalRounding()
      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 canonical rounding to minimize misleading results.
      static boolean checkIfDegreesMode()
      Checks whether mXparser operates in degrees mode for trigonometric functions.
      static boolean checkIfEpsilonMode()
      Checks if epsilon comparison mode is active;
      static boolean checkIfExactMode()
      Checks if exact comparison mode is active;
      static boolean checkIfRadiansMode()
      Checks whether mXparser operates in radians mode for trigonometric functions.
      static boolean checkIfsetToOverrideBuiltinTokens()
      Checks whether mXparser is set to override built-in tokens.
      static boolean checkIfUlpRounding()
      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.
      static void consolePrint​(java.lang.Object o)
      Prints object.toString to the Console
      static void consolePrintHelp()
      Prints all help content.
      static void consolePrintHelp​(java.lang.String word)
      Prints filtered help content.
      static void consolePrintln()
      Prints new line to the Console, no new line
      static void consolePrintln​(java.lang.Object o)
      Prints object.toString to the Console + new line
      static void consolePrintln​(java.lang.String[] stringArray)
      Prints array of strings
      static void consolePrintTokens​(java.util.List<Token> tokens)
      Prints tokens to the console.
      static java.lang.String convDecimal2OthBase​(double decimalNumber, int numeralSystemBase)
      Decimal number to other numeral system conversion with base between 1 and 36.
      static java.lang.String convDecimal2OthBase​(double decimalNumber, int numeralSystemBase, int format)
      Decimal number to other numeral system conversion with base between 1 and 36.
      static double convOthBase2Decimal​(double numeralSystemBase, double... digits)
      Other base to decimal conversion.
      static double convOthBase2Decimal​(int numeralSystemBase, int... digits)
      Other base to decimal conversion.
      static double convOthBase2Decimal​(java.lang.String numberLiteral)
      Other base (base between 1 and 36) number literal conversion to decimal number.
      static double convOthBase2Decimal​(java.lang.String numberLiteral, int numeralSystemBase)
      Other base (base between 1 and 36) number literal conversion to decimal number.
      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.
      static void disableCanonicalRounding()
      Disables canonical rounding.
      static void disableUlpRounding()
      Disables ULP rounding.
      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.
      static void enableCanonicalRounding()
      Enables canonical rounding.
      static void enableUlpRounding()
      Enables ULP rounding.
      static java.lang.String fractionToString​(double[] fraction)
      Converts array representing fraction to fraction string representation.
      static java.lang.String[][] getBuiltinTokensToModify()
      Return details on tokens marked to be modified.
      static java.lang.String[] getBuiltinTokensToRemove()
      Returns current list of tokens marked to be removed.
      static java.lang.String getConsoleOutput()
      Returns console output string, console output string is being built by consolePrintln(), consolePrint().
      static double getEpsilon()
      Returns current epsilon value.
      static double getFunctionValue​(Expression f, Argument x, double x0)
      Calculates function f(x0) (given as expression) assigning Argument x = x0;
      static double[] getFunctionValues​(Expression f, Argument index, double from, double to, double delta)
      Returns array of double values of the function f(i) calculated on the range: i = from to i = to by step = delta
      static java.lang.String getHelp()
      General mXparser expression help
      static java.lang.String getHelp​(java.lang.String word)
      General mXparser expression help - in-line key word searching
      static java.util.List<KeyWord> getKeyWords()
      Returns list of key words known to the parser
      static java.util.List<KeyWord> getKeyWords​(java.lang.String query)
      Returns list of key words known to the parser
      static java.lang.String getLicense()
      Gets license info
      static int getMaxAllowedRecursionDepth()
      Internal limit to avoid infinite loops while calculating expression defined in the way shown by below examples.
      static int getMaxNumInPrimesCache()
      Returns maximum integer number in primes cache
      static int getThreadsNumber()
      Gets maximum threads number
      static long getToFractionInitSearchSize()
      Gets initial search size used by the toFraction method
      static java.lang.String getTokenTypeDescription​(int tokenTypeId)
      Returns token type description.
      static java.lang.String hexString2AsciiString​(java.lang.String hexString)
      Converts hex string into ASCII string, where each letter is represented by two hex digits (byte) from the hex string.
      static void initPrimesCache()
      Initialization of prime numbers cache.
      static void initPrimesCache​(int mximumNumberInCache)
      Initialization of prime numbers cache.
      static void initPrimesCache​(PrimesCache primesCache)
      Initialization of prime numbers cache.
      static boolean isCurrentCalculationCancelled()
      Check whether a flag to cancel current calculation process is set.
      static boolean isInitPrimesCacheSuccessful()
      Returns true in case when primes cache initialization was successful, otherwise returns false.
      static void modifyBuiltinToken​(java.lang.String currentToken, java.lang.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. sin(x) to sinus(x)).
      static void modifyBuiltinToken​(java.lang.String currentToken, java.lang.String newToken, java.lang.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)).
      static java.lang.String numberToAsciiString​(double 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.
      static java.lang.String numberToAsciiString​(int number)
      Converts number into ASCII string, where each letter is represented by two hex digits (byte) from the hex representation of the original number
      static java.lang.String numberToAsciiString​(long number)
      Converts number into ASCII string, where each letter is represented by two hex digits (byte) from the hex representation of the original number
      static java.lang.String numberToHexString​(double number)
      Converts (long)double number to hex string (plain text)
      static java.lang.String numberToHexString​(int number)
      Converts integer number to hex string (plain text)
      static java.lang.String numberToHexString​(long number)
      Converts long number to hex string (plain text)
      static boolean regexMatch​(java.lang.String str, java.lang.String pattern)
      Function used to introduce some compatibility between JAVA and C# while regexp matching.
      static void removeBuiltinTokens​(java.lang.String... tokens)
      Removes built-in tokens form the list of tokens recognized by the parsers.
      static void resetCancelCurrentCalculationFlag()
      Resets a flag giving signal to the engine to cancel current calculation.
      static void resetConsoleOutput()
      Resets console output string, console output string is being built by consolePrintln(), consolePrint().
      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.
      static void setCanonicalRounding​(boolean canonicalRoundingState)
      Enables / disables canonical rounding.
      static void setConsoleOutputPrefix​(java.lang.String consoleOutputPrefix)
      Sets console output string prefix.
      static void setConsolePrefix​(java.lang.String consolePrefix)
      Sets console prefix.
      static void setDefaultConsoleOutputPrefix()
      Sets default console output string prefix.
      static void setDefaultConsolePrefix()
      Sets default console prefix.
      static void setDefaultEpsilon()
      Sets default epsilon value.
      static void setDefaultOptions()
      Sets default mXparser options
      static void setDefaultThreadsNumber()
      Sets default threads number
      static void setDegreesMode()
      Set mXparser to operate in degrees mode for trigonometric functions
      static void setEpsilon​(double epsilon)
      Sets epsilon value.
      static void setEpsilonComparison()
      Sets comparison mode to EPSILON.
      static void setExactComparison()
      Sets comparison mode to EXACT.
      static void setMaxAllowedRecursionDepth​(int maxAllowedRecursionDepth)
      Internal limit to avoid infinite loops while calculating expression defined in the way shown by below examples.
      static void setNoPrimesCache()
      Sets primesCache to null
      static void setNotToOverrideBuiltinTokens()
      Sets mXparser not to override built-in tokens by user defined tokens.
      static void setRadiansMode()
      Set mXparser to operate in radians mode for trigonometric functions
      static void setRandomGenerator​(java.util.Random randomGenerator)
      Modifies random generator used by the ProbabilityDistributions class.
      static void setThreadsNumber​(int threadsNumber)
      Sets threads number
      static void setToFractionInitSearchSize​(long n)
      Sets initial search size for the toFraction method
      static void setToOverrideBuiltinTokens()
      Sets mXparser to override built-in tokens by user defined tokens.
      static void setUlpRounding​(boolean ulpRoundingState)
      Enables / disables ULP rounding.
      static double[] toFraction​(double value)
      Converts double value to its fraction representation.
      static java.lang.String toFractionString​(double value)
      Converts number to its fraction string representation.
      static double[] toMixedFraction​(double value)
      Converts double value to its mixed fraction representation.
      static java.lang.String toMixedFractionString​(double value)
      Converts number to its mixed fraction string representation.
      static void unmodifyAllBuiltinTokens()
      Un-marks all tokens previously marked to be modified.
      static void unmodifyBuiltinTokens​(java.lang.String... currentOrNewTokens)
      Un-marks tokens previously marked to be modified.
      static void unremoveAllBuiltinTokens()
      Un-marks all tokens previously marked to be removed.
      static void unremoveBuiltinTokens​(java.lang.String... tokens)
      Un-marks tokens previously marked to be removed.
      static void wait​(int n)
      Waits given number of milliseconds
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • mXparser

        public mXparser()
    • Method Detail

      • initPrimesCache

        public static final void initPrimesCache​(int mximumNumberInCache)
        Initialization of prime numbers cache.
        Parameters:
        mximumNumberInCache - The maximum integer number that will be stored in cache.
        See Also:
        PrimesCache
      • initPrimesCache

        public static final void initPrimesCache​(PrimesCache primesCache)
        Initialization of prime numbers cache.
        Parameters:
        primesCache - The primes cache object
        See Also:
        PrimesCache
      • isInitPrimesCacheSuccessful

        public static final 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()
        Sets primesCache to null
      • getMaxNumInPrimesCache

        public static final 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 final int getThreadsNumber()
        Gets maximum threads number
        Returns:
        Threads number.
      • setDefaultThreadsNumber

        public static final void setDefaultThreadsNumber()
        Sets default threads number
      • setThreadsNumber

        public static final void setThreadsNumber​(int threadsNumber)
        Sets threads number
        Parameters:
        threadsNumber - Thread number.
      • getFunctionValue

        public static final double getFunctionValue​(Expression f,
                                                    Argument x,
                                                    double x0)
        Calculates function f(x0) (given as expression) assigning Argument x = x0;
        Parameters:
        f - the expression
        x - the argument
        x0 - the argument value
        Returns:
        f.calculate()
        See Also:
        Expression
      • arrayList2double

        public static final double[] arrayList2double​(java.util.List<java.lang.Double> numbers)
        Converts List of double to double[]
        Parameters:
        numbers - the numbers list
        Returns:
        numbers array
      • getFunctionValues

        public static final double[] getFunctionValues​(Expression f,
                                                       Argument index,
                                                       double from,
                                                       double to,
                                                       double delta)
        Returns array of double values of the function f(i) calculated on the range: i = from to i = to by step = delta
        Parameters:
        f - Function expression
        index - Index argument
        from - 'from' value
        to - 'to' value
        delta - 'delta' step definition
        Returns:
        Array of function values
      • setExactComparison

        public static final void setExactComparison()
        Sets comparison mode to EXACT.
        See Also:
        BinaryRelations
      • setEpsilonComparison

        public static final void setEpsilonComparison()
        Sets comparison mode to EPSILON.
        See Also:
        BinaryRelations
      • setEpsilon

        public static final void setEpsilon​(double epsilon)
        Sets epsilon value.
        Parameters:
        epsilon - Epsilon value (grater than 0).
        See Also:
        setEpsilonComparison(), BinaryRelations
      • enableUlpRounding

        public static final void enableUlpRounding()
        Enables ULP rounding. 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
      • disableUlpRounding

        public static final void disableUlpRounding()
        Disables ULP rounding. 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.
      • setUlpRounding

        public static final 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 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.
        Parameters:
        ulpRoundingState - True to enable, false to disable
      • checkIfUlpRounding

        public static final boolean checkIfUlpRounding()
        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
        Returns:
        True if ULP rounding is enabled, otherwise false.
      • enableCanonicalRounding

        public static final void enableCanonicalRounding()
        Enables canonical rounding. 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 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 final void disableCanonicalRounding()
        Disables canonical rounding. 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 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 final 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 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.
        Parameters:
        canonicalRoundingState - True to enable, false to disable
      • checkIfCanonicalRounding

        public static final boolean checkIfCanonicalRounding()
        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 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 final 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:
        setEpsilon(double), getEpsilon(), Expression.calculate()
      • disableAlmostIntRounding

        public static final 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:
        setEpsilon(double), getEpsilon(), Expression.calculate()
      • setAlmostIntRounding

        public static final 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 final 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:
        setEpsilon(double), getEpsilon(), Expression.calculate()
      • setMaxAllowedRecursionDepth

        public static final 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); Currently does not affect properly defined recursive mode.
        Parameters:
        maxAllowedRecursionDepth - Maximum number of allowed recursion calls
      • getMaxAllowedRecursionDepth

        public static final 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 final void setRadiansMode()
        Set mXparser to operate in radians mode for trigonometric functions
      • setDegreesMode

        public static final void setDegreesMode()
        Set mXparser to operate in degrees mode for trigonometric functions
      • checkIfRadiansMode

        public static final boolean checkIfRadiansMode()
        Checks whether mXparser operates in radians mode for trigonometric functions.
        Returns:
        true - if radians mode, false - otherwise
      • checkIfDegreesMode

        public static final boolean checkIfDegreesMode()
        Checks whether mXparser operates in degrees mode for trigonometric functions.
        Returns:
        true - if degrees mode, false - otherwise
      • setToFractionInitSearchSize

        public static final 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:
        NumberTheory.toFraction(double)
      • getToFractionInitSearchSize

        public static final long getToFractionInitSearchSize()
        Gets initial search size used by the toFraction method
        Returns:
        initial search size used by the toFraction method
        See Also:
        NumberTheory.toFraction(double)
      • removeBuiltinTokens

        public static final void removeBuiltinTokens​(java.lang.String... tokens)
        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

        public static final void unremoveBuiltinTokens​(java.lang.String... tokens)
        Un-marks tokens previously marked to be removed.
        Parameters:
        tokens - List of tokens to un-mark.
      • unremoveAllBuiltinTokens

        public static final void unremoveAllBuiltinTokens()
        Un-marks all tokens previously marked to be removed.
      • getBuiltinTokensToRemove

        public static final java.lang.String[] getBuiltinTokensToRemove()
        Returns current list of tokens marked to be removed.
        Returns:
        Current list of tokens marked to be removed
      • modifyBuiltinToken

        public static final void modifyBuiltinToken​(java.lang.String currentToken,
                                                    java.lang.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. 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 name
        newToken - New token name
      • modifyBuiltinToken

        public static final void modifyBuiltinToken​(java.lang.String currentToken,
                                                    java.lang.String newToken,
                                                    java.lang.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 name
        newToken - New token name
        newTokenDescription - New token description (if null the previous one will be used)
      • unmodifyBuiltinTokens

        public static final void unmodifyBuiltinTokens​(java.lang.String... currentOrNewTokens)
        Un-marks tokens previously marked to be modified.
        Parameters:
        currentOrNewTokens - List of tokens to be un-marked (current or modified).
      • unmodifyAllBuiltinTokens

        public static final void unmodifyAllBuiltinTokens()
        Un-marks all tokens previously marked to be modified.
      • getBuiltinTokensToModify

        public static final java.lang.String[][] 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 final void setToOverrideBuiltinTokens()
        Sets mXparser to override built-in tokens by user defined tokens.
      • setNotToOverrideBuiltinTokens

        public static final void setNotToOverrideBuiltinTokens()
        Sets mXparser not to override built-in tokens by user defined tokens.
      • checkIfsetToOverrideBuiltinTokens

        public static final 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 final void setDefaultOptions()
        Sets default mXparser options
      • getTokenTypeDescription

        public static final java.lang.String getTokenTypeDescription​(int tokenTypeId)
        Returns token type description.
        Parameters:
        tokenTypeId - Token type id
        Returns:
        String representing token type description.
      • numberToHexString

        public static final java.lang.String numberToHexString​(int number)
        Converts integer number to hex string (plain text)
        Parameters:
        number - Integer number
        Returns:
        Hex string (i.e. FF23)
      • numberToHexString

        public static final java.lang.String numberToHexString​(long number)
        Converts long number to hex string (plain text)
        Parameters:
        number - Long number
        Returns:
        Hex string (i.e. FF23)
      • numberToHexString

        public static final java.lang.String numberToHexString​(double number)
        Converts (long)double number to hex string (plain text)
        Parameters:
        number - Double number
        Returns:
        Hex string (i.e. FF23)
      • hexString2AsciiString

        public static final java.lang.String hexString2AsciiString​(java.lang.String hexString)
        Converts 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

        public static final java.lang.String numberToAsciiString​(int number)
        Converts 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

        public static final java.lang.String numberToAsciiString​(long number)
        Converts 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

        public static final java.lang.String numberToAsciiString​(double 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.
        Parameters:
        number - Double number (i.e. 310939249775 = '48656C6C6F')
        Returns:
        ASCII string (i.e. '48656C6C6F' = 'Hello')
      • convOthBase2Decimal

        public static final double convOthBase2Decimal​(java.lang.String numberLiteral,
                                                       int numeralSystemBase)
        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:Z
        numeralSystemBase - Numeral system base, between 1 and 36
        Returns:
        Decimal number after conversion. If conversion was not possible the Double.NaN is returned.
      • convOthBase2Decimal

        public static final double convOthBase2Decimal​(java.lang.String numberLiteral)
        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 final 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 final 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

        public static final java.lang.String convDecimal2OthBase​(double decimalNumber,
                                                                 int numeralSystemBase)
        Decimal number to other numeral system conversion with base between 1 and 36.
        Parameters:
        decimalNumber - Decimal number
        numeralSystemBase - Numeral system base between 1 and 36
        Returns:
        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.
      • convDecimal2OthBase

        public static final java.lang.String convDecimal2OthBase​(double decimalNumber,
                                                                 int numeralSystemBase,
                                                                 int format)
        Decimal number to other numeral system conversion with base between 1 and 36.
        Parameters:
        decimalNumber - Decimal number
        numeralSystemBase - Numeral system base between 1 and 36
        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.
        Returns:
        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.
      • toFraction

        public static final 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 final 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

        public static final java.lang.String fractionToString​(double[] fraction)
        Converts array representing fraction to fraction string representation.
        Parameters:
        fraction - Array representing fraction (including mix fractions)
        Returns:
        String representation of fraction.
        See Also:
        NumberTheory.toFraction(double), NumberTheory.toMixedFraction(double)
      • consolePrintln

        public static final void consolePrintln​(java.lang.Object o)
        Prints object.toString to the Console + new line
        Parameters:
        o - Object to print
      • consolePrintln

        public static final void consolePrintln​(java.lang.String[] stringArray)
        Prints array of strings
        Parameters:
        stringArray - array of strinfs
      • consolePrintln

        public static final void consolePrintln()
        Prints new line to the Console, no new line
      • consolePrint

        public static final void consolePrint​(java.lang.Object o)
        Prints object.toString to the Console
        Parameters:
        o - Object to print
      • setDefaultConsolePrefix

        public static void setDefaultConsolePrefix()
        Sets default console prefix.
      • setDefaultConsoleOutputPrefix

        public static void setDefaultConsoleOutputPrefix()
        Sets default console output string prefix.
      • setConsolePrefix

        public static void setConsolePrefix​(java.lang.String consolePrefix)
        Sets console prefix.
        Parameters:
        consolePrefix - String containing console prefix definition.
      • setConsoleOutputPrefix

        public static void setConsoleOutputPrefix​(java.lang.String consoleOutputPrefix)
        Sets console output string prefix.
        Parameters:
        consoleOutputPrefix - String containing console output prefix definition.
      • getHelp

        public static final java.lang.String getHelp()
        General mXparser expression help
        Returns:
        String with all general help content
      • getHelp

        public static final java.lang.String getHelp​(java.lang.String word)
        General mXparser expression help - in-line key word searching
        Parameters:
        word - Key word to be searched
        Returns:
        String with all help content lines containing given keyword
      • consolePrintHelp

        public static final void consolePrintHelp()
        Prints all help content.
      • consolePrintHelp

        public static final void consolePrintHelp​(java.lang.String word)
        Prints filtered help content.
        Parameters:
        word - Key word.
      • getKeyWords

        public static final java.util.List<KeyWord> getKeyWords()
        Returns list of key words known to the parser
        Returns:
        List of keywords known to the parser.
        See Also:
        KeyWord, KeyWord.wordTypeId, getHelp()
      • getKeyWords

        public static final java.util.List<KeyWord> getKeyWords​(java.lang.String query)
        Returns list of key words known to the parser
        Parameters:
        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.
        Returns:
        List of keywords known to the parser filter against query string.
        See Also:
        KeyWord, KeyWord.wordTypeId, getHelp(String)
      • regexMatch

        public static final boolean regexMatch​(java.lang.String str,
                                               java.lang.String pattern)
        Function used to introduce some compatibility between JAVA and C# while regexp matching.
        Parameters:
        str - String
        pattern - Pattern (regexp)
        Returns:
        True if pattern matches entirely, False otherwise
      • getLicense

        public static final java.lang.String getLicense()
        Gets license info
        Returns:
        license info as string
      • wait

        public static final void wait​(int n)
        Waits given number of milliseconds
        Parameters:
        n - Number of milliseconds
      • cancelCurrentCalculation

        public static final 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 final void resetCancelCurrentCalculationFlag()
        Resets a flag giving signal to the engine to cancel current calculation. cancelCurrentCalculation()