Package com.google.common.base

Examples of com.google.common.base.Predicate


      // in the case of identical source and partition names, the predicate
      // will be applied for both source and partition values.

      for (Schema.Field field : fields) {
        Predicate sourcePredicate = predicates.get(field.name());
        if (sourcePredicate != null) {
          predicateMap.put(field, sourcePredicate);
        }
      }

      if (strategy != null) {
        // there could be partition predicates to add
        for (FieldPartitioner fp : strategy.getFieldPartitioners()) {
          if (fp instanceof ProvidedFieldPartitioner) {
            // no source field for provided partitioners, so no values to test
            continue;
          }
          Predicate partitionPredicate = predicates.get(fp.getName());
          if (partitionPredicate != null) {
            Predicate transformPredicate = new TransformPredicate(
                fp, partitionPredicate);
            Schema.Field field = schema.getField(fp.getSourceName());
            Predicate sourcePredicate = predicateMap.get(field);
            if (sourcePredicate != null) {
              // combine the source and the transform-wrapped predicates
              predicateMap.put(field,
                  combine(sourcePredicate, transformPredicate));
            } else {
View Full Code Here


      Predicate[] preds = new Predicate[partitioners.size()];

      Map<String, Predicate> timeFields = Maps.newHashMap();
      for (int i = 0; i < preds.length; i += 1) {
        FieldPartitioner fp = partitioners.get(i);
        Predicate sourcePredicate = predicates.get(fp.getSourceName());
        if (sourcePredicate != null) {
          Predicate projectedPredicate = fp.project(sourcePredicate);
          if (projectedPredicate != null) {
            preds[i] = projectedPredicate;
          }
          if (fp instanceof CalendarFieldPartitioner) {
            timeFields.put(fp.getSourceName(), sourcePredicate);
          }
        }

        Predicate partitionPredicate = predicates.get(fp.getName());
        if (preds[i] != null) {
          if (partitionPredicate != null) {
            preds[i] = combine(partitionPredicate, preds[i]);
          }
        } else {
View Full Code Here

public class PredicateBinaryExceptionClassifierTest {

    @Test
    public void testClassify() {
        Predicate predicate = Mockito.mock(Predicate.class);
        PredicateBinaryExceptionClassifier classifier = new PredicateBinaryExceptionClassifier(predicate);
        classifier.setPredicate(predicate);
        Mockito.when(predicate.apply(Mockito.any(Throwable.class))).thenReturn(false);
        Assert.assertSame(predicate, classifier.getPredicate());
        Assert.assertFalse(classifier.classify(new RuntimeException()));
        Mockito.verify(predicate, Mockito.times(1)).apply(Mockito.any(Throwable.class));
    }
View Full Code Here

      }

      public boolean removeAll(final Collection paramCollection)
      {
        Preconditions.checkNotNull(paramCollection);
        Predicate local1 = new Predicate()
        {
          public boolean apply(Map.Entry paramAnonymousEntry)
          {
            return paramCollection.contains(paramAnonymousEntry.getValue());
          }
View Full Code Here

      }

      public boolean retainAll(final Collection paramCollection)
      {
        Preconditions.checkNotNull(paramCollection);
        Predicate local2 = new Predicate()
        {
          public boolean apply(Map.Entry paramAnonymousEntry)
          {
            return !paramCollection.contains(paramAnonymousEntry.getValue());
          }
View Full Code Here

      }

      public boolean retainAll(final Collection paramCollection)
      {
        Preconditions.checkNotNull(paramCollection);
        Predicate local1 = new Predicate()
        {
          public boolean apply(Map.Entry paramAnonymousEntry)
          {
            return !paramCollection.contains(paramAnonymousEntry.getKey());
          }
View Full Code Here

        return !StandardTable.this.containsColumn(StandardTable.Column.this.columnKey);
      }

      public void clear()
      {
        Predicate localPredicate = Predicates.alwaysTrue();
        StandardTable.Column.this.removePredicate(localPredicate);
      }
View Full Code Here

            }
        } else {
            // filtering by group name included in query -> enforce offset
            // and limit on the result set.
            Iterator<Authorizable> result = findAuthorizables(statement.toString(), Long.MAX_VALUE, 0, null);
            Predicate groupFilter = new GroupPredicate(userManager,
                    groupId,
                    builder.isDeclaredMembersOnly());
            return ResultIterator.create(builder.getOffset(), builder.getMaxCount(),
                    Iterators.filter(result, groupFilter));
        }
View Full Code Here

            return findAuthorizables(statement.toString(), builder.getMaxCount(), offset);
        } else {
            // filtering by group name included in query -> enforce offset
            // and limit on the result set.
            Iterator<Authorizable> result = findAuthorizables(statement.toString(), Long.MAX_VALUE, 0);
            Predicate groupFilter = new GroupPredicate(userManager,
                    builder.getGroupID(),
                    builder.isDeclaredMembersOnly());
            return ResultIterator.create(builder.getOffset(), builder.getMaxCount(),
                    Iterators.filter(result, groupFilter));
        }
View Full Code Here

            }
        } else {
            // filtering by group name included in query -> enforce offset
            // and limit on the result set.
            Iterator<Authorizable> result = findAuthorizables(statement.toString(), Long.MAX_VALUE, 0, null);
            Predicate groupFilter = new GroupPredicate(userManager,
                    groupId,
                    builder.isDeclaredMembersOnly());
            return ResultIterator.create(builder.getOffset(), builder.getMaxCount(),
                    Iterators.filter(result, groupFilter));
        }
View Full Code Here

TOP

Related Classes of com.google.common.base.Predicate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.