Creates a new filter from the current filter which also has to match a given state.<p>

@param states the states to match

@return the new filter
768879
public CmsUrlNameMappingFilter filterStates(int... states) {

        CmsUrlNameMappingFilter result = new CmsUrlNameMappingFilter(this);
        result.m_states = states;
        return result;

    }
835168
public FilterChain create() throws FilterConfigurationException {
        Preconditions.checkState(filters != null, "list of filters must be set");
        Preconditions.checkState(inputType != null, "inputType must be set");
        Preconditions.checkState(outputType != null, "outputType must be set");

        Preconditions.checkState(filters.size() > 0, "need at least one filter");
        validateFiltersList();

        Iterator<Object> iterator = filters.iterator();

        FilterChainElement firstInstance = getInstanceFromListElement(iterator.next());
        if (!firstInstance.getSupportedInputType().isAssignableFrom(inputType)
                || !firstInstance.getSupportedOutputType().isAssignableFrom(outputType)) {
            throw new FilterConfigurationException(String.format(
                "incompatible Filtertype (%s) should be (%s->%s) - is (%s->%s)",
                firstInstance.getClass(), inputType, outputType, firstInstance.getSupportedInputType(),
                firstInstance.getSupportedOutputType()));
        }
        FilterChainElement current = firstInstance;
        while (iterator.hasNext()) {
            Object next = iterator.next();
            FilterChainElement nextFilterElement = getInstanceFromListElement(next);
            if (nextFilterElement == null) {
                current.setNext((FilterAction) next);
                break;
            }
            current.setNext(nextFilterElement);
            current = nextFilterElement;
        }
        return new FilterChain(firstInstance);
    }
577800
@SuppressWarnings("unchecked")
    public Q filter(Filter filter) {
        if (filters.isEmpty()) {
            this.filter = filter;
            filters = ImmutableList.of(filter);
        } else {
            this.filter = null;
            if (filters.size() == 1) {
                filters = new ArrayList<Filter>();
            }
            filters.add(filter);
        }
        return (Q) this;
    }
939060
public CmsRelationFilter filterStrong() {

        CmsRelationFilter filter = (CmsRelationFilter)clone();
        if (filter.m_types.isEmpty()) {
            filter.m_types.addAll(CmsRelationType.getAllStrong());
        } else {
            filter.m_types = new HashSet<CmsRelationType>(CmsRelationType.filterStrong(filter.m_types));
        }
        return filter;
    }
783518
public static <T, V> FactorFilter<T, V> create(final String factorName,
      final Filter<T, V> filter) {

    if (null == factorName || factorName.length() == 0 || null == filter) {
      logger.error(
          "failed to create instance of FactorFilter, at least one of the input paramters are invalid");
      return null;
    }

    return new FactorFilter<>(factorName, filter);
  }
1319974
public function createListing($filters, $filtering_flags = 0)
	{
		$q = $this->createQueryBuilder();
		$this->queryAddStateSelect($q);
		$this->queryAddPropertiesSelect($q);

		if (isset($this->listing_access_policy)) {
			$this->queryAddAccessPolicyCondition($this->listing_access_policy, $q);
		}

		if (isset($this->default_filters)) {
			$filters = array_replace($this->default_filters, $filters);
		}

		return new \Smalldb\StateMachine\FlupdoGenericListing($this, $q, $this->sphinx, $filters,
			$this->table, $this->filters, $this->properties, $this->references, $this->additional_filters_data, $this->state_select, $filtering_flags);
	}
946726
protected S state(S newState) {
        S oldState = state;
        state = newState;
        return oldState;
    }
680501
public static <T> List<T> filter(Collection<T> c, Filter<T> filter){
        if(c.size()==0)
            return Collections.emptyList();

        List<T> filteredList = new ArrayList<T>(c.size());
        for(T element: c){
            if(filter.select(element))
                filteredList.add(element);
        }
        return filteredList;
    }
726735
function uniqStates(states) {
    var seen = {}, a = [], path, i, n;

    for (i = 0, n = states.length; i < n; i++) {
      if (!states[i]) { continue; }
      path = states[i].path();
      if (!seen[path]) {
        a.push(states[i]);
        seen[path] = true;
      }
    }

    return a;
  }
1350983
public static Call.Mapper<List<List<Span>>, List<List<Span>>> create(QueryRequest request) {
    return new FilterTraces(request);
  }
688671
public HalResource addState(ObjectNode state) {
    state.fields().forEachRemaining(entry -> model.set(entry.getKey(), entry.getValue()));
    return this;
  }
752081
public static FilterFragment[] from(Filter... filters) {
        FilterFragment[] ret = new FilterFragment[filters.length];
        Arrays.setAll(ret, (i) -> new FilterFragment(filters[i]));
        return ret;
    }
1264830
@Override
    public StateObj evaluateRules(final StateObj state) {
        MutableStateObj dataState = States.mutable();
        getRuleSet().stream()
                    //filter rules that apply given the state
                    .filter(i -> i.test(state))
                    //evaluate the applicable rules
                    .map(input -> Optional.ofNullable(input.evaluate(state)))
                    //exclude empty results
                    .flatMap(o -> o.map(Stream::of).orElseGet(Stream::empty))
                    //update the state with each result
                    .forEach(dataState::updateState);
        return dataState;
    }
890735
public CmsRelationFilter filterType(CmsRelationType type) {

        CmsRelationFilter filter = (CmsRelationFilter)clone();
        filter.m_types.add(type);
        return filter;
    }
1226430
@Override
    public final MatchResult matches(final List<String> lines) {
        for (int i = 0; i < lines.size(); i++) {
            if (matches(i + 1, lines.get(i))) return new MatchResult(true, this, i);
        }
        return NO_MATCH;
    }
1049835
public AbstractSheet<TRow, TColumn, TCell> setFilters(List<SheetFilter> filters) {
        this.filters = filters;
        return this;
    }
889936
public CmsRelationFilter filterResource(CmsResource resource) {

        CmsRelationFilter filter = filterStructureId(resource.getStructureId());
        filter = filterPath(resource.getRootPath());
        return filter;
    }