/** * Returns {@code true} if this set contains the given element. * This methods returns {@code false} if the given argument is {@code null} or * is not an instance of the code list class specified at construction time. * * @param object the element to test for presence in this set. * @return {@code true} if the given object is contained in this set. */ @Override public boolean contains(final Object object) { if (elementType.isInstance(object)) { int ordinal = ((CodeList<?>) object).ordinal(); if (ordinal < Long.SIZE) { return (values & (1L << ordinal)) != 0; } // Rare cases where there is more than 64 elements. final BitSet s = supplementary; if (s != null) { return s.get(ordinal - Long.SIZE); } } return false; }
/** * Returns {@code true} if this set contains the given element. * This methods returns {@code false} if the given argument is {@code null} or * is not an instance of the code list class specified at construction time. * * @param object the element to test for presence in this set. * @return {@code true} if the given object is contained in this set. */ @Override public boolean contains(final Object object) { if (elementType.isInstance(object)) { int ordinal = ((CodeList<?>) object).ordinal(); if (ordinal < Long.SIZE) { return (values & (1L << ordinal)) != 0; } // Rare cases where there is more than 64 elements. final BitSet s = supplementary; if (s != null) { return s.get(ordinal - Long.SIZE); } } return false; }
/** * Removes the specified code list element from this set. * This methods does nothing if the given argument is {@code null} or is * not an instance of the code list class specified at construction time. * * @param object the code list element to remove from this set. * @return {@code true} if this set has been modified as a consequence of this method call. */ @Override public boolean remove(final Object object) { if (elementType.isInstance(object)) { return clear(((CodeList<?>) object).ordinal()); } return false; }
/** * Removes the specified code list element from this set. * This methods does nothing if the given argument is {@code null} or is * not an instance of the code list class specified at construction time. * * @param object the code list element to remove from this set. * @return {@code true} if this set has been modified as a consequence of this method call. */ @Override public boolean remove(final Object object) { if (elementType.isInstance(object)) { return clear(((CodeList<?>) object).ordinal()); } return false; }
int ordinal = element.ordinal(); if (ordinal < Long.SIZE) { return values != (values |= (1L << ordinal));
int ordinal = element.ordinal(); if (ordinal < Long.SIZE) { return values != (values |= (1L << ordinal));