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

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

Introduction

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

Prototype

public static <A, B> Predicate<A> compose(Predicate<B> predicate, Function<A, ? extends B> function) 

Source Link

Document

Returns the composition of a function and a predicate.

Usage

From source file:org.trancecode.xproc.step.StepPredicates.java

public static Predicate<Step> hasName(final String name) {
    return Predicates.compose(Predicates.equalTo(name), StepFunctions.getName());
}

From source file:io.ytcode.reflect.util.Utils.java

public static Predicate<Resource> predicateResourceNameSuffix(final String suffix) {
    return Predicates.compose(new Predicate<String>() {
        @Override//  www  .j ava 2s .  com
        public boolean apply(String s) {
            return s.endsWith(suffix);
        }
    }, new Function<Resource, String>() {
        @Override
        public String apply(Resource r) {
            return r.name();
        }
    });
}

From source file:com.samskivert.depot.impl.operator.BaseOperator.java

public static <S, T> boolean all(Function<S, T> fun, S... obj) {
    return Iterables.all(Arrays.asList(obj), Predicates.compose(Predicates.isNull(), fun));
}

From source file:io.ytcode.reflect.util.Utils.java

public static Predicate<Resource> predicateResourceNamePattern(String pattern) {
    return Predicates.compose(Predicates.containsPattern(pattern), new Function<Resource, String>() {
        @Override// www . j  av  a  2s. c om
        public String apply(Resource r) {
            return r.name();
        }
    });
}

From source file:com.complexible.common.openrdf.model.Statements.java

public static Predicate<Statement> subjectIs(final Resource theSubj) {
    return Predicates.compose(Predicates.equalTo(theSubj), subject());
}

From source file:org.trancecode.xml.saxon.SaxonPredicates.java

public static Predicate<XdmNode> hasNodeKind(final Iterable<XdmNodeKind> nodeKinds) {
    return Predicates.compose(TcPredicates.isContainedBy(ImmutableSet.copyOf(nodeKinds)),
            SaxonFunctions.getNodeKind());
}

From source file:com.complexible.common.openrdf.model.Statements.java

public static Predicate<Statement> predicateIs(final URI thePred) {
    return Predicates.compose(Predicates.equalTo(thePred), predicate());
}

From source file:com.complexible.common.openrdf.model.Statements.java

public static Predicate<Statement> objectIs(final Value theObj) {
    return Predicates.compose(Predicates.equalTo(theObj), object());
}

From source file:com.complexible.common.openrdf.model.Statements.java

public static Predicate<Statement> contextIs(final Resource theContext) {
    return Predicates.compose(Predicates.equalTo(theContext), context());
}

From source file:org.trancecode.xml.saxon.SaxonAxis.java

public static Iterable<XdmNode> childElements(final XdmNode node, final Collection<QName> elementNames) {
    return Iterables.filter(childElements(node),
            Predicates.compose(TcPredicates.matches(elementNames), SaxonFunctions.getNodeName()));
}