/* (non-Javadoc)
@see org.archive.wayback.util.ObjectFilter#filterObject(java.lang.Object)
179818
public int filterObject(CaptureSearchResult r) {
		String origHost = r.getOriginalHost();
		if(hostname.equals(origHost)) {
			return FILTER_INCLUDE;
		} else {
			if(annotationTarget != null) {
				annotationTarget.addCloseMatch(origHost, r.getOriginalUrl());
			}
			return FILTER_EXCLUDE;
		}
	}
292461
@CheckResult
    @NonNull
    public final Data<T> filter(@NonNull Predicate<? super T> predicate) {
        return new FilterData<>(this, predicate);
    }
250054
public static service[] get_filtered(nitro_service service, String filter) throws Exception{
		service obj = new service();
		options option = new options();
		option.set_filter(filter);
		service[] response = (service[]) obj.getfiltered(service, option);
		return response;
	}
565418
@Override
	public Filter getFilter() {
		Filter filter = new Filter() {
			@Override
			protected FilterResults performFiltering(CharSequence constraint) {
				ArrayList<Pair<String, ?>> filteredPrefs = new ArrayList<Pair<String, ?>>();
				FilterResults filterFriends = new FilterResults();
				if (!SharedPreferenceUtils.isEmptyString(constraint)) {
					for (Pair<String, ?> keyValue : keyValSet) {
						String constraintString = constraint.toString();
						String prefixKey = "key: ";
						String prefixValue = "value: ";
						String first = keyValue.first;
						Object second = keyValue.second;
						if (constraintString.toLowerCase().startsWith(prefixKey)) {
							if (first.toLowerCase().contains(constraintString.toLowerCase().substring(prefixKey.length()))) {
								filteredPrefs.add(keyValue);
							}
						} else if (constraintString.toLowerCase().startsWith(prefixValue)) {
							if (second != null) {
								if (second.toString().contains(constraintString.toLowerCase().substring(prefixValue.length()))) {
									filteredPrefs.add(keyValue);
								}
							}
						} else {
							if (first.equalsIgnoreCase(constraintString) || (second != null && second.toString()
							                                                                         .equalsIgnoreCase(constraintString))) {
								filteredPrefs.add(keyValue);
							}
						}
					}
				} else {
					filteredPrefs = keyValSet;
				}
				filterFriends.count = filteredPrefs.size();
				filterFriends.values = filteredPrefs;
				return filterFriends;
			}

			@Override
			protected void publishResults(CharSequence constraint, FilterResults results) {
				filteredCollection = (ArrayList<Pair<String, ?>>) results.values;

				notifyDataSetChanged();
			}
		};
		return filter;
	}
825976
@Override
    public T findOne(EntityFilter<T> filter) {
        for (T object : findAll()) {
            if (filter.accept(object)) {
                return object;
            }
        }
        return null;
    }
909923
@CheckResult
    @NonNull
    public final <O> Data<O> filter(@NonNull final Class<O> type) {
        //noinspection unchecked
        return (Data<O>) new FilterData<>(this, new Predicate<Object>() {
            @Override
            public boolean apply(Object o) {
                return type.isInstance(o);
            }
        });
    }
986653
@SuppressWarnings("checkstyle:npathcomplexity")
    @Override
    public int doFilter(EventFilter filter, Data dataKey, Object oldValue, Object dataValue, EntryEventType eventType,
                        String mapNameOrNull) {
        if (filter instanceof MapPartitionLostEventFilter) {
            return FILTER_DOES_NOT_MATCH;
        }

        // the order of the following ifs is important!
        // QueryEventFilter is instance of EntryEventFilter
        if (filter instanceof EventListenerFilter) {
            if (!filter.eval(eventType.getType())) {
                return FILTER_DOES_NOT_MATCH;
            } else {
                filter = ((EventListenerFilter) filter).getEventFilter();
            }
        }
        if (filter instanceof TrueEventFilter) {
            return eventType.getType();
        }
        if (filter instanceof QueryEventFilter) {
            return processQueryEventFilter(filter, eventType, dataKey, oldValue, dataValue, mapNameOrNull)
                    ? eventType.getType() : FILTER_DOES_NOT_MATCH;
        }
        if (filter instanceof EntryEventFilter) {
            return processEntryEventFilter(filter, dataKey) ? eventType.getType() : FILTER_DOES_NOT_MATCH;
        }
        throw new IllegalArgumentException("Unknown EventFilter type = [" + filter.getClass().getCanonicalName() + "]");
    }
1224211
@Override
    public void doFilter(ResourceRequest request, ResourceResponse response, FilterChain chain) throws IOException,
            PortletException {
        doCommonFilter(request, response, chain);
    }
40675
public int filterObject(CaptureSearchResult o) {
		String thisUrl = o.getOriginalUrl();
		String thisDate = o.getCaptureTimestamp();
		int result = ObjectFilter.FILTER_INCLUDE;
		if(lastUrl != null) {
			if(lastUrl.equals(thisUrl) && thisDate.equals(lastDate)) {
				result = FILTER_EXCLUDE;
			}
		}
		lastUrl = thisUrl;
		lastDate = thisDate;
		return result;
	}
487011
public void bindFilterPredicate(ObjectProperty<TreeItemPredicate<Category>> predicateProperty) {
    predicateProperty.bind(Bindings.createObjectBinding(() -> {
      if (searchText.get() == null || searchText.get().isEmpty()) {
        return null;
      }
      return TreeItemPredicate.create(filterPredicate);
    }, searchText));
  }
230815
public static ns[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
	{
		ns obj = new ns();
		options option = new options();
		option.set_filter(filter);
		ns[] response = (ns[]) obj.getfiltered(service, option);
		return response;
	}
590252
public static <E> Filter<E> notFilter(Filter<E> filter) {
    return (new NegatedFilter<E>(filter));
  }
389801
@Override
    public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) {
        Object response = responseContext.getEntity();
        if (response == null) {
            if (feature.getBoot().isNullDataResponseEnabled()) {
                Document document = new Document();
                document.setData(Nullable.nullValue());
                responseContext.setEntity(document);
                responseContext.setStatus(Response.Status.OK.getStatusCode());
                responseContext.getHeaders().put("Content-Type",
                        Collections.singletonList(JsonApiMediaType.APPLICATION_JSON_API));
            }
            return;
        }

        // only modify responses which contain a single or a list of Crnk resources
        Optional<RegistryEntry> registryEntry = getRegistryEntry(response);
        if (registryEntry.isPresent()) {
            CrnkBoot boot = feature.getBoot();
            DocumentMapper documentMapper = boot.getDocumentMapper();
            HttpRequestContextProvider httpRequestContextProvider = boot.getModuleRegistry().getHttpRequestContextProvider();
            try {
                HttpRequestContext context = new HttpRequestContextBaseAdapter(new JaxrsRequestContext(requestContext,
                        feature));
                httpRequestContextProvider.onRequestStarted(context);

                JsonApiResponse jsonApiResponse = new JsonApiResponse();
                jsonApiResponse.setEntity(response);
                // use the Crnk document mapper to create a JSON API response
                DocumentMappingConfig mappingConfig = new DocumentMappingConfig();

                ResourceInformation resourceInformation = registryEntry.get().getResourceInformation();

                Map<String, Set<String>> jsonApiParameters = context.getRequestParameters().entrySet()
                        .stream()
                        .filter(entry -> isJsonApiParameter(entry.getKey()))
                        .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
                QuerySpecUrlMapper urlMapper = feature.getBoot().getUrlMapper();
                QuerySpec querySpec = urlMapper.deserialize(resourceInformation, jsonApiParameters);

                ResourceRegistry resourceRegistry = feature.getBoot().getResourceRegistry();
                QueryAdapter queryAdapter = new QuerySpecAdapter(querySpec, resourceRegistry, context.getQueryContext());
                responseContext.setEntity(documentMapper.toDocument(jsonApiResponse, queryAdapter, mappingConfig).get());
                responseContext.getHeaders().put("Content-Type",
                        Collections.singletonList(JsonApiMediaType.APPLICATION_JSON_API));
            } finally {
                httpRequestContextProvider.onRequestFinished();
            }
        } else if (isJsonApiResponse(responseContext) && !doNotWrap(response)) {
            Document document = new Document();
            document.setData(Nullable.of(response));
            responseContext.setEntity(document);
        }
    }
943894
public static filteraction[] get_filtered(nitro_service service, String filter) throws Exception{
		filteraction obj = new filteraction();
		options option = new options();
		option.set_filter(filter);
		filteraction[] response = (filteraction[]) obj.getfiltered(service, option);
		return response;
	}
612743
public int filterObject(CaptureSearchResult r) {
		Iterator<ExclusionFilter> itr = filters.iterator();
		while(itr.hasNext()) {
			ObjectFilter<CaptureSearchResult> filter = itr.next();
			if(filter == null) {
				return FILTER_EXCLUDE;
			}
			int result = filter.filterObject(r);
			if(result != FILTER_INCLUDE) {
				return result;
			}
		}
		return FILTER_INCLUDE;
	}
105999
public int filterObject(CaptureSearchResult r) {
		String captureDate = r.getCaptureTimestamp();
		return ((first.compareTo(captureDate) > 0) ||
				(last.compareTo(captureDate) < 0)) ? 
						FILTER_EXCLUDE : FILTER_INCLUDE;
	}
355011
public int filterObject(CaptureSearchResult r) {
		String httpCode = r.getHttpCode();
		// only filter real 3XX http response codes:
		if(httpCode.startsWith("3")) {
			String redirect = r.getRedirectUrl();
			if(redirect.compareTo("-") != 0) {
				String urlKey = r.getUrlKey();
				try {
					String redirectKey = canonicalizer.urlStringToKey(redirect);
					if((redirectKey != null) && (urlKey != null) &&
							(redirectKey.compareTo(urlKey) == 0)) {
						// only omit if same scheme:
						String origScheme = 
							UrlOperations.urlToScheme(r.getOriginalUrl());
						String redirScheme = 
							UrlOperations.urlToScheme(redirect);
						if((origScheme != null) && (redirScheme != null) &&
								(origScheme.compareTo(redirScheme) == 0)) {
							return FILTER_EXCLUDE;
						}
					}
				} catch (URIException e) {
					// emit message (is that right?) and continue
					LOGGER.info("Bad redirectURL:" + redirect + 
							" urlKey:"+ urlKey +
							" date:"+ r.getCaptureTimestamp());
				}
			}
		}
		return FILTER_INCLUDE;
	}