com.ssv.test.airbase.contest.expressions
Class ExpressionOperation

java.lang.Object
  extended by com.ssv.utils.tree.Tree<Leaf>
      extended by com.ssv.utils.tree.BinaryTree<Expression>
          extended by com.ssv.test.airbase.contest.Expression
              extended by com.ssv.test.airbase.contest.expressions.ExpressionOperation
All Implemented Interfaces:
com.ssv.utils.CompoundName<com.ssv.utils.tree.Tree<Expression>>, java.io.Serializable

public class ExpressionOperation
extends Expression

This node represent ariphmetical action, like +, - etc. This is non-leaf node and it always has both left and right branches non-null. Не всегда, правда, оба принимают участие в вычислении. Если встречается унарная операция, она кодируется как бинарная с левой ветвью содержащей фиктивное значение.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.ssv.utils.CompoundName
DOT, SLASH
 
Constructor Summary
ExpressionOperation(Parser.Token token, Expression left, Expression right, Parser.ParserContext ctx)
           
 
Method Summary
 double evaluate()
          Пересчитывает данный узел, и возвращает результат.
 java.lang.String toString()
           
 
Methods inherited from class com.ssv.test.airbase.contest.Expression
ctx
 
Methods inherited from class com.ssv.utils.tree.BinaryTree
getLeft, getNode, getRight, infix, infixInverted, main, print, setLeft, setRight, size
 
Methods inherited from class com.ssv.utils.tree.Tree
add, format, format, format, getLastToken, getParent, getPrefix, getToken, isTerminal, iterator, numTokens, postfix, postfix, prefix, prefix, printPostfix, printPrefix, remove, toArray
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExpressionOperation

public ExpressionOperation(Parser.Token token,
                           Expression left,
                           Expression right,
                           Parser.ParserContext ctx)
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

evaluate

public double evaluate()
                throws ParserException
Description copied from class: Expression
Пересчитывает данный узел, и возвращает результат.

Specified by:
evaluate in class Expression
Throws:
ParserException