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:com.adama.api.config.apidoc.SwaggerConfiguration.java

/**
 * Swagger Springfox configuration./*from  w  w w  . ja  va 2s  .  c o  m*/
 *
 * @param adamaProperties
 *            the properties of the application
 * @return the Swagger Springfox configuration
 */
@Bean
public Docket swaggerSpringfoxDocket(AdamaProperties adamaProperties) {
    log.debug("Starting Swagger");
    StopWatch watch = new StopWatch();
    watch.start();
    Contact contact = new Contact(adamaProperties.getSwagger().getContactName(),
            adamaProperties.getSwagger().getContactUrl(), adamaProperties.getSwagger().getContactEmail());
    ApiInfo apiInfo = new ApiInfo(adamaProperties.getSwagger().getTitle(),
            adamaProperties.getSwagger().getDescription(), adamaProperties.getSwagger().getVersion(),
            adamaProperties.getSwagger().getTermsOfServiceUrl(), contact,
            adamaProperties.getSwagger().getLicense(), adamaProperties.getSwagger().getLicenseUrl());
    Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo).forCodeGeneration(true)
            .genericModelSubstitutes(ResponseEntity.class).ignoredParameterTypes(Pageable.class)
            .useDefaultResponseMessages(false).directModelSubstitute(java.time.ZonedDateTime.class, Date.class)
            .directModelSubstitute(java.time.LocalDateTime.class, Date.class).select()
            .apis(Predicates.not(RequestHandlerSelectors.basePackage("org.springframework.boot")))
            .paths(regex("/.*")).build();
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());
    return docket;
}

From source file:org.eclipse.mylyn.internal.wikitext.commonmark.blocks.FencedCodeBlock.java

@Override
public void process(ProcessingContext context, DocumentBuilder builder, LineSequence lineSequence) {
    Matcher matcher = openingFencePattern.matcher(lineSequence.getCurrentLine().getText());
    checkState(matcher.matches());/*from w w w .  java  2s. c  om*/
    String indent = matcher.group(1);
    boolean indentedCodeBlock = indent != null && indent.length() == 4;
    Pattern closingFencePattern = closingFencePattern(matcher);

    Attributes codeAttributes = new Attributes();
    addInfoTextCssClass(codeAttributes, matcher);

    builder.setLocator(lineSequence.getCurrentLine().toLocator());
    builder.beginBlock(BlockType.CODE, codeAttributes);

    if (indentedCodeBlock) {
        outputLine(builder, indent, lineSequence.getCurrentLine());
    }
    lineSequence.advance();
    for (Line line : lineSequence.with(Predicates.not(LinePredicates.matches(closingFencePattern)))) {
        outputLine(builder, indent, line);
    }
    if (indentedCodeBlock && lineSequence.getCurrentLine() != null) {
        outputLine(builder, indent, lineSequence.getCurrentLine());
    }
    lineSequence.advance();

    builder.endBlock();
}

From source file:com.wavemaker.tools.apidocs.tools.parser.scanner.FilterableScanner.java

public FilterableScanner excludeType(Class type) {
    Objects.requireNonNull(type, "Exclude type cannot be null");
    add(Predicates.not(getEqualClassPredicate(type.getName())));
    return this;
}

From source file:org.eclipse.sirius.ext.emf.EClassQuery.java

/**
 * Returns all the non-containment features of the queried {@link EClass}.
 * /*  ww  w  .  j  a  v  a  2 s .  c  om*/
 * @return all the non-containment features of the {@link EClass}.
 */
public Collection<EStructuralFeature> getAllNonContainmentFeatures() {
    return ImmutableList.copyOf(
            Iterables.filter(eClass.getEAllStructuralFeatures(), Predicates.not(new IsContaintmentFeature())));
}

From source file:org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.validator.InstanceRoleMoveValidator.java

/**
 * {@inheritDoc}// w ww .  j ava 2s  . com
 */
