Example usage for com.google.common.collect ImmutableSet isEmpty

List of usage examples for com.google.common.collect ImmutableSet isEmpty

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableSet isEmpty.

Prototype

boolean isEmpty();

Source Link

Document

Returns true if this set contains no elements.

Usage

From source file:dagger.internal.codegen.ComponentCreatorValidator.java

private void validateFactoryMethodReturnType(ValidationReport.Builder<TypeElement> builder,
        TypeElement componentElement, ComponentCreatorMessages msgs, ExecutableElement method,
        TypeMirror returnType) {/* w w w  .j  a v  a  2  s  .c o  m*/
    if (types.isSameType(componentElement.asType(), returnType)) {
        return;
    }
    ImmutableSet<ExecutableElement> methodsOnlyInComponent = methodsOnlyInComponent(componentElement);
    if (!methodsOnlyInComponent.isEmpty()) {
        builder.addWarning(msgs.buildMethodReturnsSupertypeWithMissingMethods(componentElement,
                builder.getSubject(), returnType, method, methodsOnlyInComponent), method);
    }
}

From source file:dagger.internal.codegen.BuilderValidator.java

private void validateBuildMethodReturnType(ValidationReport.Builder<TypeElement> builder,
        TypeElement componentElement, ComponentBuilderMessages msgs, ExecutableElement method,
        TypeMirror returnType) {/*from   w  w w. jav a 2  s  . co  m*/
    if (types.isSameType(componentElement.asType(), returnType)) {
        return;
    }
    ImmutableSet<ExecutableElement> methodsOnlyInComponent = methodsOnlyInComponent(componentElement);
    if (!methodsOnlyInComponent.isEmpty()) {
        builder.addWarning(msgs.buildMethodReturnsSupertypeWithMissingMethods(componentElement,
                builder.getSubject(), returnType, method, methodsOnlyInComponent), method);
    }
}

From source file:com.intelligentsia.dowsers.entity.view.processor.Projection.java

/**
 * Build a new instance of Projection.//from www.  j  ava2  s  . c  o m
 * 
 * @param processor
 *            {@link Processor} instance
 * @param attributeNames
 *            set of attribute name
 * @throws NullPointerException
 *             if one of parameters is null
 * @throws IllegalStateException
 *             if no output attribute was specified
 */
public Projection(final Processor processor, final ImmutableSet<String> attributeNames)
        throws NullPointerException, IllegalStateException {
    super(processor);
    this.attributeNames = Preconditions.checkNotNull(attributeNames);
    Preconditions.checkState(!attributeNames.isEmpty());
    defineString();
}

From source file:com.facebook.buck.ide.intellij.model.AbstractIjModuleAndroidFacet.java

/**
 * AndroidManifest.xml can be generated when package name is known. Also, it's not generated when
 * there is exactly one manifest from targets (this manifest will be used in IntelliJ project).
 *///  www  .  j a va  2s .  c om
@Value.Lazy
public boolean hasValidAndroidManifest() {
    ImmutableSet<Path> androidManifestPaths = getManifestPaths();
    Optional<String> packageName = getPackageName();

    // This is guaranteed during target parsing and creation
    Preconditions.checkState(packageName.isPresent() || !androidManifestPaths.isEmpty());

    return androidManifestPaths.size() == 1 || (!packageName.isPresent() && androidManifestPaths.size() > 1);
}

From source file:uk.ac.york.mondo.integration.api.EffectiveMetamodelRuleset.java

public void exclude(String mmURI, String type, ImmutableSet<String> slots) {
    if (slots == null || slots.isEmpty()) {
        exclusions.remove(mmURI, type);/* ww w  .  j  a v  a2  s .  com*/
    } else {
        exclusions.put(mmURI, type, slots);
    }
}

From source file:de.metas.ui.web.pickingslotsClearing.process.WEBUI_PickingSlotsClearingView_TakeOutMultiHUsAndAddToNewHU.java

@Override
protected String doIt() throws Exception {
    final List<I_M_HU> fromHUs = getSelectedPickingSlotTopLevelHUs();

    final IAllocationSource source = HUListAllocationSourceDestination.of(fromHUs).setDestroyEmptyHUs(true);
    final IHUProducerAllocationDestination destination = createHUProducer();
    HULoader.of(source, destination).setAllowPartialUnloads(false).setAllowPartialLoads(false)
            .unloadAllFromSource();//from  w  w  w  . j  av  a  2 s  .c o m

    // If the source HU was destroyed, then "remove" it from picking slots
    final ImmutableSet<HuId> destroyedHUIds = fromHUs.stream().filter(handlingUnitsBL::isDestroyedRefreshFirst)
            .map(I_M_HU::getM_HU_ID).map(HuId::ofRepoId).collect(ImmutableSet.toImmutableSet());
    if (!destroyedHUIds.isEmpty()) {
        pickingCandidateService.inactivateForHUIds(destroyedHUIds);
    }

    return MSG_OK;
}

