328
329 for (int i = 0; i < elements.length; i++)
330 elements[i] &= es.elements[i];
331 return recalculateSize();
332 }
333
334 /**
335 * Removes all of the elements from this set.
336 */
337 public void clear() {
338 Arrays.fill(elements, 0);
339 size = 0;
340 }
341
342 /**
343 * Compares the specified object with this set for equality. Returns
344 * <tt>true</tt> if the given object is also a set, the two sets have
345 * the same size, and every member of the given set is contained in
346 * this set.
347 *
348 * @param e object to be compared for equality with this set
349 * @return <tt>true</tt> if the specified object is equal to this set
350 */
351 public boolean equals(Object o) {
352 if (!(o instanceof JumboEnumSet))
353 return super.equals(o);
354
355 JumboEnumSet<?> es = (JumboEnumSet<?>)o;
356 if (es.elementType != elementType)
357 return size == 0 && es.size == 0;
358
359 return Arrays.equals(es.elements, elements);
360 }
361
362 /**
363 * Recalculates the size of the set. Returns true if it's changed.
364 */
365 private boolean recalculateSize() {
366 int oldSize = size;
367 size = 0;
368 for (long elt : elements)
|
328
329 for (int i = 0; i < elements.length; i++)
330 elements[i] &= es.elements[i];
331 return recalculateSize();
332 }
333
334 /**
335 * Removes all of the elements from this set.
336 */
337 public void clear() {
338 Arrays.fill(elements, 0);
339 size = 0;
340 }
341
342 /**
343 * Compares the specified object with this set for equality. Returns
344 * <tt>true</tt> if the given object is also a set, the two sets have
345 * the same size, and every member of the given set is contained in
346 * this set.
347 *
348 * @param o object to be compared for equality with this set
349 * @return <tt>true</tt> if the specified object is equal to this set
350 */
351 public boolean equals(Object o) {
352 if (!(o instanceof JumboEnumSet))
353 return super.equals(o);
354
355 JumboEnumSet<?> es = (JumboEnumSet<?>)o;
356 if (es.elementType != elementType)
357 return size == 0 && es.size == 0;
358
359 return Arrays.equals(es.elements, elements);
360 }
361
362 /**
363 * Recalculates the size of the set. Returns true if it's changed.
364 */
365 private boolean recalculateSize() {
366 int oldSize = size;
367 size = 0;
368 for (long elt : elements)
|