/* (non-Javadoc)
@see org.archive.wayback.util.ObjectFilter#filterObject(java.lang.Object)
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;
	}
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);
        }
    }
1303501
public int filterObject(CaptureSearchResult r) {
		
		for(ObjectFilter<CaptureSearchResult> filter : filters) {
			if(filter == null) {
				return FILTER_EXCLUDE;
			}
			int result = filter.filterObject(r);
			if(result != FILTER_INCLUDE) {
				return result;
			}
		}
		return FILTER_INCLUDE;
	}
1224211
@Override
    public void doFilter(ResourceRequest request, ResourceResponse response, FilterChain chain) throws IOException,
            PortletException {
        doCommonFilter(request, response, chain);
    }
729127
@Override
    public T filter(Filter<ArchivePath> filter) {
        return this.shallowCopy(filter).as(getActualClass());
    }
930161
public Object doFilter(Object obj, Method method, Object[] params, AjaxFilterChain chain) throws Exception
    {
        log.debug("About to execute: " + method.getName() + "() on " + obj);
        Object reply = chain.doFilter(obj, method, params);
        log.debug("Executed: " + method.getName() + "() giving " + reply);
        return reply;
    }
105999
public int filterObject(CaptureSearchResult r) {
		String captureDate = r.getCaptureTimestamp();
		return ((first.compareTo(captureDate) > 0) ||
				(last.compareTo(captureDate) < 0)) ? 
						FILTER_EXCLUDE : FILTER_INCLUDE;
	}
264450
public static <E> Filter<E> collectionAcceptFilter(Collection<E> objs) {
    return new CollectionAcceptFilter<E>(objs, true);
  }
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;
    }
949544
function filter(object, callback) {
		if (!object) { return true; }
		if (object.filter) { return object.filter(callback); }
		if (object instanceof Array) {
			var result = [],
				length	= array ? array.length : 0;
			for(var index = 0; index < length; index++) {
				if (callback(array[index], index)) {
					result.push(array[index]);
				}
			}
		}else{
			var result = {};
			for(var key in object) {
				if (!object.hasOwnProperty(key)) { continue; }
				if (callback(object[key], key)) {
					result[key] = object[key];
				}
			}
		}
		return false;
	}
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;
	}
1308640
public int filterObject(CaptureSearchResult r) {
		String resultUrl = r.getUrlKey();
		return url.equals(resultUrl) ? 
				FILTER_INCLUDE : FILTER_ABORT;
	}
529396
private void filterEngineeringObjectInformation(EDBObject object, Class<?> model) {
        if (!AdvancedModelWrapper.isEngineeringObjectClass(model)) {
            return;
        }
        Iterator<String> keys = object.keySet().iterator();
        while (keys.hasNext()) {
            if (keys.next().startsWith(REFERENCE_PREFIX)) {
                keys.remove();
            }
        }
    }
312939
public int filterObject(CaptureSearchResult o) {
		if(client != null) {
			String url = o.getOriginalUrl();
			Date capDate = o.getCaptureDate();
			try {
				Rule r = client.getRule(url, capDate, new Date(), who);
				if(r != null) {
					String publicComment = r.getPublicComment();
					o.putCustom("ANOTATION", publicComment);
				}
			} catch (RuleOracleUnavailableException e) {
				e.printStackTrace();
				// should not happen: we forcibly disable robots retrievals 
			}
		}
		return FILTER_INCLUDE;
	}
896848
@Override
	public M filter(BiPredicate<? super K, ? super V> filter) {
		MapBuilder<K, V, M> builder = builder();
		for (java.util.Map.Entry<K, V> entry : entrySet()) {
			if(filter.test(entry.getKey(), entry.getValue())) {
				builder.put(entry.getKey(), entry.getValue());
			}
		}
		return builder.build();
	}
806388
protected <OBJ> OBJ filterIfSimpleText(OBJ value, FormMappingOption option, String propertyName, Class<?> propertyType) {
        if (value == null) {
            return null;
        }
        if (value instanceof String) {
            final String str = (String) value;
            if (option.getSimpleTextParameterFilter().isPresent()) { // basically false
                // not use map() to avoid many new instances at main route (not here)
                final FormSimpleTextParameterFilter filter = option.getSimpleTextParameterFilter().get();
                final FormSimpleTextParameterMeta meta = createFormSimpleTextParameterMeta(propertyName, propertyType);
                @SuppressWarnings("unchecked")
                final OBJ filtered = (OBJ) filter.filter(str, meta);
                return filtered;
            } else { // mainly here
                return value;
            }
        } else if (value instanceof String[]) {
            final String[] ary = (String[]) value;
            option.getSimpleTextParameterFilter().ifPresent(filter -> {
                final FormSimpleTextParameterMeta meta = createFormSimpleTextParameterMeta(propertyName, propertyType);
                int index = 0;
                for (String element : ary) {
                    if (element != null) { // just in case
                        ary[index] = filter.filter(element, meta);
                    }
                    ++index;
                }
            });
            @SuppressWarnings("unchecked")
            final OBJ resultObj = (OBJ) ary;
            return resultObj;
        } else {
            return value;
        }
    }
392700
@Override
    public boolean filter(Object data) {
        logger.entering(data);
        String[] keyValues = filterKeyValues.split(",");
        String tempKey = null;
        Field field;

        try {
            field = data.getClass().getDeclaredField(filterKeyName);
            field.setAccessible(true);
            for (String keyValue : keyValues) {
                tempKey = keyValue;
                if (field.get(data) != null && field.get(data).toString().trim().equals(keyValue)) {
                    logger.exiting(true);
                    return true;
                }
            }
        } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
            throw new DataProviderException("Row with key '" + tempKey + "' is not found for given filter key '"
                    + filterKeyName + "'", e);
        }
        logger.exiting(false);
        return false;
    }