net.sf.jabb.util.exp
Class NumberCompareExpression

java.lang.Object
  extended by net.sf.jabb.util.exp.BooleanExpression
      extended by net.sf.jabb.util.exp.CompareExpression
          extended by net.sf.jabb.util.exp.NumberCompareExpression
All Implemented Interfaces:
CompareOperation

public class NumberCompareExpression
extends CompareExpression

对数字(Number的子类,包括AtomicLong, AtomicInteger, Long, Integer, Double等)进行比较。 比较常见的用法是其中一个操作数用AtomicLong或AtomicInteger,另一个用Long或Integer。

Compares Numbers(including AtomicLong, AtomicInteger, Long, Integer, Double, etc) Typical usage is to use AtomicLong or AtomicInteger as one operand and use Long or Integer as another.

Author:
Zhengmao HU (James)

Field Summary
 
Fields inherited from class net.sf.jabb.util.exp.CompareExpression
leftOperand, operation, rightOperand
 
Fields inherited from class net.sf.jabb.util.exp.BooleanExpression
children, FALSE, OPERAND, OPERATOR_AND, OPERATOR_NOT, OPERATOR_OR, operatorType, TRUE
 
Fields inherited from interface net.sf.jabb.util.exp.CompareOperation
EQ, GE, GT, LE, LT, NE
 
Constructor Summary
NumberCompareExpression(Number leftOperand, int operation, Number rightOperand)
          直接把待比较的数字带进去。真正的比较会发生在evaluate的时候。 调用evaluate()方法的时候传递的context参数不会被用到。
 
Method Summary
protected  boolean compare(Object context)
          子类应该实现这个方法,利用leftOperand, operation, rightOperand、以及context来 作具体的比较运算,返回确切的结果。
 
Methods inherited from class net.sf.jabb.util.exp.CompareExpression
addOperand, addOperand, evaluate, toString
 
Methods inherited from class net.sf.jabb.util.exp.BooleanExpression
addOperand, AND, AND, evaluate, HAS, NOT, OR, OR
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NumberCompareExpression

public NumberCompareExpression(Number leftOperand,
                               int operation,
                               Number rightOperand)
直接把待比较的数字带进去。真正的比较会发生在evaluate的时候。 调用evaluate()方法的时候传递的context参数不会被用到。

Parameters:
leftOperand -
operation -
rightOperand -
Method Detail

compare

protected boolean compare(Object context)
Description copied from class: CompareExpression
子类应该实现这个方法,利用leftOperand, operation, rightOperand、以及context来 作具体的比较运算,返回确切的结果。

Specified by:
compare in class CompareExpression
Parameters:
context - this argument is useless, you can pass null directly
Returns:
the result
See Also:
CompareExpression.compare(java.lang.Object)


Copyright © 2012. All Rights Reserved.