當前位置: 首頁>>代碼示例>>Java>>正文


Java Collections.disjoint方法代碼示例

本文整理匯總了Java中java.util.Collections.disjoint方法的典型用法代碼示例。如果您正苦於以下問題:Java Collections.disjoint方法的具體用法?Java Collections.disjoint怎麽用?Java Collections.disjoint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.Collections的用法示例。


在下文中一共展示了Collections.disjoint方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isTxAvailableToCommitOnOwnNode

import java.util.Collections; //導入方法依賴的package包/類
private boolean isTxAvailableToCommitOnOwnNode(TxInfo txInfo, Lazy<UUID, Set<Object>> availableTxsPerNode) {
    Set<Object> sameNodeScope = availableTxsPerNode.get(txInfo.consumerId());

    if (sameNodeScope.containsAll(txInfo.scope())) {
        return true;
    }
    for (Map.Entry<UUID, Set<Object>> entry : availableTxsPerNode) {
        UUID nodeId = entry.getKey();
        Set<Object> nodeScope = entry.getValue();

        if (!nodeId.equals(txInfo.consumerId()) && !Collections.disjoint(nodeScope, txInfo.scope())) {
            return false;
        }
    }
    return true;
}
 
開發者ID:epam,項目名稱:Lagerta,代碼行數:17,代碼來源:LeadPlanner.java

示例2: removeQueuedThreadsWithDependency

import java.util.Collections; //導入方法依賴的package包/類
/**
 * Removes all queued threads that depend on the progress threads with the provided IDs. Also
 * all thread that depend on the threads that have been removed are removed recursively.
 * <p>
 * <strong>ATTENTION: Make sure this is only called from inside a synchronized block!</strong>
 * </p>
 * 
 * @param ids
 *            the progress thread IDs the queued progress threads should be checked for
 */
