ISymbol
org.matheclipse.core.interfaces

Interface ISymbol

    • Field Detail

      • CONSOLE_OUTPUT

        static final int CONSOLE_OUTPUT
        ISymbol attribute to indicate that a symbols evaluation should be printed to Console with System.out.println();
        See Also:
        Constant Field Values
      • CONSTANT

        static final int CONSTANT
        ISymbol attribute to indicate that a symbol has a constant value
        See Also:
        Constant Field Values
      • FLAT

        static final int FLAT
        ISymbol attribute for an associative function transformation. The evaluation of the function will flatten the arguments list
        See Also:
        Constant Field Values
      • HOLDFIRST

        static final int HOLDFIRST
        ISymbol attribute for a function, where the first argument should not be evaluated
        See Also:
        Constant Field Values
      • HOLDREST

        static final int HOLDREST
        ISymbol attribute for a function, where only the first argument should be evaluated
        See Also:
        Constant Field Values
      • HOLDALL

        static final int HOLDALL
        ISymbol attribute for a function, where no argument should be evaluated
        See Also:
        Constant Field Values
      • LISTABLE

        static final int LISTABLE
        ISymbol attribute for a function with lists as arguments
        See Also:
        Constant Field Values
      • NHOLDFIRST

        static final int NHOLDFIRST
        ISymbol attribute for a function, where the first argument should not be evaluated numerically
        See Also:
        Constant Field Values
      • NHOLDREST

        static final int NHOLDREST
        ISymbol attribute for a function, where the rest of the arguments should not be evaluated numerically.
        See Also:
        Constant Field Values
      • NHOLDALL

        static final int NHOLDALL
        ISymbol attribute for a function, which should not be evaluated numerically
        See Also:
        Constant Field Values
      • NOATTRIBUTE

        static final int NOATTRIBUTE
        ISymbol attribute which means that no attribute is set.
        See Also:
        Constant Field Values
      • NUMERICFUNCTION

        static final int NUMERICFUNCTION
        ISymbol attribute for a numeric function
        See Also:
        Constant Field Values
      • PACKAGE_LOADED

        static final int PACKAGE_LOADED
        ISymbol flag for a symbol which has already loaded it's package definition
        See Also:
        Constant Field Values
      • ONEIDENTITY

        static final int ONEIDENTITY
        ISymbol attribute for a function transformation: f(x) ==> x
        See Also:
        Constant Field Values
      • ORDERLESS

        static final int ORDERLESS
        ISymbol attribute for a commutative function transformation. The evaluation of the function will sort the arguments.
        See Also:
        Constant Field Values
      • FLATORDERLESS

        static final int FLATORDERLESS
        ISymbol attribute combination (ISymbol.FLAT and ISymbol.ORDERLESS)
        See Also:
        Constant Field Values
      • DEFAULT_RULE_PRIORITY

        static final int DEFAULT_RULE_PRIORITY
        The default priority when associating a new rule to a symbol. Lower numbers have higher priorities
        See Also:
        Constant Field Values
    • Method Detail

      • getEvaluator

        IEvaluator getEvaluator()
        Get the current evaluator for this symbol
        Returns:
        the evaluator which is associated to this symbol or null if no evaluator is associated
      • setEvaluator

        void setEvaluator(IEvaluator module)
        Set the current evaluator which is associated to this symbol
      • isString

        boolean isString(String symbolName)
        Tests if this symbols name equals the given string
        Parameters:
        symbolName -
        Returns:
      • isSymbolName

        boolean isSymbolName(String name)
        Returns true, if this symbol has the given name. The comparison of the symbols name with the given name is done according to the Config.PARSER_USE_LOWERCASE_SYMBOLS setting.
      • mapConstantDouble

        IExpr mapConstantDouble(INumericFunction<IExpr> function)
        If this symbol has attribute ISymbol.CONSTANT and the symbol's evaluator is of instance INumericConstant, then apply the constants double value to the given function and return the result, otherwise return null.
        Parameters:
        function - applys the function to a double value, resulting in an object of type IExpr.
        Returns:
        the resulting expression from the function or null.
        See Also:
        Abs, Ceiling, Floor
      • getAttributes

        int getAttributes()
        Get the Attributes of this symbol (i.e. LISTABLE, FLAT, ORDERLESS,...)
        Returns:
        See Also:
        FLAT
      • setAttributes

        void setAttributes(int attributes)
        Set the Attributes of this symbol (i.e. LISTABLE, FLAT, ORDERLESS,...)
        Parameters:
        attributes - the Attributes of this symbol
      • pushLocalVariable

        void pushLocalVariable()
        Create a new variable placeholder on the symbols variable stack
      • pushLocalVariable

        void pushLocalVariable(IExpr localValue)
        Create a new variable placeholder on the symbols variable stack and set the local value
      • popLocalVariable

        void popLocalVariable()
        Delete the topmost placeholder from the local variable stack
      • hasLocalVariableStack

        boolean hasLocalVariableStack()
        Is a local variable stack created for this symbol ?
        Returns:
        true if this symbol has a local variable stack
      • get

        IExpr get()
        Get the topmost value from the local variable stack
        Returns:
        null if no local variable is defined
      • set

        void set(IExpr value)
        Set the value of the local variable on top of the local variable stack
      • putDownRule

        IPatternMatcher putDownRule(ISymbol symbol,                          boolean equalRule,                          IExpr leftHandSide,                          IExpr rightHandSide,                          boolean packageMode)
        Associate a new "down value" rule with default priority to this symbol.
        Parameters:
        equalRule - true if the leftHandSide could be matched with equality
        leftHandSide -
        rightHandSide -
        packageMode - TODO
        Returns:
        See Also:
        DEFAULT_RULE_PRIORITY
      • putDownRule

        IPatternMatcher putDownRule(ISymbol symbol,                          boolean equalRule,                          IExpr leftHandSide,                          IExpr rightHandSide,                          int priority,                          boolean packageMode)
        Associate a new rule with the given priority to this symbol.
        Rules with lower numbers have higher priorities.
        Parameters:
        equalRule - true if the leftHandSide could be matched with equality
        leftHandSide -
        rightHandSide -
        priority - the priority of the rule
        packageMode - TODO
        condition - additional condition for rules containing patterns
        moduleInitializer - if the right-hand-side is a module, this is the initializer part
        Returns:
        See Also:
        DEFAULT_RULE_PRIORITY
      • putUpRule

        IPatternMatcher putUpRule(ISymbol symbol,                        boolean equalRule,                        IAST leftHandSide,                        IExpr rightHandSide)
        Associate a new "up value" rule with default priority to this symbol.
        Parameters:
        equalRule - true if the leftHandSide could be matched with equality
        leftHandSide -
        rightHandSide -
        Returns:
        See Also:
        DEFAULT_RULE_PRIORITY
      • putUpRule

        IPatternMatcher putUpRule(ISymbol setSymbol,                        boolean equalRule,                        IAST leftHandSide,                        IExpr rightHandSide,                        int priority)
        Associate a new "up value" rule with the given priority to this symbol.
        Rules with lower numbers have higher priorities.
        Parameters:
        equalRule - true if the leftHandSide could be matched with equality
        leftHandSide -
        rightHandSide -
        condition - additional condition for rules containing patterns
        moduleInitializer - if the right-hand-side is a module, this is the initializer part
        priority - the priority of the rule
        Returns:
        See Also:
        DEFAULT_RULE_PRIORITY
      • evalDownRule

        IExpr evalDownRule(IEvaluationEngine engine,                 IExpr expression)
        Evaluate the given expression for the "down value" rules associated with this symbol
        Parameters:
        engine -
        expression -
        Returns:
      • evalUpRule

        IExpr evalUpRule(IEvaluationEngine engine,               IExpr expression)
        Evaluate the given expression for the "up value" rules associated with this symbol
        Parameters:
        engine -
        expression -
        Returns:
      • getDefaultValue

        IExpr getDefaultValue()
        Get the general default value for this symbol (i.e. 1 is the default value for Times, 0 is the default value for Plus). The general default value is used in pattern-matching for expressions like a_. * b_. + c_
        Returns:
        the default value or null if undefined.
      • getDefaultValue

        IExpr getDefaultValue(int position)
        Get the default value at the arguments position for this symbol (i.e. 1 is the default value for Power at position 2). The default value is used in pattern-matching for expressions like a ^ b_.
        Parameters:
        position - the position for the default value
        Returns:
        the default value or null if undefined.
      • setDefaultValue

        void setDefaultValue(IExpr expr)
        Set the general default value for this symbol (i.e. 1 is the default value for Times, 0 is the default value for Plus). The general default value is used in pattern-matching for expressions like a_. * b_. + c_
        Parameters:
        expr - the general default value
        See Also:
        getDefaultValue()
      • setDefaultValue

        void setDefaultValue(int position,                   IExpr expr)
        Set the default value at the arguments position for this symbol (i.e. 1 is the default value for Power at position 2). The default value is used in pattern-matching for expressions like a ^ b_.
        Parameters:
        position - the position for the default value
        expr - the default value for the given position
        See Also:
        getDefaultValue(int)
      • getAssignedValue

        IExpr getAssignedValue()
        Get the value which is assigned to the symbol or null, if no value is assigned.
        Returns:
        null, if no value is assigned.
      • reassignSymbolValue

        IExpr[] reassignSymbolValue(Function<IExpr,IExpr> function,                          ISymbol functionSymbol)
        Apply the function to the currently assigned value of the symbol and reassign the result value to the symbol.
        Parameters:
        function - the function which should be applied
        functionSymbol - TODO
        Returns:
        an array with the currently assigned value of the symbol and the new calculated value of the symbol or null if the reassignment isn't possible.
      • clear

        void clear(EvalEngine engine)
        Clear the associated rules for this symbol
      • clearAll

        void clearAll(EvalEngine engine)
        Clear all associated rules and attributes for this symbol
      • definition

        List<IAST> definition()
        Return a list of the rules associated to this symbol
        Returns:
      • definitionToString

        String definitionToString()                          throws IOException
        Return the rules associated to this symbol in String representation
        Returns:
        Throws:
        IOException

SCaVis 2.2 © jWork.ORG