@Override
public boolean isValid(ChangeBoundsRequest request) {
    boolean valid = super.isValid(request);

    if (instanceRoles.size() != 0) {
        SequenceDiagram sequenceDiagram = instanceRoles.get(0).getDiagram();
        List<InstanceRole> allInstanceRoles = sequenceDiagram.getSortedInstanceRole();

        RequestQuery query = new RequestQuery(request);
        Point moveDelta = query.getLogicalDelta().getLocation();

        Collections.sort(instanceRoles, comparator);

        // if move request is constrained then it's a explicit user move
        // request
        // otherwise it's a indirect request from ConnectionCreationTool for
        // a
        // Create Message for example
        if (!request.isConstrainedMove()) {
            moveDelta.y = 0;
        }

        Iterable<Rectangle> notMovedIRBounds = Iterables.transform(
                Iterables.filter(allInstanceRoles, Predicates.not(Predicates.in(instanceRoles))),
                ISequenceElement.PROPER_LOGICAL_BOUNDS);

        // Iterate on all instanceRoles to move from the request
        for (InstanceRole instanceRole : instanceRoles) {
            moveDeltas.put(instanceRole, moveDelta.getCopy());

            Rectangle boundBeforeResizing = instanceRole.getBounds();
            Rectangle boundAfterResizing = boundBeforeResizing.getTranslated(moveDelta);

            for (Rectangle notMovedBounds : notMovedIRBounds) {
                int nmbLeftX = notMovedBounds.getLeft().x;
                int nmbRightX = notMovedBounds.getRight().x;
                int mLeftX = boundAfterResizing.getLeft().x;
                boolean leftOverlapFixIR = nmbLeftX <= mLeftX && mLeftX <= nmbRightX;

                if (leftOverlapFixIR) {
                    valid = false;
                    break;
                }
            }
        }
    }
    return valid;
}

From source file:org.apache.cassandra.cql3.statements.SchemaAlteringStatement.java

private static Map<String, List<String>> describeSchemaVersions() {
    // unreachable hosts don't count towards disagreement
    return Maps.filterKeys(StorageProxy.describeSchemaVersions(),
            Predicates.not(Predicates.equalTo(StorageProxy.UNREACHABLE)));
}

From source file:com.github.kgrech.statcollectior.server.config.SwaggerConfig.java

/**
 * @return path filtering predicates
 */
private Predicate<String> paths() {
    return Predicates.not(PathSelectors.regex("/error"));
}

From source file:brooklyn.location.geo.LocalhostExternalIpLoader.java

@VisibleForTesting
static List<String> getIpAddressWebsites() {
    String file = new ResourceUtils(LocalhostExternalIpLoader.class)
            .getResourceAsString("classpath://brooklyn/location/geo/external-ip-address-resolvers.txt");
    Iterable<String> lines = Splitter.on('\n').omitEmptyStrings().trimResults().split(file);
    List<String> urls = Lists
            .newArrayList(Iterables.filter(lines, Predicates.not(StringPredicates.startsWith("#"))));
    Collections.shuffle(urls);//from w ww  . ja  v  a 2  s .  c  o m
    return urls;
}

From source file:org.apache.gobblin.data.management.retention.policy.PredicateRetentionPolicy.java

@Override
public Collection<DatasetVersion> listDeletableVersions(List<DatasetVersion> allVersions) {
    return Lists.newArrayList(Iterables.filter(allVersions, Predicates.not(this.predicate)));
}

From source file:br.com.objectos.way.core.code.jdt.CompilationUnitWriter.java

public CodeCanvasArtifact toCodeCanvasArtifact() {
    List<ImportDeclaration> importDeclarationList = WayIterables.from(typeDeclarationWriter.toImportInfoSet())
            .when(packageInfo != null).filter(new NotSamePackage())
            .filter(Predicates.not(ImportInfoIsJavaLang.INSTANCE))
            .transform(new ImportInfoJdtToImportDeclaration(ast)).toImmutableList();

    compilationUnit.imports().addAll(importDeclarationList);

    return new CodeCanvasArtifactBuilder().build();
}