private static <E extends Enum<E>> EnumSet<E> makeComplementByHand( Collection<E> collection, Class<E> type) { EnumSet<E> result = EnumSet.allOf(type); result.removeAll(collection); return result; }
private static <E extends Enum<E>> EnumSet<E> makeComplementByHand( Collection<E> collection, Class<E> type) { EnumSet<E> result = EnumSet.allOf(type); result.removeAll(collection); return result; }
@Override public void disableHarCaptureTypes(Set<CaptureType> captureTypes) { harCaptureTypes.removeAll(captureTypes); }
private void disableModifiers(Collection<SGR> modifiers) { this.activeModifiers.removeAll(modifiers); }
private static <E extends Enum<E>> EnumSet<E> makeComplementByHand( Collection<E> collection, Class<E> type) { EnumSet<E> result = EnumSet.allOf(type); result.removeAll(collection); return result; }
@Override public TextGraphicsWriter disableModifiers(SGR... modifiers) { style.removeAll(Arrays.asList(modifiers)); return this; }
@Override public TextGraphics disableModifiers(SGR... modifiers) { activeModifiers.removeAll(Arrays.asList(modifiers)); return this; }
@Override public Set disableModifiers(SGR... modifiers) { style.removeAll(Arrays.asList(modifiers)); return this; } @Override
public final void setReducerTraits(EnumSet<ReducerTraits> traits) { // we don't allow turning on auto parallel once it has been // explicitly turned off. That is to avoid scenarios where // auto parallelism could break assumptions about number of // reducers or hash function. boolean wasUnset = this.reduceTraits.remove(ReducerTraits.UNSET); if (this.reduceTraits.contains(ReducerTraits.FIXED)) { return; } else if (traits.contains(ReducerTraits.FIXED)) { this.reduceTraits.removeAll(EnumSet.of( ReducerTraits.AUTOPARALLEL, ReducerTraits.UNIFORM)); this.reduceTraits.addAll(traits); } else { this.reduceTraits.addAll(traits); } }
public final void setReducerTraits(EnumSet<ReducerTraits> traits) { // we don't allow turning on auto parallel once it has been // explicitly turned off. That is to avoid scenarios where // auto parallelism could break assumptions about number of // reducers or hash function. boolean wasUnset = this.reduceTraits.remove(ReducerTraits.UNSET); if (this.reduceTraits.contains(ReducerTraits.FIXED)) { return; } else if (traits.contains(ReducerTraits.FIXED)) { this.reduceTraits.removeAll(EnumSet.of( ReducerTraits.AUTOPARALLEL, ReducerTraits.UNIFORM)); this.reduceTraits.addAll(traits); } else { this.reduceTraits.addAll(traits); } }
/** {@inheritDoc} */ @Override public GridClientData flagsOff(GridClientCacheFlag... flags) throws GridClientException { if (flags == null || flags.length == 0 || this.flags == null || this.flags.isEmpty()) return this; EnumSet<GridClientCacheFlag> flagSet = EnumSet.copyOf(this.flags); flagSet.removeAll(Arrays.asList(flags)); return createProjection(nodes, filter, balancer, new GridClientDataFactory(flagSet)); }
@Override public boolean removeAll(Collection<?> collection) { if (collection.isEmpty()) { return false; } if (collection instanceof EnumSet) { EnumSet<?> set = (EnumSet<?>) collection; if (!isValidType(set.elementClass)) { return false; } MiniEnumSet<E> miniSet = (MiniEnumSet<E>) set; long oldBits = bits; long newBits = oldBits & ~miniSet.bits; if (oldBits != newBits) { bits = newBits; size = Long.bitCount(newBits); return true; } return false; } return super.removeAll(collection); }
@Override public boolean removeAll(Collection<?> collection) { if (collection.isEmpty()) { return false; } if (collection instanceof EnumSet) { EnumSet<?> set = (EnumSet<?>) collection; if (!isValidType(set.elementClass)) { return false; } HugeEnumSet<E> hugeSet = (HugeEnumSet<E>) set; boolean changed = false; for (int i = 0; i < bits.length; i++) { long oldBits = bits[i]; long newBits = oldBits & ~hugeSet.bits[i]; if (oldBits != newBits) { bits[i] = newBits; size += Long.bitCount(newBits) - Long.bitCount(oldBits); changed = true; } } return changed; } return super.removeAll(collection); }
public EnumSet<CardType> availableTypes(EnumSet<CardType> types){ EnumSet<CardType> available = EnumSet.copyOf(types); available.removeAll(usedCardTypes); return available; }
/** * Creates a new {@link ConnectionProfile} based on the added connections. * @throws IllegalStateException if any of the {@link org.elasticsearch.transport.TransportRequestOptions.Type} enum is missing */ public ConnectionProfile build() { EnumSet<TransportRequestOptions.Type> types = EnumSet.allOf(TransportRequestOptions.Type.class); types.removeAll(addedTypes); if (types.isEmpty() == false) { throw new IllegalStateException("not all types are added for this connection profile - missing types: " + types); } return new ConnectionProfile(Collections.unmodifiableList(handles), numConnections, connectTimeout, handshakeTimeout, pingInterval, compressionEnabled); }
/** * Configure error types to be ignored across all objects. * * @param ids * error types to ignore. The caller's set is copied. * @return {@code this} * @since 4.2 */ public ObjectChecker setIgnore(@Nullable Set<ErrorType> ids) { errors = EnumSet.allOf(ErrorType.class); if (ids != null) { errors.removeAll(ids); } return this; }
private static <E extends Enum<E>> EnumSet<E> makeComplementByHand( Collection<E> collection, Class<E> type) { EnumSet<E> result = EnumSet.allOf(type); result.removeAll(collection); return result; }
private static <E extends Enum<E>> EnumSet<E> makeComplementByHand( Collection<E> collection, Class<E> type) { EnumSet<E> result = EnumSet.allOf(type); result.removeAll(collection); return result; }
/** * Throws a {@link MissingPermissionsException} if the set of permissions does not contain all of the required permissions. * * @param permissions The permissions to check. * @param required The permissions the given set must have. */ public static void requirePermissions(EnumSet<Permissions> permissions, EnumSet<Permissions> required) { EnumSet<Permissions> copy = required.clone(); copy.removeAll(permissions); if (!copy.isEmpty()) throw new MissingPermissionsException(copy); }
private static EnumSet<Feature> difference(Set<Feature> features, Set<Feature> removedFeatures) { EnumSet<Feature> result = enumSetOf(features); result.removeAll(removedFeatures); return result; }