public static int compareFlags ( int left , int right ) { if ( left == right ) { return 0 ; } int leftSuccess = left & SUCCESS_OR_LAMBDA ; int rightSuccess = right & SUCCESS_OR_LAMBDA ; if ( leftSuccess != rightSuccess ) { if ( leftSuccess == 0 ) return 1 ; if ( rightSuccess == 0 ) return - 1 ; if ( leftSuccess < rightSuccess ) return - 1 ; return 1 ; } if ( ( left & SYNONYM ) != ( right & SYNONYM ) ) { if ( ( left & SYNONYM ) != 0 ) return 1 ; return - 1 ; } return 0 ; }
Simple comparison of two flags . If both indicate compatibility the one with the better compatibility level wins .