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

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

Introduction

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

Prototype

public static <T> Predicate<T> not(Predicate<T> predicate) 

Source Link

Document

Returns a predicate that evaluates to true if the given predicate evaluates to false .

Usage

From source file:org.eclipse.sirius.diagram.ui.tools.internal.figure.locator.FeedbackDBorderItemLocator.java

@Override
protected List<IFigure> getBrotherFigures(IFigure targetBorderItem) {
    IFigure parentFigure = getParentFigure();
    if (parentFigure instanceof BorderedNodeFigure) {
        parentFigure = ((BorderedNodeFigure) parentFigure).getBorderItemContainer();
    }/*from ww  w .j a  va  2s.  c  o m*/
    @SuppressWarnings("unchecked")
    Iterable<IFigure> brotherFigures = Iterables.filter(parentFigure.getChildren(), Predicates
            .and(Predicates.instanceOf(IFigure.class), Predicates.not(Predicates.equalTo(targetBorderItem))));
    return Lists.newArrayList(brotherFigures);
}

From source file:ratpack.render.RenderableDecoratorSupport.java

protected RenderableDecoratorSupport() {
    TypeToken<T> typeToken = new TypeToken<T>(getClass()) {
    };//from ww w. j a va  2  s .  c  om

    Type type = typeToken.getType();
    if (type instanceof Class) {
        this.type = Types.cast(typeToken.getRawType());
    } else if (type instanceof ParameterizedType) {
        Iterable<Type> typeArgs = Arrays.asList(((ParameterizedType) type).getActualTypeArguments());
        if (Iterables.any(typeArgs, Predicates.not((t) -> t.getTypeName().equals("?")))) {
            throw new IllegalArgumentException("Invalid renderable type " + type
                    + ": due to type erasure, type parameter T of RenderableDecorator must be a Class or a parameterized type with '?' for all type variables (e.g. List<?>)");
        }
        this.type = Types.cast(typeToken.getRawType());
    } else {
        throw new InternalRatpackError("Unhandled type for RenderableDecorator: " + type.getClass());
    }
}

From source file:org.jclouds.atmos.functions.ParseUserMetadataFromHeaders.java

public UserMetadata apply(HttpResponse from) {
    checkNotNull(from, "http response");

    Map<String, String> meta = Maps.filterKeys(
            getMetaMap(checkNotNull(from.getFirstHeaderOrNull(AtmosHeaders.META), AtmosHeaders.META)),
            Predicates.not(Predicates.in(SYS_KEYS)));

    Map<String, String> listableMeta = (from.getFirstHeaderOrNull(AtmosHeaders.LISTABLE_META) != null)
            ? getMetaMap(from.getFirstHeaderOrNull(AtmosHeaders.LISTABLE_META))
            : ImmutableMap.<String, String>of();

    Iterable<String> tags = (from.getFirstHeaderOrNull(AtmosHeaders.TAGS) != null)
            ? Splitter.on(", ").split(from.getFirstHeaderOrNull(AtmosHeaders.TAGS))
            : ImmutableSet.<String>of();

    Iterable<String> listableTags = (from.getFirstHeaderOrNull(AtmosHeaders.LISTABLE_TAGS) != null)
            ? Splitter.on(", ").split(from.getFirstHeaderOrNull(AtmosHeaders.LISTABLE_TAGS))
            : ImmutableSet.<String>of();

    return new UserMetadata(meta, listableMeta, tags, listableTags);
}

From source file:net.automatalib.util.automata.transout.MealyFilter.java

/**
 * Returns a Mealy machine with all transitions removed that have one of the specified output values. The resulting
 * Mealy machine will not contain any unreachable states.
 * //from   w ww. j  ava 2s  . c  o m
 * @param in the input Mealy machine
 * @param inputs the input alphabet
 * @param outputs the outputs to remove
 * @return a Mealy machine with all transitions removed that have one of the specified outputs.
 */
public static <I, O> CompactMealy<I, O> pruneTransitionsWithOutput(MealyMachine<?, I, ?, O> in,
        Alphabet<I> inputs, Collection<? super O> outputs) {
    return filterByOutput(in, inputs, Predicates.not(Predicates.in(outputs)));
}

From source file:yatodo.Config.SwaggerConfig.java

@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any())
            .apis(Predicates.not(RequestHandlerSelectors.basePackage("org.springframework.boot")))
            .paths(PathSelectors.any()).build().apiInfo(apiInfo());
}

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

public static Iterable<XdmNode> childNodesNoAttributes(final XdmNode node) {
    return Iterables.filter(childNodes(node), Predicates.not(SaxonPredicates.isAttribute()));
}

From source file:org.apache.abdera2.common.misc.MorePredicates.java

/**
 * Returns a Predicate that checks if the named property of instances of
 * the specified class are not null. The named property MUST NOT be private 
 * and MUST NOT require any input parameters. The method name is case
 * sensitive. //from  www . j a  v  a  2s. c  o m
 */
public static <T> Selector<T> isNotNull(Class<T> _class, String method) {
    return PropertySelector.<T>create(_class, method, Predicates.not(Predicates.isNull()));
}

From source file:io.druid.sql.calcite.planner.AggregateValuesRule.java

private AggregateValuesRule() {
    super(operand(Aggregate.class, null, Predicates.not(Aggregate.IS_NOT_GRAND_TOTAL),
            operand(Values.class, null, Values.IS_EMPTY, none())));
}

From source file:app.direct.api.config.swagger.SwaggerConfiguration.java

/**
 * @return the predicate used to check if the path should be included or not.
 *//*from w  ww  .j  a va2 s. co m*/
private Predicate<String> paths() {
    return Predicates.not(PathSelectors.regex("/error.*"));
}

From source file:brooklyn.location.docker.strategy.GroupPlacementStrategy.java

@Override
public boolean apply(DockerHostLocation input) {
    boolean requireExclusive = config().get(REQUIRE_EXCLUSIVE);
    String dockerApplicationId = input.getOwner().getApplicationId();
    Iterable<Entity> deployed = Iterables.filter(input.getDockerContainerList(),
            Predicates.not(EntityPredicates.applicationIdEqualTo(dockerApplicationId)));
    Entity parent = entity.getParent();
    String applicationId = entity.getApplicationId();
    Iterable<Entity> sameApplication = Iterables.filter(deployed,
            EntityPredicates.applicationIdEqualTo(applicationId));
    if (requireExclusive && Iterables.size(deployed) > Iterables.size(sameApplication)) {
        LOG.debug("Found entities not in {}; required exclusive. Reject: {}", applicationId, input);
        return false;
    }//from w  w w  . java  2  s .  c o  m
    if (Iterables.isEmpty(sameApplication)) {
        LOG.debug("No entities present from {}. Accept: {}", applicationId, input);
        return true;
    } else {
        Iterable<Entity> sameParent = Iterables.filter(sameApplication, EntityPredicates.isChildOf(parent));
        if (Iterables.isEmpty(sameParent)) {
            LOG.debug("All entities from {} have different parent. Reject: {}", applicationId, input);
            return false;
        } else {
            LOG.debug("All entities from {} have same parent. Accept: {}", applicationId, input);
            return true;
        }
    }
}