Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ru.biosoft.math.model
Class AstFunctionDeclaration

    java.lang.Object
      ru.biosoft.math.model.SimpleNode
          ru.biosoft.math.model.AstFunctionDeclaration

All Implemented Interfaces:
  Function, Node, ParserContext

public class AstFunctionDeclaration
extends SimpleNode
implements ParserContext, Function

Function declaration, it corresponds lambda element in MathML. Function declaration syntax is following:

     FunctionDeclaration ::= ( "function" Identifier "(" ArgumentDeclaration ( "," ArgumentDeclaration )* ")"  Expression )

Example:

     function f(x, y) = sin(x) + cos(y);

Parser contex issues: Linear parser checks whether the function uses declared variables, for this purpose it uses its own parser context.

Field Summary
`protected java.util.HashMap` | `variablesMap`

Fields inherited from class ru.biosoft.math.model.SimpleNode
`children, id`

Fields inherited from interface ru.biosoft.math.model.Function
`ASSIGNMENT_PRIORITY, FUNCTION_PRIORITY, LOGICAL_PRIORITY, PLUS_PRIORITY, POWER_PRIORITY, RELATIONAL_PRIORITY, TIMES_PRIORITY, UNARY_PRIORITY`

Constructor Summary
`AstFunctionDeclaration(int id)`

Method Summary
`boolean` | `containsConstant(java.lang.String name)`
`boolean` | `containsVariable(java.lang.String name)`
`void` | `declareConstant(java.lang.String name, java.lang.Object value)` Declares the constant.
`void` | `declareFunction(Function function)` Declares the function.
`void` | `declareVariable(java.lang.String name, java.lang.Object value)` Declares the variable.
`java.lang.Object` | `getConstantValue(java.lang.String name)` Returns the constant value or null if constant not declared.
`Function` | `getFunction(java.lang.String name)` Returns function or operator with the specified name or null if function is not declared.
`java.lang.String` | `getName()` Returns the name of the node (operator symbol or function name).
`int` | `getNumberOfParameters()` Returns the number of required parameters, or -1 if any number of parameters is allowed.
`int` | `getPriority()` Returns the function or operator priority.
`java.lang.Object` | `getVariableValue(java.lang.String name)` Returns value of variable with the specified name or null if variable is not declared.
`void` | `init(ParserContext parent)`
`void` | `setName(java.lang.String name)`
`java.lang.String` | `toString()`

Methods inherited from class ru.biosoft.math.model.SimpleNode
`dump, dump, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtReplaceChild, jjtSetParent, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### variablesMap

    protected java.util.HashMap variablesMap

Constructor Detail

### AstFunctionDeclaration

    public AstFunctionDeclaration(int id)

Method Detail

### getName

    public java.lang.String getName()

  Description copied from interface: `Function`
  Returns the name of the node (operator symbol or function name).

  Specified by:
    `getName` in interface `Function`

### setName

    public void setName(java.lang.String name)

### getPriority

    public int getPriority()

  Description copied from interface: `Function`
  Returns the function or operator priority.

  Specified by:
    `getPriority` in interface `Function`

### getNumberOfParameters

    public int getNumberOfParameters()

  Description copied from interface: `Function`
  Returns the number of required parameters, or -1 if any number of parameters is allowed.

  Specified by:
    `getNumberOfParameters` in interface `Function`

### toString

    public java.lang.String toString()

### init

    public void init(ParserContext parent)

### containsConstant

    public boolean containsConstant(java.lang.String name)

  Specified by:
    `containsConstant` in interface `ParserContext`

### getConstantValue

    public java.lang.Object getConstantValue(java.lang.String name)

  Description copied from interface: `ParserContext`
  Returns the constant value or null if constant not declared.

  Specified by:
    `getConstantValue` in interface `ParserContext`

### declareConstant

    public void declareConstant(java.lang.String name,
                                java.lang.Object value)

  Description copied from interface: `ParserContext`
  Declares the constant.

  Specified by:
    `declareConstant` in interface `ParserContext`

### containsVariable

    public boolean containsVariable(java.lang.String name)

  Specified by:
    `containsVariable` in interface `ParserContext`

### getVariableValue

    public java.lang.Object getVariableValue(java.lang.String name)

  Description copied from interface: `ParserContext`
  Returns value of variable with the specified name or null if variable is not declared.

  Specified by:
    `getVariableValue` in interface `ParserContext`

### declareVariable

    public void declareVariable(java.lang.String name,
                                java.lang.Object value)

  Description copied from interface: `ParserContext`
  Declares the variable.

  Specified by:
    `declareVariable` in interface `ParserContext`

### getFunction

    public Function getFunction(java.lang.String name)

  Description copied from interface: `ParserContext`
  Returns function or operator with the specified name or null if function is not declared.

  Specified by:
    `getFunction` in interface `ParserContext`

### declareFunction

    public void declareFunction(Function function)

  Description copied from interface: `ParserContext`
  Declares the function.

  Specified by:
    `declareFunction` in interface `ParserContext`

Overview | Package | Class | Use | Tree | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2003 Biosof.Ru. All Rights Reserved.