Venice 0.7beta

org.mov.parser.expression
Class BinaryExpression

java.lang.Object
  extended by org.mov.parser.expression.AbstractExpression
      extended by org.mov.parser.expression.BinaryExpression
All Implemented Interfaces:
java.lang.Cloneable, Expression
Direct Known Subclasses:
ArithmeticExpression, ComparisionExpression, LagExpression, LogicExpression, MACDExpression, PercentExpression, RSIExpression, WhileExpression

public abstract class BinaryExpression
extends AbstractExpression

Abstract base class for all expressions requiring two arguments.


Field Summary
 
Fields inherited from interface org.mov.parser.Expression
BOOLEAN_TYPE, FALSE, FLOAT_QUOTE_TYPE, FLOAT_TYPE, INTEGER_QUOTE_TYPE, INTEGER_TYPE, STRING_TYPE, TRUE, TRUE_LEVEL
 
Constructor Summary
BinaryExpression(Expression left, Expression right)
          Create a new binary expression with the given left and right arguments.
 
Method Summary
 int getChildCount()
          Return the number of children required in a binary expression.
protected  java.lang.String toString(java.lang.String operator)
          Helper method to conver the given expression to a string.
 
Methods inherited from class org.mov.parser.expression.AbstractExpression
clone, equals, getChild, getIndex, getNumberFormat, getParent, hashCode, isRoot, iterator, parseDouble, parseInt, setChild, setParent, simplify, size, size, valueOfDouble, valueOfInt
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mov.parser.Expression
checkType, evaluate, getType, toString
 

Constructor Detail

BinaryExpression

public BinaryExpression(Expression left,
                        Expression right)
Create a new binary expression with the given left and right arguments.

Parameters:
left - the left argument
right - the right argument
Method Detail

getChildCount

public int getChildCount()
Return the number of children required in a binary expression. This will always evaluate to 2.

Returns:
2

toString

protected java.lang.String toString(java.lang.String operator)
Helper method to conver the given expression to a string. Given an operator such as +, - etc it will return arg1 operator arg2. It will insert parentheses as needed.

Parameters:
operator - the binary operator
Returns:
the string representation

Venice 0.7beta