@Override
    public BitMask resetAll(BitMask mask) {
        if (mask instanceof LongBitMask) {
            this.mask &= (-1L - ((LongBitMask) mask).asLong());
        } else if (mask instanceof AllSetBitMask) {
            this.mask &= 0;
        } else if (mask instanceof AllSetButLastBitMask) {
            this.mask &= Long.MIN_VALUE;
        } else if (mask instanceof EmptyButLastBitMask) {
            reset(0);
        } else if (!(mask instanceof EmptyBitMask)) {
            throw new RuntimeException("Cannot resetAll a LongBitMask with a " + mask.getClass().getSimpleName());
        }
        return this;
    }
@Test
  public void testResetAll() {
      assertThat(new LongBitMask().resetAll(new LongBitMask()).toString()).isEqualTo("0");
      assertThat(new LongBitMask().resetAll(AllSetBitMask.get()).toString()).isEqualTo("0");
      assertThat(new LongBitMask().resetAll(AllSetButLastBitMask.get()).toString()).isEqualTo("0");
      assertThat(new LongBitMask().resetAll(EmptyButLastBitMask.get()).toString()).isEqualTo("0");
      assertThat(new LongBitMask().resetAll(EmptyBitMask.get()).toString()).isEqualTo("0");
      
      thrown.expect(RuntimeException.class);
      new LongBitMask().resetAll(new OpenBitSet()).toString();
  }