private static final void removeQueuedThreadsWithDependency(String... ids) {
	Iterator<ProgressThread> iterator = queuedThreads.iterator();

	// iterator over queued threads and remove the remove the ones that depend on one of the
	// provided IDs
	Set<String> cancelledThreads = new HashSet<>();
	while (iterator.hasNext()) {
		ProgressThread pg = iterator.next();
		if (!Collections.disjoint(Arrays.asList(ids), pg.getDependencies())) {
			iterator.remove();
			cancelledThreads.add(pg.getID());
		}
	}

	// also remove all the ones depending on the ones that have been cancelled.
	if (!cancelledThreads.isEmpty()) {
		removeQueuedThreadsWithDependency(cancelledThreads.toArray(new String[cancelledThreads.size()]));
	}
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:30,代碼來源:ProgressThread.java

示例3: filterHandelingen

import java.util.Collections; //導入方法依賴的package包/類
private Set<HandelingVoorPublicatie> filterHandelingen(final Set<Long> personenInLevering, final SetMultimap<Long, Long> admhndMap) {
    final Set<HandelingVoorPublicatie> teLeverenHandelingen = new HashSet<>();
    //loop over handelingen zonder status in levering en bepaal unieke bijgehouden persoon sets
    for (Long admhnId : admhndMap.keySet()) {
        final Set<Long> bijgehoudenPersonen = admhndMap.get(admhnId);
        if (Collections.disjoint(bijgehoudenPersonen, personenInLevering)) {
            final HandelingVoorPublicatie handelingVoorPublicatie = new HandelingVoorPublicatie();
            handelingVoorPublicatie.setAdmhndId(admhnId);
            handelingVoorPublicatie.setBijgehoudenPersonen(bijgehoudenPersonen);
            teLeverenHandelingen.add(handelingVoorPublicatie);
            personenInLevering.addAll(bijgehoudenPersonen);
        } else {
            LOGGER.debug(String.format("admhnd %s voor persoon al in levering, discard voor nu. Worden later opgepakt", admhnId));
        }
    }
    return teLeverenHandelingen;
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:18,代碼來源:AdmhndProducerVoorLeveringServiceImpl.java

示例4: buildTesterRequirements

import java.util.Collections; //導入方法依賴的package包/類
/**
 * Find all the constraints explicitly or implicitly specified by a single
 * tester annotation.
 * @param testerAnnotation a tester annotation
 * @return the requirements specified by the annotation
 * @throws ConflictingRequirementsException if the requirements are mutually
 *         inconsistent.
 */
private static TesterRequirements buildTesterRequirements(Annotation testerAnnotation)
    throws ConflictingRequirementsException {
  Class<? extends Annotation> annotationClass = testerAnnotation.annotationType();
  final Feature<?>[] presentFeatures;
  final Feature<?>[] absentFeatures;
  try {
    presentFeatures = (Feature[]) annotationClass.getMethod("value").invoke(testerAnnotation);
    absentFeatures = (Feature[]) annotationClass.getMethod("absent").invoke(testerAnnotation);
  } catch (Exception e) {
    throw new IllegalArgumentException("Error extracting features from tester annotation.", e);
  }
  Set<Feature<?>> allPresentFeatures =
      addImpliedFeatures(Helpers.<Feature<?>>copyToSet(presentFeatures));
  Set<Feature<?>> allAbsentFeatures =
      addImpliedFeatures(Helpers.<Feature<?>>copyToSet(absentFeatures));
  if (!Collections.disjoint(allPresentFeatures, allAbsentFeatures)) {
    throw new ConflictingRequirementsException(
        "Annotation explicitly or "
            + "implicitly requires one or more features to be both present "
            + "and absent.",
        intersection(allPresentFeatures, allAbsentFeatures),
        testerAnnotation);
  }
  return new TesterRequirements(allPresentFeatures, allAbsentFeatures);
}
 
開發者ID:zugzug90,項目名稱:guava-mock,代碼行數:34,代碼來源:FeatureUtil.java

示例5: checkConflict

import java.util.Collections; //導入方法依賴的package包/類
private static void checkConflict(
    String earlierRequirement,
    Set<Feature<?>> earlierFeatures,
    String newRequirement,
    Set<Feature<?>> newFeatures,
    Object source)
    throws ConflictingRequirementsException {
  if (!Collections.disjoint(newFeatures, earlierFeatures)) {
    throw new ConflictingRequirementsException(
        String.format(
            Locale.ROOT,
            "Annotation requires to be %s features that earlier "
                + "annotations required to be %s.",
            newRequirement,
            earlierRequirement),
        intersection(newFeatures, earlierFeatures),
        source);
  }
}
 
開發者ID:zugzug90,項目名稱:guava-mock,代碼行數:20,代碼來源:FeatureUtil.java

示例6: computeMultimapAsMapGetTestSuite

import java.util.Collections; //導入方法依賴的package包/類
@Override
TestSuite computeMultimapAsMapGetTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>>
        parentBuilder) {
  Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures());
  if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) {
    return new TestSuite();
  } else {
    return SetTestSuiteBuilder.using(
            new MultimapAsMapGetGenerator<K, V>(parentBuilder.getSubjectGenerator()))
        .withFeatures(features)
        .named(parentBuilder.getName() + ".asMap[].get[key]")
        .suppressing(parentBuilder.getSuppressedTests())
        .createTestSuite();
  }
}
 
開發者ID:zugzug90,項目名稱:guava-mock,代碼行數:18,代碼來源:SetMultimapTestSuiteBuilder.java

示例7: computeMultimapAsMapGetTestSuite

import java.util.Collections; //導入方法依賴的package包/類
@Override
TestSuite computeMultimapAsMapGetTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>>
        parentBuilder) {
  Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures());
  if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) {
    return new TestSuite();
  } else {
    return SortedSetTestSuiteBuilder.using(
            new SetMultimapTestSuiteBuilder.MultimapAsMapGetGenerator<K, V>(
                parentBuilder.getSubjectGenerator()))
        .withFeatures(features)
        .named(parentBuilder.getName() + ".asMap[].get[key]")
        .suppressing(parentBuilder.getSuppressedTests())
        .createTestSuite();
  }
}
 
開發者ID:zugzug90,項目名稱:guava-mock,代碼行數:19,代碼來源:SortedSetMultimapTestSuiteBuilder.java

示例8: pickNode

import java.util.Collections; //導入方法依賴的package包/類
/**
 * Pick the leaf that minimize cost
 */
