cct.math
Class MathExpressionParser

java.lang.Object
  extended by cct.math.MathExpressionParser

public class MathExpressionParser
extends java.lang.Object


Field Summary
(package private)  boolean caseSensitive
           
(package private) static double DEGREES_TO_RADIANS
           
(package private)  java.lang.String Delimiters
           
(package private)  java.util.HashMap<java.lang.String,java.lang.Object> IDs
           
 
Constructor Summary
MathExpressionParser()
           
 
Method Summary
 void addLine(java.lang.String line)
           
(package private)  double evaluateExpression(java.util.ArrayList<cct.math.MathExpressionParser.Type> Tokens, java.util.ArrayList<TYPE> tokenTypes)
           
(package private)  double evaluateFunction(java.util.ArrayList<cct.math.MathExpressionParser.Type> Tokens, java.util.ArrayList<TYPE> tokenTypes)
          We assume, no functions inside
(package private)  cct.math.MathExpressionParser.Type getToken(java.util.ArrayList<cct.math.MathExpressionParser.Type> Tokens, int index)
           
 boolean hasSymbol(java.lang.String symbol)
           
static void main(java.lang.String[] args)
           
(package private)  void parseConstant(java.lang.String name, java.lang.String expression)
           
(package private)  void parseFunction(java.lang.String definition, java.lang.String expression)
           
 double resolveExpression(java.lang.String expression)
           
(package private)  void resolveTokens(java.lang.String expression, java.util.ArrayList<cct.math.MathExpressionParser.Type> Tokens, java.util.ArrayList<TYPE> tokenTypes)
           
 void setInDegrees(boolean in_degrees)
           
 void setInRadians(boolean in_radians)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEGREES_TO_RADIANS

static final double DEGREES_TO_RADIANS
See Also:
Constant Field Values

Delimiters

java.lang.String Delimiters

caseSensitive

boolean caseSensitive

IDs

java.util.HashMap<java.lang.String,java.lang.Object> IDs
Constructor Detail

MathExpressionParser

public MathExpressionParser()
Method Detail

hasSymbol

public boolean hasSymbol(java.lang.String symbol)

setInDegrees

public void setInDegrees(boolean in_degrees)

setInRadians

public void setInRadians(boolean in_radians)

addLine

public void addLine(java.lang.String line)
             throws java.lang.Exception
Throws:
java.lang.Exception

parseFunction

void parseFunction(java.lang.String definition,
                   java.lang.String expression)
             throws java.lang.Exception
Throws:
java.lang.Exception

parseConstant

void parseConstant(java.lang.String name,
                   java.lang.String expression)
             throws java.lang.Exception
Throws:
java.lang.Exception

resolveTokens

void resolveTokens(java.lang.String expression,
                   java.util.ArrayList<cct.math.MathExpressionParser.Type> Tokens,
                   java.util.ArrayList<TYPE> tokenTypes)
             throws java.lang.Exception
Throws:
java.lang.Exception

resolveExpression

public double resolveExpression(java.lang.String expression)
                         throws java.lang.Exception
Throws:
java.lang.Exception

evaluateFunction

double evaluateFunction(java.util.ArrayList<cct.math.MathExpressionParser.Type> Tokens,
                        java.util.ArrayList<TYPE> tokenTypes)
                  throws java.lang.Exception
We assume, no functions inside

Parameters:
Tokens - ArrayList
tokenTypes - ArrayList
Returns:
double
Throws:
java.lang.Exception

evaluateExpression

double evaluateExpression(java.util.ArrayList<cct.math.MathExpressionParser.Type> Tokens,
                          java.util.ArrayList<TYPE> tokenTypes)
                    throws java.lang.Exception
Throws:
java.lang.Exception

getToken

cct.math.MathExpressionParser.Type getToken(java.util.ArrayList<cct.math.MathExpressionParser.Type> Tokens,
                                            int index)
                                      throws java.lang.Exception
Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)