|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectru.biosoft.math.model.SimpleNode
ru.biosoft.math.model.AstFunctionDeclaration
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 |
protected java.util.HashMap variablesMap
| Constructor Detail |
public AstFunctionDeclaration(int id)
| Method Detail |
public java.lang.String getName()
Function
getName in interface Functionpublic void setName(java.lang.String name)
public int getPriority()
Function
getPriority in interface Functionpublic int getNumberOfParameters()
Function
getNumberOfParameters in interface Functionpublic java.lang.String toString()
public void init(ParserContext parent)
public boolean containsConstant(java.lang.String name)
containsConstant in interface ParserContextpublic java.lang.Object getConstantValue(java.lang.String name)
ParserContext
getConstantValue in interface ParserContext
public void declareConstant(java.lang.String name,
java.lang.Object value)
ParserContext
declareConstant in interface ParserContextpublic boolean containsVariable(java.lang.String name)
containsVariable in interface ParserContextpublic java.lang.Object getVariableValue(java.lang.String name)
ParserContext
getVariableValue in interface ParserContext
public void declareVariable(java.lang.String name,
java.lang.Object value)
ParserContext
declareVariable in interface ParserContextpublic Function getFunction(java.lang.String name)
ParserContext
getFunction in interface ParserContextpublic void declareFunction(Function function)
ParserContext
declareFunction in interface ParserContext
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||