From source file:com.facebook.buck.cli.AuditClasspathCommand.java

@Override
int runCommandWithOptionsInternal(AuditCommandOptions options) throws IOException {
    // Create a PartialGraph that is composed of the transitive closure of all of the dependent
    // BuildRules for the specified BuildTargets.
    final ImmutableSet<String> fullyQualifiedBuildTargets = ImmutableSet
            .copyOf(options.getArgumentsFormattedAsBuildTargets());

    if (fullyQualifiedBuildTargets.isEmpty()) {
        console.printBuildFailure("Please specify at least one build target.");
        return 1;
    }//from  w  ww.j a v a 2 s  . c  o  m

    RawRulePredicate predicate = new RawRulePredicate() {
        @Override
        public boolean isMatch(Map<String, Object> rawParseData, BuildRuleType buildRuleType,
                BuildTarget buildTarget) {
            return fullyQualifiedBuildTargets.contains(buildTarget.getFullyQualifiedName());
        }
    };
    PartialGraph partialGraph;
    try {
        partialGraph = PartialGraph.createPartialGraph(predicate, getProjectFilesystem(),
                options.getDefaultIncludes(), getParser(), getBuckEventBus());
    } catch (BuildTargetException | BuildFileParseException e) {
        console.printBuildFailureWithoutStacktrace(e);
        return 1;
    }

    if (options.shouldGenerateDotOutput()) {
        return printDotOutput(partialGraph.getDependencyGraph());
    } else if (options.shouldGenerateJsonOutput()) {
        return printJsonClasspath(partialGraph);
    } else {
        return printClasspath(partialGraph);
    }
}

From source file:com.facebook.buck.cxx.CxxTestDescription.java

@Override
public boolean hasFlavors(ImmutableSet<Flavor> flavors) {

    if (flavors.isEmpty()) {
        return true;
    }//from w w w.  j a  v  a 2 s  .  c  o m

    if (flavors.contains(CxxCompilationDatabase.COMPILATION_DATABASE)) {
        return true;
    }

    if (flavors.contains(CxxCompilationDatabase.UBER_COMPILATION_DATABASE)) {
        return true;
    }

    if (StripStyle.FLAVOR_DOMAIN.containsAnyOf(flavors)) {
        return true;
    }

    if (LinkerMapMode.FLAVOR_DOMAIN.containsAnyOf(flavors)) {
        return true;
    }

    for (Flavor flavor : cxxPlatforms.getFlavors()) {
        if (flavors.equals(ImmutableSet.of(flavor))) {
            return true;
        }
    }

    return false;
}

From source file:org.skinnyelephant.framework.core.EntityManager.java

/**
 * <p>Method for getting {@link ImmutableSet} of {@link Entity} for given {@link EntitySystem}</p>
 * <p>If system cache contains Set of entities for this system then its returned otherwise,
 * all of the entities are checked for components required to this system and added to set.</p>
 *
 * @param system System for which entities are requested.
 * @return Set of entities for given system.
 *//*  w  ww . j  av  a  2s . c o  m*/
public final ImmutableSet<Entity> getEntitiesForSystem(final EntitySystem system) {
    if (!initialized) {
        throw new IllegalStateException("Manager not initialized");
    }
    ImmutableSet<Entity> set = ImmutableSet.copyOf(systemCache.get(system));
    if (set != null && !set.isEmpty())
        return set;

    for (Entity e : entityMap.values()) {
        long bit = (e.getComponentsIds() & system.getUsedComponents());
        if (bit == system.getUsedComponents() && bit != 0) {
            systemCache.put(system, e);
        }
    }

    return ImmutableSet.copyOf(systemCache.get(system));
}

From source file:ai.grakn.graql.internal.query.match.MatchQuerySelect.java

MatchQuerySelect(AbstractMatchQuery inner, ImmutableSet<Var> names) {
    super(inner);

    Set<Var> selectedNames = inner.getSelectedNames();

    for (Var name : names) {
        if (!selectedNames.contains(name)) {
            throw GraqlQueryException.varNotInQuery(name);
        }//from  w w w. j  a v a  2  s  .  c  o  m
    }

    if (names.isEmpty()) {
        throw GraqlQueryException.noSelectedVars();
    }

    this.names = names;
}