com.japisoft.formula
Class FormulaContext

java.lang.Object
  extended bycom.japisoft.formula.FormulaContext
All Implemented Interfaces:
FunctionResolver, NodeContext, SymbolResolver

public class FormulaContext
extends java.lang.Object
implements NodeContext, SymbolResolver, FunctionResolver

This context is for formula evaluation with access to the symbol table or to the function definition deleguate. User can uses it for maintaining state about previous variable evaluation result and reintroduces it in the next formula evaluation.

More information at : http://www.japisoft.com

Version:
1.0
Author:
(c) 2002-2003 JAPISOFT

Constructor Summary
FormulaContext(Formula f)
           
 
Method Summary
 FunctionResolver getFunctionResolver()
           
 OperatorFactory getOperatorFactory()
           
 SymbolResolver getSymbolResolver()
           
 Variant getValue(java.lang.String symbol)
          throw a SymbolResolverException if the symbol is unknown.
 Variant getValue(java.lang.String function, ListOfArgument args)
          throw a FunctionResolverException is the function is unknown or something is wrong with arguments
 boolean isHighPrecisionMode()
           
 void setValue(java.lang.String symbol, Variant v)
          Reset a new value .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormulaContext

public FormulaContext(Formula f)
Method Detail

getSymbolResolver

public SymbolResolver getSymbolResolver()
Specified by:
getSymbolResolver in interface NodeContext
Returns:
the resolver for variables

getFunctionResolver

public FunctionResolver getFunctionResolver()
Specified by:
getFunctionResolver in interface NodeContext
Returns:
the resolver for function

getValue

public Variant getValue(java.lang.String symbol)
Description copied from interface: SymbolResolver
throw a SymbolResolverException if the symbol is unknown.

Specified by:
getValue in interface SymbolResolver
Returns:
a value for the variable symbol

setValue

public void setValue(java.lang.String symbol,
                     Variant v)
Reset a new value . This is useful for expression like 'A=..'


getValue

public Variant getValue(java.lang.String function,
                        ListOfArgument args)
Description copied from interface: FunctionResolver
throw a FunctionResolverException is the function is unknown or something is wrong with arguments

Specified by:
getValue in interface FunctionResolver
Parameters:
args - List of arguments String or double

getOperatorFactory

public OperatorFactory getOperatorFactory()
Specified by:
getOperatorFactory in interface NodeContext
Returns:
a factory for the operator resolving

isHighPrecisionMode

public boolean isHighPrecisionMode()
Specified by:
isHighPrecisionMode in interface NodeContext
Returns:
true for high precision mode