@Override public boolean includes(E entity) { return entityTest.apply(entity); }
@SuppressWarnings("unchecked") private void checkContained(String name, Object... values) { for (Object value : values) { if (constraints.containsKey(name)) { Predicate current = constraints.get(name); Preconditions.checkArgument(current.apply(value), "%s does not match %s", current, value); } } }
@Override public boolean apply(@Nullable S input) { return predicate.apply(function.apply(input)); }
@Override @SuppressWarnings("unchecked") public boolean apply(StorageKey key) { if (key == null) { return false; } // this is fail-fast: if the key fails a constraint, then drop it //only check for the number of values in the key in case the key does not //have all fields populated yet for (int i = 0; i < key.size(); i += 1) { Object pValue = key.get(i); if (!partitionPredicates.get(i).apply(pValue)) { return false; } } for (Predicate<Marker> timePredicate : timePredicates) { if (!timePredicate.apply(key)) { return false; } } // if we made it this far, everything passed return true; }
@Override @SuppressWarnings("unchecked") public boolean apply(@Nullable E entity) { if (entity == null) { return false; } // check each constraint and fail immediately for (Map.Entry<Schema.Field, Predicate> entry : predicatesByField) { Object eValue = accessor.get(entity, ImmutableList.of(entry.getKey())); if (!entry.getValue().apply(eValue)) { return false; } } // all constraints were satisfied return true; }
private E computeNextKey() throws IOException, InterruptedException { while (unfiltered.nextKeyValue()) { E element = unfiltered.getCurrentKey(); if (predicate.apply(element)) { return element; } } return null; }
@Override public Predicate<Integer> projectStrict(Predicate<S> predicate) { if (predicate instanceof Exists) { return Predicates.exists(); } else if (predicate instanceof In || predicate instanceof Range) { Set<Integer> possibleValues = Sets.newHashSet(); for (int i = 0; i < values.size(); i += 1) { Set<S> items = values.get(i); // only check items if the set is finite if (items.size() != Integer.MAX_VALUE) { boolean matchedAll = true; for (S entry : items) { matchedAll = matchedAll && predicate.apply(entry); } if (matchedAll) { possibleValues.add(i); } } } if (!possibleValues.isEmpty()) { return Predicates.in(possibleValues); } } return null; }
applies = predicate.apply(key); }else{ LOG.debug("Not applying predicate proactively because path {} does not have any key values.", dir);
String partition = fp.getName(); Predicate partitionPredicate = unsatisfied.get(partition); if (partitionPredicate != null && partitionPredicate.apply(key.get(i))) { unsatisfied.remove(partition); LOG.debug("removing " + partition + " satisfied by " + key.get(i)); Predicate isSatisfiedBy = fp.projectStrict(original); LOG.debug("original: " + original + ", strict: " + isSatisfiedBy); if ((isSatisfiedBy != null) && isSatisfiedBy.apply(key.get(i))) { LOG.debug("removing " + source + " satisfied by " + key.get(i)); unsatisfied.remove(source); .projectStrict(original); LOG.debug("original: " + original + ", strict: " + isSatisfiedBy); if ((isSatisfiedBy != null) && isSatisfiedBy.apply(key)) { LOG.debug("removing " + timeField + " satisfied by " + key); unsatisfied.remove(timeField);
boolean matchedAll = true; for (long i = 0; i < size; i++) { matchedAll = matchedAll && predicate.apply(val + i);
boolean matchedAll = true; for (int i = upperBounds[0] + 1; i <= end; i += 1) { matchedAll = matchedAll && predicate.apply(i);