Venice 0.751beta

nz.org.venice.parser.expression
Class BinaryExpression

java.lang.Object
  extended bynz.org.venice.parser.expression.AbstractExpression
      extended bynz.org.venice.parser.expression.BinaryExpression
All Implemented Interfaces:
java.lang.Cloneable, Expression
Direct Known Subclasses:
ArithmeticExpression, ComparisionExpression, FunctionExpression, 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 nz.org.venice.parser.Expression
BOOLEAN_TYPE, FALSE, FLOAT_QUOTE_TYPE, FLOAT_TYPE, INTEGER_QUOTE_TYPE, INTEGER_SHORT_TYPE, INTEGER_TYPE, NUMERIC_TYPE, STRING_TYPE, TRUE, TRUE_LEVEL, UNDEFINED_TYPE
 
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 nz.org.venice.parser.expression.AbstractExpression
clone, equals, getChild, getId, getIndex, getNumberFormat, getParent, getParseMetadata, hashCode, isRoot, iterator, parseDouble, parseInt, printParents, setChild, setChildMutableVersion, setParent, setParseMetadata, simplify, simplifyMutableVersion, size, size, toString, validTree, valueOfDouble, valueOfInt
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface nz.org.venice.parser.Expression
checkType, evaluate, getType
 

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.751beta