/* (non-Javadoc)
@see org.archive.wayback.util.ObjectFilter#filterObject(java.lang.Object)
486299
public int filterObject(CaptureSearchResult r) {
		recordsScanned++;
		if(recordsScanned > maxRecordsToScan) {
			LOGGER.warning("Hit max results on " + r.getUrlKey() + " " 
					+ r.getCaptureTimestamp());
			return FILTER_ABORT;
		}
		return FILTER_INCLUDE;
	}
296809
@Override
	public Object doOutParameter(final String key, final Object val) {
		if (getFilters().isEmpty()) {
			return val;
		}
		Object obj = val;
		for (final SqlFilter filter : getFilters()) {
			obj = filter.doOutParameter(key, obj);
		}
		return obj;
	}
11009
public PythonSingleOutputStreamOperator filter(FilterFunction<PyObject> filter) throws IOException {
		return new PythonSingleOutputStreamOperator(stream.filter(new PythonFilterFunction(filter)));
	}
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;
	}
1367107
public static <T> Filter<T> eq(final T object) {
        return new NonMutatingFilter<T>() {
            @Override
            protected boolean accepts(T item) {
                return object.equals(item);
            }
        };
    }
667931
public int filterObject(CaptureSearchResult r) {
		if(!notifiedSeen) {
			if(filterGroup != null) {
				filterGroup.setSawRobots();
			}
			notifiedSeen = true;
		}
		String originalURL = r.getOriginalUrl();
		String path = UrlOperations.getURLPath(originalURL);
		if(path.equals(ROBOT_SUFFIX)) {
			if(!notifiedPassed) {
				if(filterGroup != null) {
					filterGroup.setPassedRobots();
				}
				notifiedPassed = true;
			}
			return ObjectFilter.FILTER_INCLUDE;
		}
		String host = UrlOperations.urlToHost(originalURL);
		boolean updated = false;
		try {
			updateAggregation(host);
			if(!aggregation.isBlocked(path)) {
				if(LOGGER.isLoggable(Level.INFO)) {
					LOGGER.fine("ROBOT: BLOCKED(" + originalURL + ")");
				}
				if(LOGGER.isLoggable(Level.FINE)) {
					LOGGER.finer("ROBOT: ALLOWED(" + originalURL + ")");
				}
				if(!notifiedPassed) {
					if(filterGroup != null) {
						filterGroup.setPassedRobots();
					}
					notifiedPassed = true;
				}
				return ObjectFilter.FILTER_INCLUDE;
			}

//		} catch (LiveDocumentNotAvailableException e) {
		} catch (LiveWebCacheUnavailableException e) {
			LOGGER.severe("ROBOT: LiveWebCacheUnavailableException("
					+ originalURL + ")");
			filterGroup.setLiveWebGone();

		} catch (LiveWebTimeoutException e) {
			LOGGER.severe("ROBOT: LiveDocumentTimedOutException("
					+ originalURL + ")");
			filterGroup.setRobotTimedOut();

		} catch (MalformedURLException e) {

			LOGGER.warning("ROBOT: MalformedURLException(" + 
					originalURL + ")");

		} catch (IOException e) {
			e.printStackTrace();
			return ObjectFilter.FILTER_EXCLUDE;
		}

		if(filterGroup.getRobotTimedOut() || filterGroup.getLiveWebGone()) {
			return ObjectFilter.FILTER_ABORT;
		}
		if(LOGGER.isLoggable(Level.INFO)) {
			LOGGER.fine("ROBOT: BLOCKED(" + originalURL + ")");
		}
		return ObjectFilter.FILTER_EXCLUDE;
	}
247339
@SuppressWarnings("unchecked")
    public final T[] filter(final T[] objects) {
        final Collection<T> filtered = filter(Arrays.asList(objects));
        try {
            return filtered.toArray((T[]) Array.newInstance(objects
                    .getClass(), filtered.size()));
        } catch (ArrayStoreException ase) {
            Logger log = LoggerFactory.getLogger(Filter.class);
            log.warn("Error converting to array - using default approach", ase);
        }
        return (T[]) filtered.toArray();
    }
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;
	}
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;
		}
	}
454533
def filter(self, *args, **kwargs):
        """"""
        obj = kwargs.pop(self.object_property_name, None)
        if obj is not None:
            kwargs['object_hash'] = self.model._compute_hash(obj)
        return super().filter(*args, **kwargs)
1026973
public Iterator iterateObjects(org.kie.api.runtime.ObjectFilter filter) {
        return getObjectStore().iterateObjects(filter);
    }
825976
@Override
    public T findOne(EntityFilter<T> filter) {
        for (T object : findAll()) {
            if (filter.accept(object)) {
                return object;
            }
        }
        return null;
    }
1024463
public static <E> Filter<E> collectionAcceptFilter(E[] objs) {
    return new CollectionAcceptFilter<E>(Arrays.asList(objs), true);
  }
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;
    }
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();
            }
        }
    }
105999
public int filterObject(CaptureSearchResult r) {
		String captureDate = r.getCaptureTimestamp();
		return ((first.compareTo(captureDate) > 0) ||
				(last.compareTo(captureDate) < 0)) ? 
						FILTER_EXCLUDE : FILTER_INCLUDE;
	}
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;
    }