net.sf.jabb.util.exp
Class CompareExpression
java.lang.Object
net.sf.jabb.util.exp.BooleanExpression
net.sf.jabb.util.exp.CompareExpression
- All Implemented Interfaces:
- CompareOperation
- Direct Known Subclasses:
- NumberCompareExpression
public abstract class CompareExpression
- extends BooleanExpression
- implements CompareOperation
用于得到比较结果
- Author:
- Zhengmao HU (James)
leftOperand
protected Object leftOperand
rightOperand
protected Object rightOperand
operation
protected int operation
CompareExpression
public CompareExpression(Object leftOperand,
int operation,
Object rightOperand)
addOperand
public void addOperand(BooleanExpression operand)
- Description copied from class:
BooleanExpression
- 给表达式增加运算数
- Overrides:
addOperand in class BooleanExpression
addOperand
public void addOperand(BooleanExpression... operands)
- Description copied from class:
BooleanExpression
- 给表达式增加运算数
- Overrides:
addOperand in class BooleanExpression
evaluate
public boolean evaluate(Object context)
- Description copied from class:
BooleanExpression
- 获得表达式的结果。子类可以重载这个方法。
- Overrides:
evaluate in class BooleanExpression
- Returns:
- result
compare
protected abstract boolean compare(Object context)
- 子类应该实现这个方法,利用leftOperand, operation, rightOperand、以及context来
作具体的比较运算,返回确切的结果。
- Returns:
- the result
toString
public String toString()
- Description copied from class:
BooleanExpression
- 转成字符串表示。子类可以重载这个方法。
- Overrides:
toString in class BooleanExpression
Copyright © 2012. All Rights Reserved.