Combine one other search filters with this one, using the specific operator.

@param new_filter is the SearchFilter class to be combined
@param op is the logical operator to be used to combine the filters
@exception DBException
972024
public void combine(SearchFilter new_filter, int op) throws DBException
    {

        // cast down to OJBSearchFilter
        OJBSearchFilter ojbFilter = (OJBSearchFilter) new_filter;

        switch (op)
        {

            case OR:
                {
                    criteria.addOrCriteria(ojbFilter.getCriteria());
                    break;
                }

            case AND:
                {
                    criteria.addAndCriteria(ojbFilter.getCriteria());
                    break;
                }

            default:
                {
                    throw new DBException();
                }
        }
    }
479892
private void validateFilter(Filter filter) throws IllegalArgumentException {
    switch (filter.getFilterTypeCase()) {
      case COMPOSITE_FILTER:
        for (Filter subFilter : filter.getCompositeFilter().getFiltersList()) {
          validateFilter(subFilter);
        }
        break;
      case PROPERTY_FILTER:
        if (UNSUPPORTED_OPERATORS.contains(filter.getPropertyFilter().getOp())) {
          throw new IllegalArgumentException("Query cannot have any inequality filters.");
        }
        break;
      default:
        throw new IllegalArgumentException(
            "Unsupported filter type: " + filter.getFilterTypeCase());
    }
  }
409215
@Override
    public void _search(String fieldName, String searchTerms, SearchOperator operator) {
        List<QueryToken> tokens = getCurrentWhereTokens();
        appendOperatorIfNeeded(tokens);

        fieldName = ensureValidFieldName(fieldName, false);
        negateIfNeeded(tokens, fieldName);

        WhereToken whereToken = WhereToken.create(WhereOperator.SEARCH, fieldName, addQueryParameter(searchTerms), new WhereToken.WhereOptions(operator));
        tokens.add(whereToken);
    }
736807
public function and($column, $value = '', $operator = Criterion::EQUALS, $variable = null, $additional = null, $special = null): self
        {
            if ($this->mode == query::MODE_OR) {
                throw new Exception('Cannot combine two selection types (AND/OR) in the same Criteria. Use multiple sub-criteria instead');
            }

            $this->where($column, $value, $operator, $variable, $additional, $special);

            $this->mode = query::MODE_AND;

            return $this;
        }
511244
public void addFilter(String name, String value, SearchCriteriaFilterOperator operator) {
        SearchCriteriaFilterBean filter = new SearchCriteriaFilterBean();
        filter.setName(name);
        filter.setValue(value);
        filter.setOperator(operator);
        filters.add(filter);
    }
883949
protected function buildQueryStringFromData($filter_info)
    {
        $filters = array_get($filter_info, 'filters');
        if (empty($filters)) {
            return null;
        }

        $sql = '';
        $combiner = array_get($filter_info, 'filter_op', DbLogicalOperators::AND_STR);
        foreach ($filters as $key => $filter) {
            if (!empty($sql)) {
                $sql .= " $combiner ";
            }

            $name = array_get($filter, 'name');
            $op = strtoupper(array_get($filter, 'operator'));
            if (empty($name) || empty($op)) {
                // log and bail
                throw new InternalServerErrorException('Invalid server-side filter configuration detected.');
            }

            if (DbComparisonOperators::requiresNoValue($op)) {
                $sql .= "($name $op)";
            } else {
                $value = array_get($filter, 'value');
                $sql .= "($name $op $value)";
            }
        }

        return $sql;
    }
287305
public void addFilter(Filter filter) {
    filter.setInitialContext(initialContext);

    int minIndex = Integer.MAX_VALUE;
    String[] before = filter.before();
    for (int i = 0; i < before.length; i++) {
        String s = before[i];
        int index = index(activeFilters, s);
        if (index < minIndex) {
          minIndex = index;
        }
      }
      if (minIndex == Integer.MAX_VALUE) {
        // -1 is more usable for not-found than MAX_VALUE
        minIndex = -1;
      }

    if (contains(filter.before(), FIRST_IN_PIPE)) {
      activeFilters.add(0, filter);
    } else if (minIndex != -1) {
      activeFilters.add(minIndex, filter);
    } else {
      activeFilters.add(filter);
    }
  }
960040
def and_filter(self, filter_or_string, *args, **kwargs):
        
        and_filter = self.find_filter(And)

        if and_filter is None:
            and_filter = And()
            self.filters.append(and_filter)

        and_filter.add_filter(build_filter(
            filter_or_string, *args, **kwargs))

        return and_filter
669960
public FilterBuilder<T> addWithAnd(final Filter<T> filter) {
    filterInstance = ComposableFilter.and(filterInstance, filter);
    return this;
  }
1120781
public final void addFilters(final List<IDataFilter> newFilters) {
        assertFilterListExists();
        for (IDataFilter filter : newFilters) {
            addFilter(filter);
        }
    }
1139506
@Override
  public <T extends Filter> T createFilter(Class<T> classToCreate) throws ServletException {
      
      logger.logp(Level.FINE, CLASS_NAME, "createFilter", "called for class: " + classToCreate);
      return super.createFilter(classToCreate);
  }
688718
public void append(final Filter query) {
        switch (this.queryType) {
            case OR: {
                this.orFilter.or(query);
            }
            break;

            default:
            case AND: {
                this.andFilter.and(query);
            }
            break;
        }
    }
1312777
private void addFilter(Filter filter) {
        boolean exists = false;
        for (Filter initedFilter : this.filters) {
            if (initedFilter.getClass() == filter.getClass()) {
                exists = true;
                break;
            }
        }

        if (!exists) {
            filter.init(this);
            this.filters.add(filter);
        }

    }
1049845
public static LogicalOperator checkOperator(String value) throws IllegalArgumentException {
        boolean containsOr = value.contains(OR);
        boolean containsAnd = value.contains(AND);
        if (containsAnd && containsOr) {
            throw new IllegalArgumentException("Cannot merge AND and OR operators in the same query filter.");
        } else if (containsAnd && !containsOr) {
            return LogicalOperator.AND;
        } else if (containsOr && !containsAnd) {
            return LogicalOperator.OR;
        } else {    // !containsOr && !containsAnd
            return null;
        }
    }
958232
def Compile(self, filter_implemention):
    """"""
    operator = self.operator.lower()
    if operator == "and" or operator == "&&":
      method = "AndFilter"
    elif operator == "or" or operator == "||":
      method = "OrFilter"
    else:
      raise ParseError("Invalid binary operator %s" % operator)

    args = [x.Compile(filter_implemention) for x in self.args]
    return filter_implemention.FILTERS[method](arguments=args)
677942
public Operation zCombinedAnd(Operation op)
    {
        if (op instanceof IsNotNullOperation)
        {
            return zCombineWithNotNullOperation((IsNotNullOperation) op);
        }
        if (op instanceof IsNullOperation)
        {
            return zCombineWithNullOperation((IsNullOperation) op);
        }
        return op.zCombinedAnd(this);
    }
1188494
public static <E> Filter<E> orFilter(Filter<E> f1, Filter<E> f2) {
    return (new CombinedFilter<E>(f1, f2, false));
  }