org.mov.parser.expression
Class LogicExpression
java.lang.Object
org.mov.parser.expression.AbstractExpression
org.mov.parser.expression.BinaryExpression
org.mov.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
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 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 |
LogicExpression
public LogicExpression(Expression left,
Expression right)
- Create a new logic expression with the given left and
right arguments.
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