Venice 0.751beta

nz.org.venice.parser.expression
Class LogicExpression

java.lang.Object
  extended bynz.org.venice.parser.expression.AbstractExpression
      extended bynz.org.venice.parser.expression.BinaryExpression
          extended bynz.org.venice.parser.expression.LogicExpression
All Implemented Interfaces:
java.lang.Cloneable, Expression
Direct Known Subclasses:
AndExpression, OrExpression

public abstract class LogicExpression
extends BinaryExpression

Abstract base class for the boolean expressions: and, or


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
LogicExpression(Expression left, Expression right)
          Create a new logic 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.
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.BinaryExpression
getChildCount
 
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
evaluate
 

Constructor Detail

LogicExpression

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

Method Detail

checkType

public int checkType()
              throws TypeMismatchException
Check the input arguments to the expression. They must both be Expression.BOOLEAN_TYPE.

Returns:
Expression.BOOLEAN_TYPE
Throws:
TypeMismatchException - if the expression has incorrect types

getType

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

Returns:
Expression.BOOLEAN_TYPE.

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 and, or etc it will return arg1 operator arg2. It will insert parentheses as needed.

Overrides:
toString in class BinaryExpression
Parameters:
operator - the binary operator
Returns:
the string representation

Venice 0.751beta