The expression: (([Applicant].[PreferenceMask] & 1) != 0) should be formulated as:
Field != 0, and you apply the expression Field & 1 to the field. So, you'll do:
EntityField2 field = EntityFieldFactory.Create(ApplicantFieldIndex.PreferenceMask);
field.ExpressionToApply = new Expression(EntityFieldFactory.Create(ApplicantFieldIndex.PreferenceMask), ExOp.BitwiseAnd, 1);
FieldCompareValuePredicate firstFilter = new FieldCompareValuePredicate(field, null, ComparisonOperator.NotEqual, 0);
Then:
(([Applicant].[LocationMask] & 8 ) != 0) should be formulated as:
EntityField2 field2 = EntityFieldFactory.Create(ApplicantFieldIndex.LocationMask);
field2.ExpressionToApply = new Expression(EntityFieldFactory.Create(ApplicantFieldIndex.LocationMask), ExOp.BitwiseAnd, 8);
FieldCompareValuePredicate secondFilter = new FieldCompareValuePredicate(field2, null, ComparisonOperator.NotEqual, 0);
Then: ([Applicant].[PreferenceMask] & 1) = 0) should be formulated as: (re-using expression field)
FieldCompareValuePredicate thirdFilter = new FieldCompareValuePredicate(field, null, ComparisonOperator.Equal, 0);
Then, build the predicate expressions. First:
(([Applicant].[PreferenceMask] & 1) != 0) AND (([Applicant].[LocationMask] & 8 ) != 0)
PredicateExpression andPredicate = new PredicateExpression(firstFilter, PredicateExpressionOperator.And, secondFilter);
As the Or predicate is already done, we can add it to the complete filter:
PredicateExpression completePredicate = new PredicateExpression(andPredicate, PredicateExpressionOperator.Or, thirdFilter);
so, in full, it looks like:
EntityField2 field = EntityFieldFactory.Create(ApplicantFieldIndex.PreferenceMask);
field.ExpressionToApply = new Expression(EntityFieldFactory.Create(ApplicantFieldIndex.PreferenceMask), ExOp.BitwiseAnd, 1);
FieldCompareValuePredicate firstFilter = new FieldCompareValuePredicate(field, null, ComparisonOperator.NotEqual, 0);
EntityField2 field2 = EntityFieldFactory.Create(ApplicantFieldIndex.LocationMask);
field2.ExpressionToApply = new Expression(EntityFieldFactory.Create(ApplicantFieldIndex.LocationMask), ExOp.BitwiseAnd, 8);
FieldCompareValuePredicate secondFilter = new FieldCompareValuePredicate(field2, null, ComparisonOperator.NotEqual, 0);
FieldCompareValuePredicate thirdFilter = new FieldCompareValuePredicate(field, null, ComparisonOperator.Equal, 0);
PredicateExpression andPredicate = new PredicateExpression(firstFilter, PredicateExpressionOperator.And, secondFilter);
PredicateExpression completePredicate = new PredicateExpression(andPredicate, PredicateExpressionOperator.Or, thirdFilter);