Example usage for com.google.common.base Predicates alwaysFalse

List of usage examples for com.google.common.base Predicates alwaysFalse

Introduction

In this page you can find the example usage for com.google.common.base Predicates alwaysFalse.

Prototype

@GwtCompatible(serializable = true)
public static <T> Predicate<T> alwaysFalse() 

Source Link

Document

Returns a predicate that always evaluates to false .

Usage

From source file:org.eclipse.sirius.diagram.sequence.business.internal.util.EventFinder.java

/**
 * Returns a predicate which tests whether an element should be ignored in
 * the search for descendants./* w w w .  java  2s  . com*/
 */
private Predicate<ISequenceEvent> shouldIgnore() {
    if (eventsToIgnore == null) {
        return Predicates.alwaysFalse();
    } else {
        return eventsToIgnore;
    }
}

From source file:org.sosy_lab.cpachecker.cpa.arg.ARGStatistics.java

private void exportARG(final ARGState rootState, final Predicate<Pair<ARGState, ARGState>> isTargetPathEdge) {
    SetMultimap<ARGState, ARGState> relevantSuccessorRelation = ARGUtils.projectARG(rootState,
            ARGUtils.CHILDREN_OF_STATE, ARGUtils.RELEVANT_STATE);
    Function<ARGState, Collection<ARGState>> relevantSuccessorFunction = Functions
            .forMap(relevantSuccessorRelation.asMap(), ImmutableSet.<ARGState>of());

    if (argFile != null) {
        try (Writer w = Files.openOutputFile(argFile)) {
            ARGToDotWriter.write(w, rootState, ARGUtils.CHILDREN_OF_STATE, Predicates.alwaysTrue(),
                    isTargetPathEdge);/*from w  w  w  .j  a  va 2  s .  c  o  m*/
        } catch (IOException e) {
            cpa.getLogger().logUserException(Level.WARNING, e, "Could not write ARG to file");
        }
    }

    if (simplifiedArgFile != null) {
        try (Writer w = Files.openOutputFile(simplifiedArgFile)) {
            ARGToDotWriter.write(w, rootState, relevantSuccessorFunction, Predicates.alwaysTrue(),
                    Predicates.alwaysFalse());
        } catch (IOException e) {
            cpa.getLogger().logUserException(Level.WARNING, e, "Could not write ARG to file");
        }
    }

    assert (refinementGraphUnderlyingWriter == null) == (refinementGraphWriter == null);
    if (refinementGraphUnderlyingWriter != null) {
        try (Writer w = refinementGraphUnderlyingWriter) { // for auto-closing
            refinementGraphWriter.writeSubgraph(rootState, relevantSuccessorFunction, Predicates.alwaysTrue(),
                    Predicates.alwaysFalse());
            refinementGraphWriter.finish();

        } catch (IOException e) {
            cpa.getLogger().logUserException(Level.WARNING, e, "Could not write refinement graph to file");
        }
    }
}

From source file:io.github.karols.hocr4j.LineThat.java

/**
 * Returns a predicate that tests if a line
 * is in the same column as the header and below it,
 * and also satisfies the inner predicate.
 *
 * @param header bounds of the column header
 * @param also   inner predicate/*from   w  w w.  jav a 2s.  c  o m*/
 * @return predicate
 */
public static Predicate<Line> isBelowInTheSameColumnAndAlso(Bounded header, final Predicate<Line> also) {
    final Bounds headerBounds = header.getBounds();
    if (headerBounds == null || also == null) {
        return Predicates.alwaysFalse();
    }
    return new Predicate<Line>() {
        @Override
        public boolean apply(@Nullable Line line) {
            if (line == null)
                return false;
            Bounds bounds = line.bounds;
            if (bounds == null)
                return false;
            return bounds.inTheSameColumnAs(headerBounds) && bounds.isBelow(headerBounds) && also.apply(line);
        }
    };
}

From source file:org.basepom.mojo.duplicatefinder.classpath.ClasspathDescriptor.java

private ClasspathDescriptor(final boolean useDefaultResourceIgnoreList,
        final Collection<String> ignoredResourcePatterns, final boolean useDefaultClassIgnoreList,
        final Collection<String> ignoredClassPatterns) throws MojoExecutionException {
    final ImmutableList.Builder<Pattern> ignoredResourcePatternsBuilder = ImmutableList.builder();

    // build resource predicate...
    Predicate<String> resourcesPredicate = Predicates.alwaysFalse();

    // predicate matching the default ignores
    if (useDefaultResourceIgnoreList) {
        resourcesPredicate = Predicates.or(resourcesPredicate, DEFAULT_IGNORED_RESOURCES_PREDICATE);
        ignoredResourcePatternsBuilder.addAll(DEFAULT_IGNORED_RESOURCES_PREDICATE.getPatterns());
    }//from   ww w .jav  a  2 s .c  om

    if (!ignoredResourcePatterns.isEmpty()) {
        try {
            // predicate matching the user ignores
            MatchPatternPredicate ignoredResourcesPredicate = new MatchPatternPredicate(
                    ignoredResourcePatterns);
            resourcesPredicate = Predicates.or(resourcesPredicate, ignoredResourcesPredicate);
            ignoredResourcePatternsBuilder.addAll(ignoredResourcesPredicate.getPatterns());
        } catch (final PatternSyntaxException pse) {
            throw new MojoExecutionException("Error compiling resourceIgnore pattern: " + pse.getMessage());
        }
    }

    this.resourcesPredicate = resourcesPredicate;
    this.ignoredResourcePatterns = ignoredResourcePatternsBuilder.build();

    final ImmutableList.Builder<Pattern> ignoredClassPatternsBuilder = ImmutableList.builder();

    // build class predicate.
    Predicate<String> classPredicate = Predicates.alwaysFalse();

    // predicate matching the default ignores
    if (useDefaultClassIgnoreList) {
        classPredicate = Predicates.or(classPredicate, DEFAULT_IGNORED_CLASS_PREDICATE);
        ignoredClassPatternsBuilder.addAll(DEFAULT_IGNORED_CLASS_PREDICATE.getPatterns());
    }

    if (!ignoredClassPatterns.isEmpty()) {
        try {
            // predicate matching the user ignores
            MatchPatternPredicate ignoredPackagePredicate = new MatchPatternPredicate(ignoredClassPatterns);
            classPredicate = Predicates.or(classPredicate, ignoredPackagePredicate);
            ignoredClassPatternsBuilder.addAll(ignoredPackagePredicate.getPatterns());
        } catch (final PatternSyntaxException pse) {
            throw new MojoExecutionException("Error compiling classIgnore pattern: " + pse.getMessage());
        }
    }

    this.classPredicate = classPredicate;
    this.ignoredClassPatterns = ignoredClassPatternsBuilder.build();
}

