Documentation of 'jv.thirdParty.expr.Parser' Java class
Parser ("JavaView Reference Manual")
"JavaView? v5.03.003"
jv.thirdParty.expr

Class Parser



  • public class Parser
    extends java.lang.Object
    Parses strings representing mathematical formulas with variables. The following operators, in descending order of precedence, are defined:
    • ^ (raise to a power such as 17^2 or sin(x)^2)
    • * /
    • Unary minus (-x)
    • + -
    Note: ^ associates right-to-left; other operators associate left-to-right.

    These functions are defined: abs, acos(==arccos), asin(==arcsin), atan(==arctan), acot(==arccot), ceil, floor, exp, log(==ln), round, sign, sqrt, sin, cos, tan, cot, sinh, cosh, tanh, coth, asinh(==arcsinh), acosh(==arccosh), atanh(==arctanh), acoth(==arccoth). Lowercase and uppercase writing is ignored.

    Each function requires one argument enclosed in parentheses. Whitespaces outside identifiers are ignored.

    The syntax-error messages aren't very informative, unfortunately. IWBNI it indicated where in the input string the parse failed, but that'd be kind of a pain since our scanner is a StreamTokenizer. A hook for that info should've been built into StreamTokenizer.

    Examples:

    • 42
    • 2-3
    • cos(x^2) + sin(x^2)
    • sqrt(y)^3
    Author:
    Darius Bacon
    Version:
    03.06.06 (kp) Alternative writings allowed such as log=ln, asin=arcsin.
    06.08.99 (kp) StringBufferInputStream replaced with StringReader according to Java1.1.
    07.07.99 (kp) New functions added: cot, acot, acosh, asinh, atanh, acoth, sign.
    31.01.99 (kp) New functions added: cosh, sinh, tanh, coth.
    00.00.96 (Darius Bacon) Original version.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Parser() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static Expr parse(java.lang.String input) 
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
"JavaView? v5.03.003"

"

The software JavaView? is copyright protected. All Rights Reserved.
"

Ads help maintain this website.