org.teatrove.tea.parsetree
Class CompareExpression

java.lang.Object
  extended by org.teatrove.tea.parsetree.Node
      extended by org.teatrove.tea.parsetree.Expression
          extended by org.teatrove.tea.parsetree.BinaryExpression
              extended by org.teatrove.tea.parsetree.CompareExpression
All Implemented Interfaces:
Serializable, Cloneable

public class CompareExpression
extends BinaryExpression

A CompareExpression is otherwise known as a spaceship operation or compare operation and contains a left expression and a right expression to which a comparison is done between the two returning -1 if less then, 0 if equal, or 1 if greater than.

Author:
Nick Hagan
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.teatrove.tea.parsetree.Expression
Expression.Conversion
 
Constructor Summary
CompareExpression(SourceInfo info, Token operator, Expression left, Expression right)
           
 
Method Summary
 Object accept(NodeVisitor visitor)
          Every subclass of Node must override this method with the following: return visitor.visit(this).
 boolean isExceptionPossible()
          Returns true if an exception can be thrown while executing this Expression.
 
Methods inherited from class org.teatrove.tea.parsetree.BinaryExpression
clone, getLeftExpression, getOperator, getRightExpression, setLeftExpression, setRightExpression, setType
 
Methods inherited from class org.teatrove.tea.parsetree.Expression
convertTo, convertTo, forceConversion, getConversionChain, getInitialType, getType, getValue, isValueKnown, setInitialType
 
Methods inherited from class org.teatrove.tea.parsetree.Node
getSourceInfo, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompareExpression

public CompareExpression(SourceInfo info,
                         Token operator,
                         Expression left,
                         Expression right)
Method Detail

isExceptionPossible

public boolean isExceptionPossible()
Description copied from class: Expression
Returns true if an exception can be thrown while executing this Expression. By default, returns true only if a type conversion could cause an exception.

Overrides:
isExceptionPossible in class BinaryExpression

accept

public Object accept(NodeVisitor visitor)
Description copied from class: Node
Every subclass of Node must override this method with the following: return visitor.visit(this).

Overrides:
accept in class Expression
Parameters:
visitor - A visitor of this Node
Returns:
Node The Node returned by the visitor
See Also:
NodeVisitor


Copyright © 1997-2012 TeaTrove.org. All Rights Reserved.