This method returns a filter associated with the supplied criteria.

@param criteria The criteria
@return The filter, or null if not relevant
422718
public static FilterBuilder buildFilter(Criteria criteria) {
        if (criteria.getTransaction() != null && criteria.getTransaction().trim().isEmpty()) {
            return FilterBuilders.missingFilter(TRANSACTION_FIELD);
        }
        return null;
    }
811113
public T filter(@NonNull SerializablePredicate<? super HString> filter) {
      this.filter = filter;
      return Cast.as(this);
   }
212175
public Query<S> query(String filter) throws FetchException {
        synchronized (mStringToQuery) {
            Query<S> query = mStringToQuery.get(filter);
            if (query == null) {
                if (filter == null) {
                    throw new IllegalArgumentException("Query filter must not be null");
                }
                query = query(Filter.filterFor(mType, filter), null);
                mStringToQuery.put(filter, query);
            }
            return query;
        }
    }
161921
public function criteria($criteria = null)
    {
        if (is_null($criteria)) {
            return $this->mediator->criteria();
        }

        if (!is_null($criteria) && !is_a($criteria, CriteriaInterface::class)) {
            throw new InvalidCriteria();
        }

        $this->mediator->criteria()->addCriteria($criteria);

        return $this;
    }
843484
public NetworkFilter where(Predicate<NetworkMetadata> filter) {
        checkNotNull(filter, "Filter predicate must be not a null");

        this.predicate = this.predicate.and(filter);

        return this;
    }
1255073
public AntiAffinityPolicyFilter where(Predicate<AntiAffinityPolicyMetadata> filter) {
        checkNotNull(filter, "Filter predicate must be not a null");

        this.predicate = this.predicate.and(filter);

        return this;
    }
1112185
@Override
	public List<Criterion> getCriteria() {
		if (criteria == null) {
			criteria = new ArrayList<Criterion>();
		}
		return criteria;
	}
166472
public TypedQuery<Long> count(Filter filter) {
        CriteriaQuery<Long> query = cb.createQuery(Long.class);
        Root<T> from = query.from(getEntityClass());

        if (filter != null) {
            Predicate where = new CriteriaMapper(from, cb).create(filter);
            query.where(where);
        }

        return getEntityManager().createQuery(query.select(cb.count(from)));
    }
409691
def filter(criterias, devices):  # pylint: disable=too-many-branches
        
        if not criterias:
            return devices
        result = []
        for device in devices:  # pylint: disable=too-many-nested-blocks
            for criteria_name, criteria_values in criterias.items():
                if criteria_name in device.keys():
                    if isinstance(device[criteria_name], list):
                        for criteria_value in criteria_values:
                            if criteria_value in device[criteria_name]:
                                result.append(device)
                                break
                    elif isinstance(device[criteria_name], str):
                        for criteria_value in criteria_values:
                            if criteria_value == device[criteria_name]:
                                result.append(device)
                    elif isinstance(device[criteria_name], int):
                        for criteria_value in criteria_values:
                            if criteria_value == device[criteria_name]:
                                result.append(device)
                    else:
                        continue
        return result
356473
public function query($criteria=null)
    {
        $query = new \Pheasant\Query\Query($this->_connection);
        $query->from($this->_name);

        if(!is_null($criteria))
            $query->where($criteria);

        return $query;
    }
700836
@SuppressWarnings("unchecked")
    public List<E> findByCriteria(Criterion... criterion) throws HibernateException {
        LOG.trace("Finding instances of " + entityClass.getSimpleName()
            + " based on " + criterion.length + " criteria");

        Criteria criteria = createDistinctRootEntityCriteria(criterion);
        return criteria.list();
    }
53382
public static boolean exampleHasAtLeastOneCriteriaCheck(Object parameter) {
        if (parameter != null) {
            try {
                if (parameter instanceof Example) {
                    List<Example.Criteria> criteriaList = ((Example) parameter).getOredCriteria();
                    if (criteriaList != null && criteriaList.size() > 0) {
                        return true;
                    }
                } else {
                    Method getter = parameter.getClass().getDeclaredMethod("getOredCriteria");
                    Object list = getter.invoke(parameter);
                    if(list != null && list instanceof List && ((List) list).size() > 0){
                        return true;
                    }
                }
            } catch (Exception e) {
                throw new MapperException(SAFE_DELETE_ERROR, e);
            }
        }
        throw new MapperException(SAFE_DELETE_EXCEPTION);
    }
1080690
public static <T> CriteriaQuery<Long> countCriteria(EntityManager em, CriteriaQuery<T> criteria) {
        CriteriaBuilder builder = em.getCriteriaBuilder();
        CriteriaQuery<Long> countCriteria = builder.createQuery(Long.class);
        copyCriteriaNoSelection(criteria, countCriteria);
        countCriteria.select(builder.count(findRoot(countCriteria, criteria.getResultType())));

        return countCriteria;
    }
904685
public Long count(Criteria<T, T> criteria) {
        SingularAttribute<? super T, PK> id = getEntityManager().getMetamodel().entity(entityClass).getId(entityKey);
        return criteria.select(Long.class, countDistinct(id))
                .getSingleResult();
    }
793789
@SuppressWarnings("unchecked")
	public final <T extends SolrDataQuery> T addCriteria(Criteria criteria) {

		Assert.notNull(criteria, "Cannot add null criteria.");

		if (this.criteria == null) {
			this.criteria = criteria;
		} else {
			if (this.criteria instanceof Crotch) {
				((Crotch) this.criteria).add(criteria);
			} else {
				Crotch tree = new Crotch();
				tree.add(this.criteria);
				tree.add(criteria);
				this.criteria = tree;
			}
		}
		return (T) this;
	}
904166
public static <T> Long count(EntityManager em, CriteriaQuery<T> criteria) {

        return em.createQuery(countCriteria(em, criteria)).getSingleResult();
    }
160607
public function findByCriteria(Criteria $criteria, $order = null, $limit = null, $offset = 0)
    {
        $qb = $this->createCriteriaQueryBuilder($criteria, 'm');

        if ($order) {
            foreach ($order as $field => $dir) {
                $qb->orderBy("m.$field", $dir);
            }
        }
        if ($limit) {
            $qb->setMaxResults($limit);
        }
        if ($offset) {
            $qb->setFirstResult($offset);
        }

        return $qb->getQuery()->getResult();
    }