Java Code Examples for com.google.common.base.Predicates#alwaysFalse()

The following examples show how to use com.google.common.base.Predicates#alwaysFalse() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PanicAlarm.java    From arcusplatform with Apache License 2.0 6 votes vote down vote up
public PanicAlarm() {
	// FIXME update the offline to take rule:state == DISABLED into account
	super(
			NAME,
			ExpressionCompiler.compile(
				"base:caps contains 'keypad' OR " +
				"(" +
					"rule:template == 'pendant-panic' OR " +
					"rule:template == 'button-panic' OR " +
					"rule:template == '01e7de' OR " +
					"rule:template == 'c2dd38'" +
				")"
			),
			Predicates.<Model>alwaysFalse()
	);
}
 
Example 2
Source File: PdaUtil.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
public <S, P, R> List<R> collectReachable(Pda<S, P> pda, final Function<S, R> function) {
	final List<R> result = Lists.newArrayList();
	Iterator<P> stack = Collections.<P> emptyList().iterator();
	Predicate<S> matches = Predicates.<S> alwaysFalse();
	Predicate<S> canPass = new Predicate<S>() {
		@Override
		public boolean apply(S input) {
			R r = function.apply(input);
			if (r != null) {
				result.add(r);
				return false;
			} else {
				return true;
			}
		}
	};
	trace(pda, Collections.singleton(pda.getStart()), stack, matches, canPass);
	return result;
}
 
Example 3
Source File: BlueTestResultContainerImpl.java    From blueocean-plugin with MIT License 6 votes vote down vote up
@VisibleForTesting
public static Predicate<BlueTestResult> filterByStatus(String status) {
    String[] statusAtoms = StringUtils.split(status, ',');
    Predicate<BlueTestResult> predicate = Predicates.alwaysFalse();
    if (statusAtoms == null || statusAtoms.length == 0) {
        throw new BadRequestException("status not provided");
    }
    for (String statusString : statusAtoms) {
        Predicate<BlueTestResult> statusPredicate;
        try {
            if (statusString.startsWith("!")) {
                statusPredicate = Predicates.not(new StatusPredicate(Status.valueOf(statusString.toUpperCase().substring(1))));
            } else {
                statusPredicate  = new StatusPredicate(Status.valueOf(statusString.toUpperCase()));
            }
        } catch (IllegalArgumentException e) {
            throw new BadRequestException("bad status " + status, e);
        }
        predicate = Predicates.or(predicate, statusPredicate );
    }
    return predicate;
}
 
Example 4
Source File: SymbolicObjectsContext.java    From jdart with Apache License 2.0 5 votes vote down vote up
public static void analyzeStatic(VM vm, ClassInfo ci) {
  SymbolicObjectsContext ctx = new SymbolicObjectsContext(vm.getHeap(), Predicates.alwaysFalse(), Predicates.alwaysFalse(), Predicates.alwaysFalse());
  FieldInfo[] fis = ci.getDeclaredStaticFields();
  ElementInfo sei = ci.getStaticElementInfo();
  for(FieldInfo fi : fis) {
    if(isSymbolicField(fi)) {
      String fqn = ci.getName() + "." + fi.getName();
      ctx.processField(sei, fi, fqn);
    }
  }
  
  globalSymbolics.putAll(ctx.symbolicVars);
}
 
Example 5
Source File: TestForEachModelAction.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@Test
public void testNoMatchingModels() {
   EasyMock.replay(mockAction);
   
   ForEachModelAction selector = new ForEachModelAction(mockAction, Predicates.<Model>alwaysTrue(), Predicates.<Model>alwaysFalse(), "address");
   selector.execute(context);
   
   EasyMock.verify(mockAction);
}
 
Example 6
Source File: TestForEachModelAction.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@Test
public void testNoMatchingModels() {
   EasyMock.replay(mockAction);
   
   ForEachModelAction selector = new ForEachModelAction(mockAction, Predicates.<Model>alwaysFalse(), "address");
   selector.execute(context);
   
   EasyMock.verify(mockAction);
}
 
Example 7
Source File: TestDefaultHubMessageFilterImpl.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@Override
@Before
public void setUp() throws Exception {
   super.setUp();
   clientSession = new HubSession(null, null, new BridgeMetrics("test"), clientToken);
   authorizer = new DefaultHubMessageFilterImpl(
      Predicates.alwaysFalse(),
      Predicates.alwaysFalse(),
      new PlatformBusServiceImpl(ServiceLocator.getInstance(PlatformMessageBus.class), new BridgeMetrics("hub"), Collections.emptySet())
   );
}
 
Example 8
Source File: AbstractSemanticRegionsFinder.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
protected Predicate<ISemanticRegion> createPredicate(AbstractElement... ele) {
	Set<AbstractElement> result = Sets.newHashSet();
	for (AbstractElement e : ele)
		collectMatchableElements(e, result);
	switch (result.size()) {
		case 0:
			return Predicates.alwaysFalse();
		case 1:
			return new GrammarElementPredicate(result.iterator().next());
		default:
			return new GrammarElementsPredicate(result);
	}
}
 
