static boolean compareNotNull(Database database,Value l,Value r,int compareType){
  boolean result;
switch (compareType) {
case EQUAL:
case EQUAL_NULL_SAFE:
    result=database.areEqual(l,r);
  break;
case NOT_EQUAL:
case NOT_EQUAL_NULL_SAFE:
result=!database.areEqual(l,r);
break;
case BIGGER_EQUAL:
result=database.compare(l,r) >= 0;
break;
case BIGGER:
result=database.compare(l,r) > 0;
break;
case SMALLER_EQUAL:
result=database.compare(l,r) <= 0;
break;
case SMALLER:
result=database.compare(l,r) < 0;
break;
case SPATIAL_INTERSECTS:
{
ValueGeometry lg=(ValueGeometry)l.convertTo(Value.GEOMETRY);
ValueGeometry rg=(ValueGeometry)r.convertTo(Value.GEOMETRY);
result=lg.intersectsBoundingBox(rg);
break;
}
default :
throw DbException.throwInternalError("type=" + compareType);
}
return result;
}

static boolean compareNotNull ( Database database , Value l , Value r , int compareType ) { boolean result ; switch ( compareType ) { case EQUAL : case EQUAL_NULL_SAFE : result = database . areEqual ( l , r ) ; break ; case NOT_EQUAL : case NOT_EQUAL_NULL_SAFE : result = ! database . areEqual ( l , r ) ; break ; case BIGGER_EQUAL : result = database . compare ( l , r ) >= 0 ; break ; case BIGGER : result = database . compare ( l , r ) > 0 ; break ; case SMALLER_EQUAL : result = database . compare ( l , r ) <= 0 ; break ; case SMALLER : result = database . compare ( l , r ) < 0 ; break ; case SPATIAL_INTERSECTS : { ValueGeometry lg = ( ValueGeometry ) l . convertTo ( Value . GEOMETRY ) ; ValueGeometry rg = ( ValueGeometry ) r . convertTo ( Value . GEOMETRY ) ; result = lg . intersectsBoundingBox ( rg ) ; break ; } default : throw DbException . throwInternalError ( "type=" + compareType ) ; } return result ; }
compare two values , given the values are not null .
