public Vine(EnumSet<BlockFace> faces) { this((byte) 0); faces.retainAll(possibleFaces); byte data = 0; if (faces.contains(BlockFace.WEST)) { data |= VINE_WEST; } if (faces.contains(BlockFace.NORTH)) { data |= VINE_NORTH; } if (faces.contains(BlockFace.SOUTH)) { data |= VINE_SOUTH; } if (faces.contains(BlockFace.EAST)) { data |= VINE_EAST; } setData(data); }
@Override public boolean retainAll(Collection<?> collection) { if (collection instanceof EnumSet) { EnumSet<?> set = (EnumSet<?>) collection; if (!isValidType(set.elementClass)) { if (size > 0) { clear(); return true; } else { 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.retainAll(collection); }
@Override public boolean retainAll(Collection<?> collection) { if (collection instanceof EnumSet) { EnumSet<?> set = (EnumSet<?>) collection; if (!isValidType(set.elementClass)) { if (size > 0) { clear(); return true; } else { 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.retainAll(collection); }
public EnumSet<Key> getKeysHeldSince(final KeyboardState previous) { final EnumSet<Key> result = EnumSet.copyOf(_keysDown); result.retainAll(previous._keysDown); return result; }
/** Returns the intersection of two enumsets */ public static <E extends Enum<E>> EnumSet<E> intersection(EnumSet<E> s1, EnumSet<E> s2) { // We have to clone, since retainAll modifies the set EnumSet<E> s = s1.clone(); s.retainAll(s2); // I tried coding this for arbitrary sets, but it failed because // the interface Cloneable does not make sure that the clone-method // is visible (!) return (s); }
public EnumSet<Key> getKeysHeldSince(final KeyboardState previous) { final EnumSet<Key> result = EnumSet.copyOf(_keysDown); result.retainAll(previous._keysDown); return result; }
private EnumSet<Language> calcLanguages(Language... languages) { final EnumSet<Language> res = EnumSet.copyOf(this.languages); if (languages.length > 0) { res.retainAll(asList(languages)); } return res; }
private EnumSet<Language> calcLanguages(Language... languages) { final EnumSet<Language> res = EnumSet.copyOf(this.languages); if (languages.length > 0) { res.retainAll(asList(languages)); } return res; }
/** * Infers the properties of this converter from the properties of the elements converter. */ @Override public Set<FunctionProperty> properties() { final EnumSet<FunctionProperty> properties = EnumSet.copyOf(converter.properties()); properties.retainAll(PROPERTIES); return properties; }
/** * Infers the properties of this converter from the properties of the elements converter. */ @Override public Set<FunctionProperty> properties() { final EnumSet<FunctionProperty> properties = EnumSet.copyOf(converter.properties()); properties.retainAll(PROPERTIES); return properties; }
public BitField<E> and(BitField<E> that) { final EnumSet<E> bits = this.bits.clone(); return bits.retainAll(that.bits) ? new BitField<>(bits) : this; }
@Override protected EnumSet<C.Feature> initFeatures() { EnumSet<C.Feature> features = left.features(); features.retainAll(right.features()); features.add(READONLY); features.add(LAZY); return features; }
@Override protected EnumSet<C.Feature> initFeatures() { EnumSet<C.Feature> features = left.features(); features.retainAll(right.features()); features.add(READONLY); features.add(LAZY); return features; }
@Override protected EnumSet<C.Feature> initFeatures() { EnumSet<C.Feature> features = left.features(); features.retainAll(right.features()); features.add(READONLY); features.add(LAZY); return features; }
@Override protected EnumSet<C.Feature> initFeatures() { EnumSet<C.Feature> features = left.features(); features.retainAll(right.features()); features.add(READONLY); features.add(LAZY); return features; }
CompositeRSeq(C.ReversibleSequence<T> left, C.ReversibleSequence<T> right) { E.NPE(left, right); if (left.isEmpty() || right.isEmpty()) { throw new IllegalArgumentException("left or right cannot be empty"); } this.left = left; this.right = right; features = left.features(); features.retainAll(right.features()); features.add(READONLY); }
CompositeSeq(C.Sequence<? extends T> left, C.Sequence<? extends T> right) { E.NPE(left, right); if (left.isEmpty() || right.isEmpty()) { throw new IllegalArgumentException("left or right cannot be empty"); } this.left = left; this.right = right; features = left.features(); features.retainAll(right.features()); features.add(READONLY); }
CompositeSeq(C.Sequence<? extends T> left, C.Sequence<? extends T> right) { E.NPE(left, right); if (left.isEmpty() || right.isEmpty()) { throw new IllegalArgumentException("left or right cannot be empty"); } this.left = left; this.right = right; features = left.features(); features.retainAll(right.features()); features.add(READONLY); }
CompositeRSeq(C.ReversibleSequence<T> left, C.ReversibleSequence<T> right) { E.NPE(left, right); if (left.isEmpty() || right.isEmpty()) { throw new IllegalArgumentException("left or right cannot be empty"); } this.left = left; this.right = right; features = left.features(); features.retainAll(right.features()); features.add(READONLY); }
private byte[] negotiate(ExtendedNegotiation exneg, TransferCapability tc) { if (exneg == null) return null; StorageOptions storageOptions = tc.getStorageOptions(); if (storageOptions != null) return storageOptions.toExtendedNegotiationInformation(); EnumSet<QueryOption> queryOptions = tc.getQueryOptions(); if (queryOptions != null) { EnumSet<QueryOption> commonOpts = QueryOption.toOptions(exneg); commonOpts.retainAll(queryOptions); return QueryOption.toExtendedNegotiationInformation(commonOpts); } return null; }