@ Override public ValueComparator compare ( Value o ) { if ( o == null ) { return ValueComparator . NOT_EQUAL_TO ; } switch ( o . getType ( ) ) { case NUMBERVALUE : NumberValue other = ( NumberValue ) o ; int comp = compareTo ( other ) ; return comp > 0 ? ValueComparator . GREATER_THAN : ( comp < 0 ? ValueComparator . LESS_THAN : ValueComparator . EQUAL_TO ) ; case INEQUALITYNUMBERVALUE : InequalityNumberValue other2 = ( InequalityNumberValue ) o ; int comp2 = num . compareTo ( ( BigDecimal ) other2 . getNumber ( ) ) ; switch ( other2 . getComparator ( ) ) { case EQUAL_TO : return comp2 > 0 ? ValueComparator . GREATER_THAN : ( comp2 < 0 ? ValueComparator . LESS_THAN : ValueComparator . EQUAL_TO ) ; case GREATER_THAN : return comp2 <= 0 ? ValueComparator . LESS_THAN : ValueComparator . UNKNOWN ; default : return comp2 >= 0 ? ValueComparator . GREATER_THAN : ValueComparator . UNKNOWN ; } case VALUELIST : ValueList < ? > vl = ( ValueList < ? > ) o ; return equals ( vl ) ? ValueComparator . EQUAL_TO : ValueComparator . NOT_EQUAL_TO ; default : return ValueComparator . NOT_EQUAL_TO ; } }
Compares this value and another numerically or checks this number value for membership in a value list .