Refine search
public boolean hasAnyAuthorityMatching(Set<GrantedAuthority> userAuthorities) { return !Sets.intersection(grantedAuthorities, userAuthorities).isEmpty(); }
/** * @param stationNetworks The station where we want to drop the bike off. * @param rentedNetworks The set of networks of the station we rented the bike from. * @return true if the bike can be dropped off here, false if not. */ private boolean hasCompatibleNetworks(Set<String> stationNetworks, Set<String> rentedNetworks) { /* * Two stations are compatible if they share at least one network. Special case for "null" * networks ("catch-all" network defined). */ if (stationNetworks == null || rentedNetworks == null) return true; // Always a match return !Sets.intersection(stationNetworks, rentedNetworks).isEmpty(); } }
static boolean intersect(Set<?> a, Set<?> b) { return !intersection(a, b).isEmpty(); }
@JsonCreator public GroupIdNode( @JsonProperty("id") PlanNodeId id, @JsonProperty("source") PlanNode source, @JsonProperty("groupingSets") List<List<Symbol>> groupingSets, @JsonProperty("groupingColumns") Map<Symbol, Symbol> groupingColumns, @JsonProperty("aggregationArguments") List<Symbol> aggregationArguments, @JsonProperty("groupIdSymbol") Symbol groupIdSymbol) { super(id); this.source = requireNonNull(source); this.groupingSets = listOfListsCopy(requireNonNull(groupingSets, "groupingSets is null")); this.groupingColumns = ImmutableMap.copyOf(requireNonNull(groupingColumns)); this.aggregationArguments = ImmutableList.copyOf(aggregationArguments); this.groupIdSymbol = requireNonNull(groupIdSymbol); checkArgument(Sets.intersection(groupingColumns.keySet(), ImmutableSet.copyOf(aggregationArguments)).isEmpty(), "aggregation columns and grouping set columns must be a disjoint set"); }
@Override public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { Set<String> activeProfiles = Sets.newHashSet(context.getEnvironment().getActiveProfiles()); Set<String> requiredActiveProfiles = retrieveAnnotatedProfiles(metadata, ConditionalOnProfile.class.getName()); Set<String> requiredInactiveProfiles = retrieveAnnotatedProfiles(metadata, ConditionalOnMissingProfile.class .getName()); return Sets.difference(requiredActiveProfiles, activeProfiles).isEmpty() && Sets.intersection(requiredInactiveProfiles, activeProfiles).isEmpty(); }
private boolean isCandidate(Map<ColumnHandle, NullableValue> bindings) { if (intersection(bindings.keySet(), arguments).isEmpty()) { return true; } LookupSymbolResolver inputs = new LookupSymbolResolver(assignments, bindings); // Skip pruning if evaluation fails in a recoverable way. Failing here can cause // spurious query failures for partitions that would otherwise be filtered out. Object optimized = TryFunction.evaluate(() -> evaluator.optimize(inputs), true); // If any conjuncts evaluate to FALSE or null, then the whole predicate will never be true and so the partition should be pruned if (Boolean.FALSE.equals(optimized) || optimized == null || optimized instanceof NullLiteral) { return false; } return true; } }
private void checkGeneralArguments() { checkSortKey(sortKey); Preconditions.checkArgument(sortOrder==Order.ASC || hasSortKey(),"Must define a sort key to use ordering"); checkSignature(signature); Preconditions.checkArgument(Sets.intersection(Sets.newHashSet(sortKey), Sets.newHashSet(signature)).isEmpty(), "Signature and sort key must be disjoined"); Preconditions.checkArgument(!hasSortKey() || !multiplicity.isConstrained(),"Cannot define a sort-key on constrained edge labels"); }
private void verify(List<SpatialDimensionSchema> spatialDimensions) { List<String> dimNames = getDimensionNames(); Preconditions.checkArgument( Sets.intersection(this.dimensionExclusions, Sets.newHashSet(dimNames)).isEmpty(), "dimensions and dimensions exclusions cannot overlap" ); ParserUtils.validateFields(dimNames); ParserUtils.validateFields(dimensionExclusions); List<String> spatialDimNames = Lists.transform( spatialDimensions, new Function<SpatialDimensionSchema, String>() { @Override public String apply(SpatialDimensionSchema input) { return input.getDimName(); } } ); // Don't allow duplicates between main list and deprecated spatial list ParserUtils.validateFields(Iterables.concat(dimNames, spatialDimNames)); }
private void checkGeneralArguments() { checkSortKey(sortKey); Preconditions.checkArgument(sortOrder==Order.ASC || hasSortKey(),"Must define a sort key to use ordering"); checkSignature(signature); Preconditions.checkArgument(Sets.intersection(Sets.newHashSet(sortKey), Sets.newHashSet(signature)).isEmpty(), "Signature and sort key must be disjoined"); Preconditions.checkArgument(!hasSortKey() || !multiplicity.isConstrained(),"Cannot define a sort-key on constrained edge labels"); }
private boolean isCoverageMeasuresAlreadyDefined(InputFile f) { Set<String> metricKeys = StreamSupport.stream(measureCache.byComponentKey(f.key()).spliterator(), false) .map(m -> m.metric().key()).collect(toSet()); Set<String> allCoverageMetricKeys = CoverageType.UNIT.allMetrics().stream().map(Metric::key).collect(toSet()); return !Sets.intersection(metricKeys, allCoverageMetricKeys).isEmpty(); }
private ExceptionHandler(Builder builder) { interceptors = builder.interceptors.build(); retriableExceptions = builder.retriableExceptions.build(); nonRetriableExceptions = builder.nonRetriableExceptions.build(); Preconditions.checkArgument( Sets.intersection(retriableExceptions, nonRetriableExceptions).isEmpty(), "Same exception was found in both retryable and non-retryable sets"); for (Class<? extends Exception> exception : retriableExceptions) { addRetryInfo(new RetryInfo(exception, Interceptor.RetryResult.RETRY), retryInfo); } for (Class<? extends Exception> exception : nonRetriableExceptions) { addRetryInfo(new RetryInfo(exception, Interceptor.RetryResult.NO_RETRY), retryInfo); } }
@Override public PlanNode visitLateralJoin(LateralJoinNode node, RewriteContext<Set<Symbol>> context) { PlanNode subquery = context.rewrite(node.getSubquery(), context.get()); // remove unused lateral nodes if (intersection(ImmutableSet.copyOf(subquery.getOutputSymbols()), context.get()).isEmpty() && isScalar(subquery)) { return context.rewrite(node.getInput(), context.get()); } // prune not used correlation symbols Set<Symbol> subquerySymbols = SymbolsExtractor.extractUnique(subquery); List<Symbol> newCorrelation = node.getCorrelation().stream() .filter(subquerySymbols::contains) .collect(toImmutableList()); Set<Symbol> inputContext = ImmutableSet.<Symbol>builder() .addAll(context.get()) .addAll(newCorrelation) .build(); PlanNode input = context.rewrite(node.getInput(), inputContext); // remove unused lateral nodes if (intersection(ImmutableSet.copyOf(input.getOutputSymbols()), inputContext).isEmpty() && isScalar(input)) { return subquery; } return new LateralJoinNode(node.getId(), input, subquery, newCorrelation, node.getType(), node.getOriginSubquery()); } }
if (intersection(node.getSubqueryAssignments().getSymbols(), context.get()).isEmpty()) { return context.rewrite(node.getInput(), context.get());
assertTrue(Sets.intersection(cache.asMap().keySet(), removalNotifications.keySet()).isEmpty());
if (config.getShadowWrites()) { Sets.SetView<QueryType> allowedTypes = Sets.union(config.getTestQueryTypes(), config.getControlQueryTypes()); checkArgument(!Sets.intersection(allowedTypes, ImmutableSet.of(CREATE, MODIFY)).isEmpty(), "CREATE or MODIFY queries must be allowed in test or control to use write shadowing"); queries = rewriteQueries(new SqlParser(getParserOptions()), config, queries);
@Override public Description matchMethod(MethodTree tree, final VisitorState state) { ImmutableList<String> lockExpressions = getLockExpressions(tree); if (lockExpressions.isEmpty()) { return Description.NO_MATCH; } Optional<ImmutableSet<GuardedByExpression>> expected = parseLockExpressions(lockExpressions, tree, state); if (!expected.isPresent()) { return buildDescription(tree).setMessage("Could not resolve lock expression.").build(); } Set<GuardedByExpression> unwanted = getUnwanted(tree, state); SetView<GuardedByExpression> mishandled = Sets.intersection(expected.get(), unwanted); if (!mishandled.isEmpty()) { String message = buildMessage(formatLockString(mishandled)); return buildDescription(tree).setMessage(message).build(); } Set<GuardedByExpression> actual = getActual(tree, state); SetView<GuardedByExpression> unhandled = Sets.difference(expected.get(), actual); if (!unhandled.isEmpty()) { String message = buildMessage(formatLockString(unhandled)); return buildDescription(tree).setMessage(message).build(); } return Description.NO_MATCH; }
assertTrue(Sets.intersection(cache.asMap().keySet(), removalNotifications.keySet()).isEmpty());
public static boolean groupsIntersect(Set<String> a, Set<String> b) { return !Sets.intersection(a, b).isEmpty(); }
@Override public boolean verifyServicesCombination(Set<Service> services) { Preconditions.checkNotNull(services); final Sets.SetView<Service> missingServices = Sets.difference(REQUIRED_SERVICES, services); final Sets.SetView<Service> unsupportedServices = Sets.intersection(UNSUPPORTED_SERVICES, services); final Sets.SetView<Service> wantedServices = Sets.intersection(NUAGE_ONLY_SERVICES, new HashSet<>()); if (!missingServices.isEmpty()) { throw new UnsupportedServiceException("Provider " + Provider.NuageVsp + " requires services: " + missingServices); } if (!unsupportedServices.isEmpty()) { // NuageVsp doesn't implement any of these services. // So if these services are requested, we can't handle it. s_logger.debug("Unable to support services combination. The services " + unsupportedServices + " are not supported by Nuage VSP."); return false; } if (!wantedServices.isEmpty()) { throw new UnsupportedServiceException("Provider " + Provider.NuageVsp + " does not support services to be implemented by another provider: " + wantedServices); } return true; }
@Value.Check void validatePriorityTablesAndBlacklistTablesAreDisjoint() { Preconditions.checkState(Sets.intersection(priorityTables(), blacklistTables()).isEmpty(), "The priority and blacklist tables should not have any overlap, but found %s", Sets.intersection(priorityTables(), blacklistTables())); } }