com.japisoft.formula
Class FormulaTreeBuilder

java.lang.Object
  extended bycom.japisoft.formula.FormulaTreeBuilder
All Implemented Interfaces:
FormulaParsingListener

public class FormulaTreeBuilder
extends java.lang.Object
implements FormulaParsingListener

Formula parsing builder.

This classes receives parsing events and build an inner tree once for evaluating expression quickly.

This system is very similar to the SAX even system. Thus you may change of parsing without changing the evaluation system or the contrary change the evaluation system without changing the parsing process

Version:
1.1
Author:
(c) 2002-2003 JAPISOFT / A.Brillant

Constructor Summary
FormulaTreeBuilder()
           
 
Method Summary
 void findBinaryOperator(int op)
           
 void findFunction(java.lang.String functionName)
           
 void findGroup()
           
 void findParam()
           
 void findTernaryOperator(int op)
           
 void findUnaryOperator(int op)
           
 void findValue(double value)
           
 void findValue(java.lang.String value)
           
 void findVariable(java.lang.String variableName)
           
 AbstractNode getRootNode()
           
 void reset()
          Reset the listener state for a new parsing
 void setCurrentPos(int pos)
          Reset the current parsed location
 void setNodeFactory(NodeFactory nf)
          Reset for factory for choosing formula node
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormulaTreeBuilder

public FormulaTreeBuilder()
Method Detail

reset

public void reset()
Reset the listener state for a new parsing


setNodeFactory

public void setNodeFactory(NodeFactory nf)
Reset for factory for choosing formula node


setCurrentPos

public void setCurrentPos(int pos)
Reset the current parsed location

Specified by:
setCurrentPos in interface FormulaParsingListener

findFunction

public void findFunction(java.lang.String functionName)
Specified by:
findFunction in interface FormulaParsingListener

findVariable

public void findVariable(java.lang.String variableName)
Specified by:
findVariable in interface FormulaParsingListener

findGroup

public void findGroup()
Specified by:
findGroup in interface FormulaParsingListener

findParam

public void findParam()
Specified by:
findParam in interface FormulaParsingListener

findUnaryOperator

public void findUnaryOperator(int op)
Specified by:
findUnaryOperator in interface FormulaParsingListener

findBinaryOperator

public void findBinaryOperator(int op)
Specified by:
findBinaryOperator in interface FormulaParsingListener

findTernaryOperator

public void findTernaryOperator(int op)
Specified by:
findTernaryOperator in interface FormulaParsingListener

findValue

public void findValue(double value)
Specified by:
findValue in interface FormulaParsingListener

findValue

public void findValue(java.lang.String value)
Specified by:
findValue in interface FormulaParsingListener

getRootNode

public AbstractNode getRootNode()
Returns:
the parsing root node