Venice 0.7beta

org.mov.parser.expression
Class ComparisionExpression

java.lang.Object
  extended by org.mov.parser.expression.AbstractExpression
      extended by org.mov.parser.expression.BinaryExpression
          extended by org.mov.parser.expression.ComparisionExpression
All Implemented Interfaces:
java.lang.Cloneable, Expression
Direct Known Subclasses:
EqualThanExpression, GreaterThanEqualExpression, GreaterThanExpression, LessThanEqualExpression, LessThanExpression, NotEqualExpression

public abstract class ComparisionExpression
extends BinaryExpression

Abstract base class for the comparision expressions: >, <, ==, !=, <=, >=


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
ComparisionExpression(Expression left, Expression right)
          Create a new comparision expression with the given left and right arguments.
 
Method Summary
 int checkType()
          Check the input arguments to the expression.
 int getType()
          Get the type of the expression.
 Expression simplify()
          Perform simplifications and optimisations on the expression tree.
 
Methods inherited from class org.mov.parser.expression.BinaryExpression
getChildCount, toString
 
Methods inherited from class org.mov.parser.expression.AbstractExpression
clone, equals, getChild, getIndex, getNumberFormat, getParent, hashCode, isRoot, iterator, parseDouble, parseInt, setChild, setParent, 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
evaluate, toString
 

Constructor Detail

ComparisionExpression

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

Method Detail

checkType

public int checkType()
              throws TypeMismatchException
Check the input arguments to the expression. They can only be Expression.INTEGER_TYPE or Expression.FLOAT_TYPE. Both must be the same!

Returns:
the type of the expression
Throws:
TypeMismatchException - if the expression has incorrect types

simplify

public Expression simplify()
Description copied from class: AbstractExpression
Perform simplifications and optimisations on the expression tree. For example, if the expression tree was a and true then the expression tree would be simplified to a.

Specified by:
simplify in interface Expression
Overrides:
simplify in class AbstractExpression

getType

public int getType()
Get the type of the expression.

Returns:
Expression.BOOLEAN_TYPE.

Venice 0.7beta