Class MathExpression.Token

java.lang.Object
com.github.gbenroscience.parser.MathExpression.Token
All Implemented Interfaces:
Savable, Serializable
Enclosing class:
MathExpression

public static final class MathExpression.Token extends Object implements Savable
Author:
GBENRO
See Also:
  • Field Details

    • CBRT_DEF

      public static final char CBRT_DEF
      See Also:
    • INVERSE_DEF

      public static final char INVERSE_DEF
      See Also:
    • NUMBER

      public static final int NUMBER
      See Also:
    • OPERATOR

      public static final int OPERATOR
      See Also:
    • FUNCTION

      public static final int FUNCTION
      See Also:
    • METHOD

      public static final int METHOD
      See Also:
    • LPAREN

      public static final int LPAREN
      See Also:
    • RPAREN

      public static final int RPAREN
      See Also:
    • COMMA

      public static final int COMMA
      See Also:
    • MATRIX

      public static final int MATRIX
      See Also:
    • VARIABLE

      public static final int VARIABLE
      See Also:
    • FUNCTION_HANDLE

      public static final int FUNCTION_HANDLE
      See Also:
    • FUNCTION_HANDLE_UNDEFINED

      public static final int FUNCTION_HANDLE_UNDEFINED
      See Also:
    • kind

      public int kind
    • value

      public double value
    • name

      public String name
    • frameIndex

      public int frameIndex
      The slot in the execution frame where this token's value lives. Used only when kind == NUMBER or VARIABLE and it represents a variable.
    • v

      public Variable v
    • m

      public Matrix m
    • id

      public int id
    • opChar

      public char opChar
    • precedence

      public int precedence
    • isRightAssoc

      public boolean isRightAssoc
    • isPostfix

      public boolean isPostfix
    • arity

      public int arity
    • assignToName

      public String assignToName
    • isAssignmentTarget

      public boolean isAssignmentTarget
  • Constructor Details

    • Token

      public Token(double value)
    • Token

      public Token(Variable v)
      Constructor for Variables
      Parameters:
      v - The scalar variable..e.g a=2
    • Token

      public Token(String fn, boolean defined)
      Constructor for Function Handles. Used to pass references of functions as arguments to higher-order functions. e.g., in f(x)=x^3*sin(x); diff(f,1,1), 'f' is the function handle. In certain contexts, a function handle is passed to a method but it has not being defined anywhere. This method after it runs will create the function from the passed undefined handle and automatically store it. A good example is the diff method.
      Parameters:
      fn - The name of the function being referenced.
    • Token

      public Token(Matrix m)
    • Token

      public Token(char opChar, int precedence, boolean isRightAssoc, boolean isPostfix)
    • Token

      public Token(int kind, String name, int arity, int id, ErrorLog log)
    • Token

      public Token(int kind)
    • Token

      public Token(int kind, String name, int arity, int id, String assignToName, ErrorLog log)
  • Method Details

    • clone

      public MathExpression.Token clone()
      Overrides:
      clone in class Object
    • getRawArgs

      public String[] getRawArgs()
    • isVariable

      public boolean isVariable()
    • getPrec

      public static int getPrec(char op)
    • getKind

      public static String getKind(int kind)
    • isRightAssociative

      public static boolean isRightAssociative(char op)
    • toJsonString

      public String toJsonString()
    • toString

      public String toString()
      Overrides:
      toString in class Object