List of usage examples for com.google.common.collect ImmutableSet contains
boolean contains(Object o);
From source file:org.gradle.internal.component.local.model.RootLocalComponentMetadata.java
@Override public BuildableLocalConfigurationMetadata addConfiguration(String name, String description, Set<String> extendsFrom, ImmutableSet<String> hierarchy, boolean visible, boolean transitive, ImmutableAttributes attributes, boolean canBeConsumed, boolean canBeResolved, ImmutableCapabilities capabilities) { assert hierarchy.contains(name); DefaultLocalConfigurationMetadata conf = new RootLocalConfigurationMetadata(name, description, visible, transitive, extendsFrom, hierarchy, attributes, canBeConsumed, canBeResolved, capabilities); addToConfigurations(name, conf);/*ww w. j a v a 2 s. co m*/ return conf; }
From source file:com.facebook.buck.halide.HalideLibraryDescription.java
@Override public boolean hasFlavors(ImmutableSet<Flavor> flavors) { return cxxPlatforms.containsAnyOf(flavors) || flavors.contains(HALIDE_COMPILE_FLAVOR) || flavors.contains(HALIDE_COMPILER_FLAVOR) || StripStyle.FLAVOR_DOMAIN.containsAnyOf(flavors); }
From source file:com.github.jsdossier.Config.java
private static Path getModulePreixPath(FileSystem fileSystem, Optional<Path> userSupplierPath, ImmutableSet<Path> modules) { Path path;//from ww w . j a va 2 s. c o m if (userSupplierPath.isPresent()) { path = userSupplierPath.get(); checkArgument(isDirectory(path), "Module prefix must be a directory: %s", path); for (Path module : modules) { checkArgument(module.startsWith(path), "Module prefix <%s> is not an ancestor of module %s", path, module); } } else { path = Paths.getCommonPrefix(fileSystem.getPath("").toAbsolutePath(), modules); if (modules.contains(path) && path.getParent() != null) { path = path.getParent(); } } // Always display at least one parent directory, if possible. for (Path module : modules) { if (path.equals(module.getParent())) { return firstNonNull(path.getParent(), path); } } return path; }
From source file:com.facebook.buck.apple.WorkspaceAndProjectGenerator.java
@VisibleForTesting static void groupSchemeTests(ImmutableSet<TargetNode<AppleTestDescription.Arg>> groupableTests, ImmutableSetMultimap<String, TargetNode<AppleTestDescription.Arg>> selectedTests, ImmutableMultimap.Builder<AppleTestBundleParamsKey, TargetNode<AppleTestDescription.Arg>> groupedTestsBuilder, ImmutableSetMultimap.Builder<String, TargetNode<AppleTestDescription.Arg>> ungroupedTestsBuilder) { for (Map.Entry<String, TargetNode<AppleTestDescription.Arg>> testEntry : selectedTests.entries()) { String schemeName = testEntry.getKey(); TargetNode<AppleTestDescription.Arg> test = testEntry.getValue(); if (groupableTests.contains(test)) { Preconditions.checkState(test.getConstructorArg().canGroup(), "Groupable test should actually be groupable."); groupedTestsBuilder//from ww w.j a va 2 s .c o m .put(AppleTestBundleParamsKey.fromAppleTestDescriptionArg(test.getConstructorArg()), test); } else { ungroupedTestsBuilder.put(schemeName, test); } } }
From source file:emily.command.informative.ServerCommand.java
@Override public String execute(DiscordBot bot, String[] args, MessageChannel channel, User author, Message inputMessage) {/*from w w w . j av a 2 s .c o m*/ Guild guild = ((TextChannel) channel).getGuild(); if (!PermissionUtil.checkPermission((TextChannel) channel, guild.getSelfMember(), Permission.MESSAGE_EMBED_LINKS)) { return Templates.permission_missing.formatGuild(channel, Permission.MESSAGE_EMBED_LINKS.toString()); } if (bot.security.getSimpleRank(author, channel).isAtLeast(SimpleRank.BOT_ADMIN) && args.length > 0 && DisUtil.matchesGuildSearch(args[0])) { guild = DisUtil.findGuildBy(args[0], bot.getContainer()); if (guild == null) { return Templates.config.cant_find_guild.formatGuild(channel, args[0]); } } EmbedBuilder b = new EmbedBuilder(); b.setAuthor(guild.getName(), guild.getIconUrl(), guild.getIconUrl()); b.setThumbnail(guild.getIconUrl()); b.setDescription("Discord-id `" + guild.getId() + "`\n" + "On shard `" + bot.getShardId() + "`\n" + (PermissionUtil.checkPermission(guild.getSelfMember(), Permission.ADMINISTRATOR) ? Emojibet.POLICE + " Administrator" : "")); ImmutableSet<OnlineStatus> onlineStatus = Sets.immutableEnumSet(OnlineStatus.ONLINE, OnlineStatus.IDLE, OnlineStatus.DO_NOT_DISTURB); long online = guild.getMembers().stream().filter(member -> onlineStatus.contains(member.getOnlineStatus())) .count(); b.setColor(GfxUtil.getAverageColor(guild.getIconUrl())); b.addField("Members", String.format("%s online\n%s in total", online, guild.getMembers().size()), true); b.addField("Channels", String.format("%s text channels\n%s voice channels", guild.getTextChannels().size(), guild.getVoiceChannels().size()), true); b.addField("Created by", String.format("%s\\#%s", guild.getOwner().getUser().getName(), guild.getOwner().getUser().getDiscriminator()), true); b.addField("My prefix", String.format("`%s`", DisUtil.getCommandPrefix(guild)), true); b.addField("Created On", new SimpleDateFormat("dd MMMM yyyy") .format(new Date(guild.getCreationTime().toInstant().toEpochMilli())), true); b.setFooter(guild.getSelfMember().getEffectiveName(), channel.getJDA().getSelfUser().getAvatarUrl()); bot.queue.add(channel.sendMessage(b.build())); return ""; }
From source file:org.sosy_lab.cpachecker.cpa.statistics.provider.SimpleIntProviderFactory.java
public static SimpleIntProvider getLoopCountProvider(CFA cfa, MergeOption option) { final ImmutableSet<CFANode> loopHeads = cfa.getAllLoopHeads().get(); return new SimpleIntProvider(new SimpleIntProviderImplementation() { @Override/* w ww . j a v a 2 s .c o m*/ public String getPropertyName() { return "loopCount"; } @Override public int calculateNext(int pCurrent, CFAEdge edge) { CFANode pred = edge.getPredecessor(); CFANode succ = edge.getSuccessor(); // we run into a loop if (loopHeads.contains(succ)) { // Now we have to check that are are not already within the loop if (succ.getNodeNumber() > pred.getNodeNumber()) { // NOTE: Not really a very sophisticated test, but fast and worked in my test cases return pCurrent + 1; } } return pCurrent; } }, option, 0); }
From source file:com.facebook.buck.android.AndroidBundleDescription.java
@Override public boolean hasFlavors(ImmutableSet<Flavor> flavors) { for (Flavor flavor : flavors) { if (!FLAVORS.contains(flavor)) { return false; }/*from w w w. ja va 2 s .c om*/ } return true; }
From source file:org.gradle.internal.component.external.model.ivy.IvyConfigurationHelper.java
ImmutableList<ExcludeMetadata> filterExcludes(ImmutableSet<String> hierarchy) { ImmutableList.Builder<ExcludeMetadata> filtered = ImmutableList.builder(); for (Exclude exclude : excludes) { for (String config : exclude.getConfigurations()) { if (hierarchy.contains(config)) { filtered.add(exclude);/*from w w w . j a v a 2 s.c om*/ break; } } } return filtered.build(); }
From source file:com.facebook.buck.apple.project_generator.WorkspaceAndProjectGenerator.java
/** * Find transitive dependencies of inputs for building. * * @param projectGraph {@link TargetGraph} containing nodes * @param nodes Nodes to fetch dependencies for. * @param excludes Nodes to exclude from dependencies list. * @return targets and their dependencies that should be build. */// w w w . ja va 2 s . c o m private static ImmutableSet<TargetNode<?, ?>> getTransitiveDepsAndInputs(final TargetGraph projectGraph, final AppleDependenciesCache dependenciesCache, Iterable<? extends TargetNode<?, ?>> nodes, final ImmutableSet<TargetNode<?, ?>> excludes) { return FluentIterable.from(nodes) .transformAndConcat(new Function<TargetNode<?, ?>, Iterable<TargetNode<?, ?>>>() { @Override public Iterable<TargetNode<?, ?>> apply(TargetNode<?, ?> input) { return AppleBuildRules.getRecursiveTargetNodeDependenciesOfTypes(projectGraph, Optional.of(dependenciesCache), AppleBuildRules.RecursiveDependenciesMode.BUILDING, input, Optional.empty()); } }).append(nodes).filter(input -> !excludes.contains(input) && AppleBuildRules.isXcodeTargetDescription(input.getDescription())) .toSet(); }
From source file:org.springframework.ide.eclipse.boot.dash.livexp.DisposingFactory.java
private synchronized void retainOnlyValidKeys() { if (cachedInstances != null) { ImmutableSet<K> valid = getValidKeys(); Iterator<Entry<K, V>> iter = cachedInstances.entrySet().iterator(); while (iter.hasNext()) { Entry<K, V> e = iter.next(); K k = e.getKey();//from w w w . j av a 2 s .c om if (valid.contains(k)) { //keep } else { e.getValue().dispose(); iter.remove(); } } } }