@Override
public Node pickNode(final InferenceGraph g) {
    treeCache.clear(); //graph changes at every step - cache must be cleared
    Pair<List<Node>, Integer> bestPath = noPath;
    for (Node n : g.nodes) {
        if (!Collections.disjoint(n.data, varsToSolve)) {
            Pair<List<Node>, Integer> path = computeTreeToLeafs(n);
            //discard all paths containing at least a node in the
            //closure computed above
            if (path.snd < bestPath.snd) {
                bestPath = path;
            }
        }
    }
    if (bestPath == noPath) {
        //no path leads there
        throw new NodeNotFoundException(g);
    }
    return bestPath.fst.head;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:24,代碼來源:Infer.java

示例9: hasMatching

import java.util.Collections; //導入方法依賴的package包/類
private boolean hasMatching(Event event, List<String> vdIdentifiers) {
	try {
		return !Collections.disjoint(vdIdentifiers,
				event.getReadings().stream().map(r -> r.getName()).collect(Collectors.toList()));
	} catch (Exception e) {
		logger.error(
				"Problem getting event readings or associated value descriptor and checking against registration filters:  "
						+ e.getMessage());
		return false;
	}
}
 
開發者ID:edgexfoundry,項目名稱:export-distro,代碼行數:12,代碼來源:ValueDescriptorSplitter.java

示例10: matches

import java.util.Collections; //導入方法依賴的package包/類
public boolean matches(BookmarkContextHolder contextHolder)
{
	Set<String> allContexts = contextHolder.getContexts();
	if( !ignoreForContext.isEmpty() && !Collections.disjoint(ignoreForContext, allContexts) )
	{
		return false;
	}

	if( !onlyForContext.isEmpty() && Collections.disjoint(allContexts, onlyForContext) )
	{
		return false;
	}

	Set<String> ifc = contextHolder.getIgnoreForContext();
	if( !contexts.isEmpty() && !ifc.isEmpty() && !Collections.disjoint(contexts, ifc) )
	{
		return false;
	}

	Set<String> ofc = contextHolder.getOnlyForContext();
	if( !ofc.isEmpty() && Collections.disjoint(ofc, contexts) )
	{
		return false;
	}

	return true;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:28,代碼來源:BookmarkContextHolder.java

示例11: isValid

import java.util.Collections; //導入方法依賴的package包/類
public boolean isValid() {
	return !pathsA.isEmpty()
			&& !pathsB.isEmpty()
			&& Collections.disjoint(pathsA, pathsB)
			&& Collections.disjoint(pathsA, sharedClassPath)
			&& Collections.disjoint(pathsB, sharedClassPath)
			&& Collections.disjoint(classPathA, classPathB)
			&& Collections.disjoint(classPathA, pathsA)
			&& Collections.disjoint(classPathB, pathsA)
			&& Collections.disjoint(classPathA, pathsB)
			&& Collections.disjoint(classPathB, pathsB)
			&& Collections.disjoint(classPathA, sharedClassPath)
			&& Collections.disjoint(classPathB, sharedClassPath);
}
 
開發者ID:sfPlayer1,項目名稱:Matcher,代碼行數:15,代碼來源:ProjectConfig.java

示例12: checkIds

import java.util.Collections; //導入方法依賴的package包/類
private void checkIds(ArrayList<Integer> listOfIdsToBeAdded) throws petriNetException {
  	ArrayList<Integer> listOfIds = new ArrayList<Integer>();
  	for (Transition transition : transitions) {
  		listOfIds.add(transition.getId());
  	}
  	for (Place place : places) {
  		listOfIds.add(place.getId());
  	}
  	if (!Collections.disjoint(listOfIdsToBeAdded, listOfIds)) {
	throw new petriNetException(petriNetConstants.DUPLICATED);
}
  }
 
開發者ID:tslaats,項目名稱:SE2017-Team1,代碼行數:13,代碼來源:PetriNet.java

示例13: applyConstraints

import java.util.Collections; //導入方法依賴的package包/類
private static boolean applyConstraints(
		Set<ConstraintDescriptor<?>> constraintDescriptors,
		Property property,
		PropertyDescriptor propertyDesc,
		Set<Class<?>> groups,
		boolean canApplyNotNull,
		Dialect dialect) {
	boolean hasNotNull = false;
	for ( ConstraintDescriptor<?> descriptor : constraintDescriptors ) {
		if ( groups != null && Collections.disjoint( descriptor.getGroups(), groups ) ) {
			continue;
		}

		if ( canApplyNotNull ) {
			hasNotNull = hasNotNull || applyNotNull( property, descriptor );
		}

		// apply bean validation specific constraints
		applyDigits( property, descriptor );
		applySize( property, descriptor, propertyDesc );
		applyMin( property, descriptor, dialect );
		applyMax( property, descriptor, dialect );

		// apply hibernate validator specific constraints - we cannot import any HV specific classes though!
		// no need to check explicitly for @Range. @Range is a composed constraint using @Min and @Max which
		// will be taken care later
		applyLength( property, descriptor, propertyDesc );

		// pass an empty set as composing constraints inherit the main constraint and thus are matching already
		hasNotNull = hasNotNull || applyConstraints(
				descriptor.getComposingConstraints(),
				property, propertyDesc, null,
				canApplyNotNull,
                   dialect
		);
	}
	return hasNotNull;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:39,代碼來源:TypeSafeActivator.java

示例14: isAnyClassDuplicated

import java.util.Collections; //導入方法依賴的package包/類
public boolean isAnyClassDuplicated(Set<String> classNames) {
    boolean noCommonElements = Collections.disjoint(data.getDuplicateClasses(), classNames);
    return !noCommonElements;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:5,代碼來源:JarClasspathSnapshot.java

示例15: getMatchingValues

import java.util.Collections; //導入方法依賴的package包/類
@Override
public Set<IdPAttributeValue<?>> getMatchingValues(@Nonnull IdPAttribute attribute,
        @Nonnull AttributeFilterContext filtercontext) {
    ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this);
    List<String> names = resolveClaimNames(attribute.getEncoders());
    if (names.isEmpty()) {
        // This is always a failure.
        log.debug("{} No oidc encoders attached to attribute", getLogPrefix());
        return null;
    }
    OIDCAuthenticationResponseContext respCtx = getOIDCAuthenticationResponseContext(
            getOutboundMessageContext(filtercontext));
    if (respCtx == null) {
        // This is always a failure.
        log.debug("{} No oidc response ctx for this comparison", getLogPrefix());
        return null;
    }
    ClaimsRequest request = respCtx.getRequestedClaims();
    if (request == null || (request.getIDTokenClaims() == null && request.getUserInfoClaims() == null)) {
        log.debug("{} No claims in request", getLogPrefix());
        if (getMatchIRequestedClaimsSilent()) {
            log.debug("{} all values matched as in silent mode", getLogPrefix());
            return ImmutableSet.copyOf(attribute.getValues());
        } else {
            log.debug("{} none of the values matched as not silent mode", getLogPrefix());
            return null;
        }
    }
    if (request.getIDTokenClaimNames(false) != null && !getMatchOnlyUserInfo()) {
        if (!Collections.disjoint(request.getIDTokenClaimNames(false), names)) {
            log.debug("{} all values matched as {} is requested id token claims", getLogPrefix(),
                    attribute.getId());
            log.warn("{} Essential checking not implemented yet", getLogPrefix());
            // TODO: value based filtering with option onlyEssential
            return ImmutableSet.copyOf(attribute.getValues());
        }
    }
    if (request.getUserInfoClaimNames(false) != null && !getMatchOnlyIDToken()) {
        if (!Collections.disjoint(request.getUserInfoClaimNames(false), names)) {
            log.debug("{} all values matched as {} is requested user info claims", getLogPrefix(),
                    attribute.getId());
            log.warn("{} Essential checking not implemented yet", getLogPrefix());
            // TODO: value based filtering with option onlyEssential
            return ImmutableSet.copyOf(attribute.getValues());
        }
    }
    log.debug("{} attribute {} was not a requested claim, none of the values matched", getLogPrefix(),
            attribute.getId());
    return null;
}
 
開發者ID:CSCfi,項目名稱:shibboleth-idp-oidc-extension,代碼行數:51,代碼來源:AttributeInOIDCRequestedClaimsMatcher.java


注:本文中的java.util.Collections.disjoint方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。