@Override public int max() throws IllegalStateException { return impl.max(); }
@Override public int max() throws IllegalStateException { return impl.max(); }
@Override public int max() throws IllegalStateException { return impl.max(); }
/** * If appropriate, change the representation of V. * * For now, this method will change a MutableSparseIntSet to a BitVector if it saves space. * * TODO: add more variants. */ private void maybeChangeRepresentation() { assert impl instanceof BitVectorIntSet || impl instanceof MutableSparseIntSet; if (impl == null) { return; } int sparseSize = impl.size(); if (sparseSize <= 2) { // don't bother return; } int bvSize = BitVectorBase.subscript(impl.max()) + 1; if (sparseSize > bvSize) { if (!(impl instanceof BitVectorIntSet)) { impl = new BitVectorIntSet(impl); } } else { if (!(impl instanceof MutableSparseIntSet)) { impl = MutableSparseIntSet.make(impl); } } assert impl instanceof BitVectorIntSet || impl instanceof MutableSparseIntSet; }
/** * If appropriate, change the representation of V. * * For now, this method will change a MutableSparseIntSet to a BitVector if it saves space. * * TODO: add more variants. */ private void maybeChangeRepresentation() { assert impl instanceof BitVectorIntSet || impl instanceof MutableSparseIntSet; if (impl == null) { return; } int sparseSize = impl.size(); if (sparseSize <= 2) { // don't bother return; } int bvSize = BitVectorBase.subscript(impl.max()) + 1; if (sparseSize > bvSize) { if (!(impl instanceof BitVectorIntSet)) { impl = new BitVectorIntSet(impl); } } else { if (!(impl instanceof MutableSparseIntSet)) { impl = MutableSparseIntSet.make(impl); } } assert impl instanceof BitVectorIntSet || impl instanceof MutableSparseIntSet; }
/** * If appropriate, change the representation of V. * * For now, this method will change a MutableSparseIntSet to a BitVector if it saves space. * * TODO: add more variants. */ private void maybeChangeRepresentation() { assert impl instanceof BitVectorIntSet || impl instanceof MutableSparseIntSet; if (impl == null) { return; } int sparseSize = impl.size(); if (sparseSize <= 2) { // don't bother return; } int bvSize = BitVectorBase.subscript(impl.max()) + 1; if (sparseSize > bvSize) { if (!(impl instanceof BitVectorIntSet)) { impl = new BitVectorIntSet(impl); } } else { if (!(impl instanceof MutableSparseIntSet)) { impl = MutableSparseIntSet.make(impl); } } assert impl instanceof BitVectorIntSet || impl instanceof MutableSparseIntSet; }