org.jmat.function.expressionParser
Class Evaluator.Node

java.lang.Object
  |
  +--org.jmat.function.expressionParser.Evaluator.Node
Enclosing class:
Evaluator

protected class Evaluator.Node
extends java.lang.Object


Field Summary
 Evaluator.Node nLeft
           
 int nLevel
           
 Evaluator.Operator nOperator
           
 Evaluator.Node nParent
           
 Evaluator.Node nRight
           
 java.lang.String nString
           
 java.lang.Object nValue
           
 
Constructor Summary
Evaluator.Node(Evaluator.Node parent, java.lang.String s, int level)
           
Evaluator.Node(java.lang.String s)
           
 
Method Summary
protected  void _D(java.lang.String s)
           
protected  java.lang.String addZero(java.lang.String s)
          returns a string that doesnt start with a + or a -
protected  int checkBrackets(java.lang.String s)
          checks if there is any missing brackets
protected  Evaluator.Node getLeft()
           
protected  int getLevel()
           
protected  Evaluator.Operator getOperator()
           
protected  Evaluator.Node getRight()
           
protected  java.lang.String getString()
           
protected  java.lang.Object getValue()
           
protected  boolean hasChild()
           
protected  boolean hasLeft()
           
protected  boolean hasOperator()
           
protected  boolean hasRight()
           
 java.lang.String removeBrackets(java.lang.String s)
          Removes spaces, tabs and brackets at the begining
 java.lang.String removeIllegalCharacters(java.lang.String s)
          Removes illegal characters
protected  void setValue(java.lang.Object f)
           
 void trace()
          displays the tree of the expression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nString

public java.lang.String nString

nOperator

public Evaluator.Operator nOperator

nLeft

public Evaluator.Node nLeft

nRight

public Evaluator.Node nRight

nParent

public Evaluator.Node nParent

nLevel

public int nLevel

nValue

public java.lang.Object nValue
Constructor Detail

Evaluator.Node

public Evaluator.Node(java.lang.String s)
               throws java.lang.Exception

Evaluator.Node

public Evaluator.Node(Evaluator.Node parent,
                      java.lang.String s,
                      int level)
               throws java.lang.Exception
Method Detail

checkBrackets

protected int checkBrackets(java.lang.String s)
checks if there is any missing brackets

Returns:
true if s is valid

addZero

protected java.lang.String addZero(java.lang.String s)
returns a string that doesnt start with a + or a -


trace

public void trace()
displays the tree of the expression


hasChild

protected boolean hasChild()

hasOperator

protected boolean hasOperator()

hasLeft

protected boolean hasLeft()

getLeft

protected Evaluator.Node getLeft()

hasRight

protected boolean hasRight()

getRight

protected Evaluator.Node getRight()

getOperator

protected Evaluator.Operator getOperator()

getLevel

protected int getLevel()

getValue

protected java.lang.Object getValue()

setValue

protected void setValue(java.lang.Object f)

getString

protected java.lang.String getString()

removeBrackets

public java.lang.String removeBrackets(java.lang.String s)
Removes spaces, tabs and brackets at the begining


removeIllegalCharacters

public java.lang.String removeIllegalCharacters(java.lang.String s)
Removes illegal characters


_D

protected void _D(java.lang.String s)