From source file:io.github.karols.hocr4j.LineThat.java

/**
 * Returns a predicate that tests if a line
 * is in the same row as the header and to the right of it,
 * and also satisfies the inner predicate.
 *
 * @param header bounds of the row header
 * @param also   inner predicate//from   ww  w  .ja v a 2s .  c  o m
 * @return predicate
 */
public static Predicate<Line> isRightInTheSameRowAndAlso(Bounded header, final Predicate<Line> also) {
    final Bounds headerBounds = header.getBounds();
    if (headerBounds == null || also == null) {
        return Predicates.alwaysFalse();
    }
    return new Predicate<Line>() {
        @Override
        public boolean apply(@Nullable Line line) {
            if (line == null)
                return false;
            Bounds bounds = line.bounds;
            if (bounds == null)
                return false;
            return bounds.inTheSameRowAs(headerBounds) && bounds.isToTheRight(headerBounds) && also.apply(line);
        }
    };
}

From source file:net.shibboleth.idp.attribute.resolver.AbstractResolverPlugin.java

/** {@inheritDoc} */
@Override//from www  .  ja  v a  2  s .  c om
protected void doDestroy() {
    activationCondition = Predicates.alwaysFalse();
    dependencies = Collections.emptySet();

    super.doDestroy();
}

From source file:org.eclipse.xtext.formatting2.regionaccess.internal.AbstractSemanticRegionsFinder.java

protected Predicate<ISemanticRegion> createPredicate(AbstractElement... ele) {
    Set<AbstractElement> result = Sets.newHashSet();
    for (AbstractElement e : ele)
        collectMatchableElements(e, result);
    switch (result.size()) {
    case 0://  www.  j a v a  2s.  c o  m
        return Predicates.alwaysFalse();
    case 1:
        return new GrammarElementPredicate(result.iterator().next());
    default:
        return new GrammarElementsPredicate(result);
    }
}

From source file:edu.buaa.satla.analysis.core.arg.ARGUtils.java

/**
 * Writes the ARG with the root state pRootState to pSb as a graphviz dot file
 *
 *///from ww w  .j  a v a 2s . c  o m
public static void writeARGAsDot(Appendable pSb, ARGState pRootState) throws IOException {
    ARGToDotWriter.write(pSb, pRootState, ARGUtils.CHILDREN_OF_STATE, Predicates.alwaysTrue(),
            Predicates.alwaysFalse());
}

From source file:edu.buaa.satla.analysis.core.arg.ARGReachedSet.java

private void dumpSubgraph(ARGState e) {
    if (cpa == null) {
        return;/*from   ww w.  ja va  2 s  .  c o m*/
    }

    ARGToDotWriter refinementGraph = cpa.getRefinementGraphWriter();
    if (refinementGraph == null) {
        return;
    }

    SetMultimap<ARGState, ARGState> successors = ARGUtils.projectARG(e, ARGUtils.CHILDREN_OF_STATE,
            ARGUtils.RELEVANT_STATE);

    SetMultimap<ARGState, ARGState> predecessors = ARGUtils.projectARG(e, ARGUtils.PARENTS_OF_STATE,
            ARGUtils.RELEVANT_STATE);

    try {
        refinementGraph.enterSubgraph("cluster_" + refinementNumber, "Refinement " + refinementNumber);

        refinementGraph.writeSubgraph(e, Functions.forMap(successors.asMap(), ImmutableSet.<ARGState>of()),
                Predicates.alwaysTrue(), Predicates.alwaysFalse());

        refinementGraph.leaveSubgraph();

        for (ARGState predecessor : predecessors.get(e)) {
            // insert edge from predecessor to e in global graph
            refinementGraph.writeEdge(predecessor, e);
        }

    } catch (IOException ex) {
        cpa.getLogger().logUserException(Level.WARNING, ex, "Could not write refinement graph to file");
    }

}

From source file:com.isotrol.impe3.palette.menu.category.CategoryComponent.java

private Predicate<Category> calculateSelected() {
    Category c = getSelected();/*from  w ww.j  ava 2 s .c om*/
    if (c == null || !categories.containsValue(c)) {
        return Predicates.alwaysFalse();
    }
    if (config != null && config.selectParents()) {
        Set<Category> selected = Sets.newHashSet();
        do {
            selected.add(c);
            c = categories.getParent(c.getId());
        } while (c != null);
        return Predicates.in(selected);
    }
    return Predicates.equalTo(c);
}