@ Override public ValueComparator compare ( Value d2 ) { if ( d2 == null ) { return ValueComparator . NOT_EQUAL_TO ; } switch ( d2 . getType ( ) ) { case NUMBERVALUE : NumberValue otherVal = ( NumberValue ) d2 ; int valComp = val . compareTo ( otherVal ) ; switch ( this . comp ) { case EQUAL_TO : return valComp > 0 ? ValueComparator . GREATER_THAN : ( valComp < 0 ? ValueComparator . LESS_THAN : ValueComparator . EQUAL_TO ) ; case LESS_THAN : return valComp <= 0 ? ValueComparator . LESS_THAN : ValueComparator . UNKNOWN ; default : return valComp >= 0 ? ValueComparator . GREATER_THAN : ValueComparator . UNKNOWN ; } case INEQUALITYNUMBERVALUE : InequalityNumberValue other = ( InequalityNumberValue ) d2 ; ValueComparator d2Comp = other . comp ; int valComp2 = this . val . compareTo ( other . val ) ; if ( this . comp == d2Comp ) { if ( this . comp == ValueComparator . EQUAL_TO ) { return valComp2 > 0 ? ValueComparator . GREATER_THAN : ( valComp2 < 0 ? ValueComparator . LESS_THAN : ValueComparator . EQUAL_TO ) ; } else { return ValueComparator . UNKNOWN ; } } else if ( this . comp == ValueComparator . GREATER_THAN && d2Comp == ValueComparator . LESS_THAN ) { if ( valComp2 >= 0 ) { return ValueComparator . GREATER_THAN ; } else { return ValueComparator . UNKNOWN ; } } else { if ( valComp2 <= 0 ) { return ValueComparator . LESS_THAN ; } else { return ValueComparator . UNKNOWN ; } } case VALUELIST : ValueList < ? > vl = ( ValueList < ? > ) d2 ; return vl . contains ( this ) ? ValueComparator . IN : ValueComparator . NOT_IN ; default : return ValueComparator . NOT_EQUAL_TO ; } }
Compares this value and another numerically or checks this value for membership in a value list .