Example 9
Source File: SymbolicObjectsContext.java    From jdart with Apache License 2.0 5 votes vote down vote up
public static void analyzeNewInstance(ThreadInfo ti, ElementInfo ei) {
  SymbolicObjectsContext ctx = new SymbolicObjectsContext(ti.getHeap(), Predicates.alwaysFalse(), Predicates.alwaysFalse(), Predicates.alwaysFalse());
  ClassInfo ci = ei.getClassInfo();
  FieldInfo[] fis = ci.getDeclaredInstanceFields();
  for(FieldInfo fi : fis) {
    if(isSymbolicField(fi)) {
      String fqn = ci.getName() + "." + fi.getName();
      ctx.processField(ei, fi, fqn);
    }
  }
  globalSymbolics.putAll(ctx.symbolicVars);
}
 
Example 10
Source File: DumpUtils.java    From android-test with Apache License 2.0 5 votes vote down vote up
private static Predicate<MethodData> runnerFilter(TestRelatedClassData testData) {
  boolean hasRunWith =
      FluentIterable.from(testData.aggregatedClassAnnotations.get())
          .anyMatch(HAS_RUN_WITH_ANNOTATION);
  if (hasRunWith) {
    return IS_J4_TEST_METHOD;
  }
  if (testData.descendsFromJUnit3TestCase) {
    return IS_J3_TEST_METHOD;
  }
  return Predicates.<MethodData>alwaysFalse();
}
 
Example 11
Source File: DynamicGroupImpl.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
/**
 * @return
 *      The filter configured in {@link #ENTITY_FILTER} ANDed with a check that the
 *      entity has the same application ID.
 */
protected Predicate<? super Entity> getEntityFilter() {
    Predicate<? super Entity> entityFilter = getConfig(ENTITY_FILTER);
    if (entityFilter == null) {
        entityFilter = Predicates.alwaysFalse();
    }
    return Predicates.and(
            EntityPredicates.applicationIdEqualTo(getApplicationId()),
            entityFilter);
}
 
Example 12
Source File: GrpcClient.java    From etcd-java with Apache License 2.0 4 votes vote down vote up
protected static <T> Predicate<T> constantPredicate(boolean val) {
    return val ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
}
 
Example 13
Source File: LocatePossibleAssessmentMistakes.java    From tac-kbp-eal with MIT License 4 votes vote down vote up
@Override
public Predicate<Response> unassessedFilter() {
  return Predicates.alwaysFalse();
}
 
Example 14
Source File: ErrorToken.java    From jetpad-projectional-open-source with Apache License 2.0 4 votes vote down vote up
@Override
public Predicate<String> getValidator() {
  return Predicates.alwaysFalse();
}
 
Example 15
Source File: LanguageResourcesSplitter.java    From bundletool with Apache License 2.0 4 votes vote down vote up
public LanguageResourcesSplitter() {
  this(/* pinResourceToMaster= */ Predicates.alwaysFalse());
}
 
Example 16
Source File: EtcdClient.java    From etcd-java with Apache License 2.0 4 votes vote down vote up
protected static <T> Predicate<T> constantPredicate(boolean val) {
    return val ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
}
 
Example 17
Source File: LocatePossibleAssessmentMistakes.java    From tac-kbp-eal with MIT License 4 votes vote down vote up
@Override
public Predicate<Response> unassessedFilter() {
  return Predicates.alwaysFalse();
}
 
Example 18
Source File: LinkableResponseFilter2015ForGold.java    From tac-kbp-eal with MIT License 4 votes vote down vote up
@Override
public Predicate<Response> unassessedFilter() {
  // unassessed answers cannot be linked
  return Predicates.alwaysFalse();
}
 
Example 19
Source File: HubServerModule.java    From arcusplatform with Apache License 2.0 4 votes vote down vote up
@Provides
@Named(DefaultHubMessageFilterImpl.ADMIN_ONLY_MESSAGES_PROP)
@Singleton
public Predicate<String> getHubAdminOnlyMessages(@Named("hub.bridge.admin.only.messages") String adminOnlyMessages) {
    List<Predicate<String>> components = new ArrayList<>();

    for (String msg : Splitter.on(',').omitEmptyStrings().trimResults().split(adminOnlyMessages)) {
        List<String> parts = Splitter.on(':').splitToList(msg);
        switch (parts.size()) {
            case 2:
                if (parts.get(1).isEmpty() || "*".equals(parts.get(1))) {
                    final String capMatch = parts.get(0) + ":";
                    log.warn("adding all commands to admin only list: {}", parts.get(0));
                    components.add(new Predicate<String>() {
                        @Override
                        public boolean apply(String msgType) {
                            return msgType != null && msgType.startsWith(capMatch);
                        }
                    });
                } else {
                    log.warn("adding command to admin only list: {}", msg);
                    components.add(Predicates.equalTo(msg));
                }
                break;

            default:
                log.warn("adding non-conforming command to admin only list: {}", msg);
                components.add(Predicates.equalTo(msg));
                break;
        }

    }

    switch (components.size()) {
        case 0:
            return Predicates.alwaysFalse();

        case 1:
            return components.get(0);

        default:
            return Predicates.or(components);
    }
}
 
Example 20
Source File: LocatePossibleAssessmentMistakes.java    From tac-kbp-eal with MIT License 4 votes vote down vote up
@Override
public Predicate<Response> unassessedFilter() {
  return Predicates.alwaysFalse();
}