ru.biosoft.math.xml
Class MathMLParser

java.lang.Object
  extended byru.biosoft.math.model.AbstractParser
      extended byru.biosoft.math.xml.MathMLParser
All Implemented Interfaces:
Parser, ParserTreeConstants

public class MathMLParser
extends AbstractParser
implements ParserTreeConstants

We assume xmlinput has the following format: ...

Pendung:
high csymbol parsing

Nested Class Summary
protected static class MathMLParser.CSymbol
           
 
Field Summary
protected  java.util.Hashtable csymbolMap
           
protected  java.lang.String lambdaFunctionName
           
protected  java.util.Hashtable mathSignsMap
           
protected  org.w3c.dom.Document xmlDoc
           
 
Fields inherited from class ru.biosoft.math.model.AbstractParser
astStart, context, declareUndefinedVariables, messages, status, variableResolver
 
Fields inherited from interface ru.biosoft.math.parser.ParserTreeConstants
JJTCONSTANT, JJTFUNCTIONDECLARATION, JJTFUNNODE, jjtNodeName, JJTPIECE, JJTPIECEWISE, JJTSTART, JJTVARNODE, JJTVOID
 
Fields inherited from interface ru.biosoft.math.model.Parser
STATUS_ERROR, STATUS_FATAL_ERROR, STATUS_OK, STATUS_WARNING
 
Constructor Summary
MathMLParser()
           
 
Method Summary
protected  Node buildAstTree(org.w3c.dom.Node xmlRoot)
           
 void buildTree()
           
 void declareCSymbolAsFunction(Function function)
           
 void declareCSymbolAsVariable(java.lang.String name)
           
protected  void fillMathSignsMap()
           
protected  org.w3c.dom.Node getFirstChildElement(org.w3c.dom.Node domNode)
           
 int parse(org.w3c.dom.Element math)
           
 int parse(java.lang.String xmlString)
           
protected  AstFunNode processAPPLY(org.w3c.dom.Node domNodeRoot)
          -tag is like serialized function call.
protected  AstVarNode processBVAR(org.w3c.dom.Node domNode)
           
protected  AstVarNode processCI(org.w3c.dom.Node domNode)
          Atrribute "type" is ignored.
protected  AstConstant processCN(org.w3c.dom.Element cnElement)
          We assume that attribute "type" can only be "integer", "real" or "e-notation".
protected  Node processCSYMBOL(org.w3c.dom.Node domNode)
           
protected  Node processDEGREE(org.w3c.dom.Node domNode)
           
protected  AstConstant processEXP(org.w3c.dom.Node domNodeEXP)
           
protected  AstConstant processFALSE()
           
protected  AstFunNode processFunction(org.w3c.dom.Node domNode)
           
protected  AstFunctionDeclaration processLAMBDA(org.w3c.dom.Node domNodeRoot)
           
protected  Node processLOGBASE(org.w3c.dom.Node domNode)
           
protected  Node processMATH(org.w3c.dom.Node domNodeRoot)
           
protected  Node processNode(org.w3c.dom.Node domNode)
           
protected  AstConstant processPI(org.w3c.dom.Node domNodePI_EXP)
           
protected  AstPiece processPIECE(org.w3c.dom.Node domNodePiece)
           
protected  AstPiecewise processPIECEWISE(org.w3c.dom.Node domNodePW)
           
protected  AstConstant processTRUE()
           
 void setLambdaFunctionName(java.lang.String lambdaFunctionName)
           
 
Methods inherited from class ru.biosoft.math.model.AbstractParser
error, fatalError, getContext, getMessages, getStartNode, getVariableResolver, isDeclareUndefinedVariables, processConstant, processVariable, reinit, setContext, setDeclareUndefinedVariables, setOperator, setVariableResolver, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xmlDoc

protected org.w3c.dom.Document xmlDoc

mathSignsMap

protected java.util.Hashtable mathSignsMap

csymbolMap

protected java.util.Hashtable csymbolMap

lambdaFunctionName

protected java.lang.String lambdaFunctionName
Constructor Detail

MathMLParser

public MathMLParser()
Method Detail

fillMathSignsMap

protected void fillMathSignsMap()

declareCSymbolAsVariable

public void declareCSymbolAsVariable(java.lang.String name)

declareCSymbolAsFunction

public void declareCSymbolAsFunction(Function function)

parse

public int parse(java.lang.String xmlString)
Specified by:
parse in interface Parser

parse

public int parse(org.w3c.dom.Element math)

buildTree

public void buildTree()

buildAstTree

protected Node buildAstTree(org.w3c.dom.Node xmlRoot)

processMATH

protected Node processMATH(org.w3c.dom.Node domNodeRoot)

processNode

protected Node processNode(org.w3c.dom.Node domNode)

processAPPLY

protected AstFunNode processAPPLY(org.w3c.dom.Node domNodeRoot)
-tag is like serialized function call. The first child element of apply is function name (see mathSignsMap, also may be ). Then, various qualifier tags can be met. (we concern only , , ) Finally, arguments of the function can also be presented. (, , , ) p.s. is like on-the-fly declaration (not definition)


processCI

protected AstVarNode processCI(org.w3c.dom.Node domNode)
Atrribute "type" is ignored.


processPI

protected AstConstant processPI(org.w3c.dom.Node domNodePI_EXP)

processEXP

protected AstConstant processEXP(org.w3c.dom.Node domNodeEXP)

processTRUE

protected AstConstant processTRUE()

processFALSE

protected AstConstant processFALSE()

processPIECEWISE

protected AstPiecewise processPIECEWISE(org.w3c.dom.Node domNodePW)

processPIECE

protected AstPiece processPIECE(org.w3c.dom.Node domNodePiece)

processCN

protected AstConstant processCN(org.w3c.dom.Element cnElement)
We assume that attribute "type" can only be "integer", "real" or "e-notation". Attribute "base" is ignored.


processCSYMBOL

protected Node processCSYMBOL(org.w3c.dom.Node domNode)

processFunction

protected AstFunNode processFunction(org.w3c.dom.Node domNode)

setLambdaFunctionName

public void setLambdaFunctionName(java.lang.String lambdaFunctionName)

processLAMBDA

protected AstFunctionDeclaration processLAMBDA(org.w3c.dom.Node domNodeRoot)

processDEGREE

protected Node processDEGREE(org.w3c.dom.Node domNode)

processLOGBASE

protected Node processLOGBASE(org.w3c.dom.Node domNode)

processBVAR

protected AstVarNode processBVAR(org.w3c.dom.Node domNode)

getFirstChildElement

protected org.w3c.dom.Node getFirstChildElement(org.w3c.dom.Node domNode)


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