102 |
*/ |
*/ |
103 |
public BitSet(int nbits) |
public BitSet(int nbits) |
104 |
{ |
{ |
105 |
|
if (nbits < 0) |
106 |
|
throw new NegativeArraySizeException(); |
107 |
|
|
108 |
int length = nbits >>> 6; |
int length = nbits >>> 6; |
109 |
if ((nbits & LONG_MASK) != 0) |
if ((nbits & LONG_MASK) != 0) |
110 |
++length; |
++length; |
198 |
*/ |
*/ |
199 |
public void clear(int pos) |
public void clear(int pos) |
200 |
{ |
{ |
201 |
int offset = pos >>> 6; |
int offset = pos >> 6; |
202 |
ensure(offset); |
ensure(offset); |
203 |
// ArrayIndexOutOfBoundsException subclasses IndexOutOfBoundsException, |
// ArrayIndexOutOfBoundsException subclasses IndexOutOfBoundsException, |
204 |
// so we'll just let that be our exception. |
// so we'll just let that be our exception. |
292 |
*/ |
*/ |
293 |
public void flip(int index) |
public void flip(int index) |
294 |
{ |
{ |
295 |
int offset = index >>> 6; |
int offset = index >> 6; |
296 |
ensure(offset); |
ensure(offset); |
297 |
// ArrayIndexOutOfBoundsException subclasses IndexOutOfBoundsException, |
// ArrayIndexOutOfBoundsException subclasses IndexOutOfBoundsException, |
298 |
// so we'll just let that be our exception. |
// so we'll just let that be our exception. |
338 |
*/ |
*/ |
339 |
public boolean get(int pos) |
public boolean get(int pos) |
340 |
{ |
{ |
341 |
int offset = pos >>> 6; |
int offset = pos >> 6; |
342 |
if (offset >= bits.length) |
if (offset >= bits.length) |
343 |
return false; |
return false; |
344 |
// ArrayIndexOutOfBoundsException subclasses IndexOutOfBoundsException, |
// ArrayIndexOutOfBoundsException subclasses IndexOutOfBoundsException, |
501 |
*/ |
*/ |
502 |
public int nextClearBit(int from) |
public int nextClearBit(int from) |
503 |
{ |
{ |
504 |
int offset = from >>> 6; |
int offset = from >> 6; |
505 |
long mask = 1L << from; |
long mask = 1L << from; |
506 |
while (offset < bits.length) |
while (offset < bits.length) |
507 |
{ |
{ |
538 |
*/ |
*/ |
539 |
public int nextSetBit(int from) |
public int nextSetBit(int from) |
540 |
{ |
{ |
541 |
int offset = from >>> 6; |
int offset = from >> 6; |
542 |
long mask = 1L << from; |
long mask = 1L << from; |
543 |
while (offset < bits.length) |
while (offset < bits.length) |
544 |
{ |
{ |
586 |
*/ |
*/ |
587 |
public void set(int pos) |
public void set(int pos) |
588 |
{ |
{ |
589 |
int offset = pos >>> 6; |
int offset = pos >> 6; |
590 |
ensure(offset); |
ensure(offset); |
591 |
// ArrayIndexOutOfBoundsException subclasses IndexOutOfBoundsException, |
// ArrayIndexOutOfBoundsException subclasses IndexOutOfBoundsException, |
592 |
// so we'll just let that be our exception. |
// so we'll just let that be our exception. |