org.shiftone.bigcalc
Class Calculator
java.lang.Object
org.shiftone.bigcalc.Calculator
- All Implemented Interfaces:
- Functor
- public class Calculator
- extends java.lang.Object
- implements Functor
This is the main class that should be used to turn a string into
a functor. Once instanciated, this functor's behavior will be
based on the string's expression. Instances of this class are
thread safe, as should be all functors. It is most efficient if
functor instances like this one are reused rather than parsed over
and over again.
- Version:
- $Revision: 1.13 $
- Author:
- $Author: jeffdrost $
Constructor Summary |
Calculator(java.lang.String text)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Calculator
public Calculator(java.lang.String text)
throws java.lang.Exception
evaluate
public java.lang.Object evaluate(Context context)
throws java.lang.Exception
- Specified by:
evaluate
in interface Functor
- Throws:
java.lang.Exception
print
public void print(java.lang.StringBuffer sb,
Context context)
throws java.lang.Exception
- Specified by:
print
in interface Functor
- Throws:
java.lang.Exception
print
public java.lang.String print(Context context)
throws java.lang.Exception
- Throws:
java.lang.Exception
parse
public static Functor parse(java.lang.String text,
FunctorFactory functorFactory)
throws ParseException
- Throws:
ParseException
main
public static void main(java.lang.String[] args)
throws java.lang.Exception
- Throws:
java.lang.Exception
toString
public java.lang.String toString()