本文整理汇总了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;
}
示例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()]));
}
}
示例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;
}
示例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);
}
示例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);
}
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
示例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);
}
}
示例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;
}
示例14: isAnyClassDuplicated
import java.util.Collections; //导入方法依赖的package包/类
public boolean isAnyClassDuplicated(Set<String> classNames) {
boolean noCommonElements = Collections.disjoint(data.getDuplicateClasses(), classNames);
return !noCommonElements;
}
示例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