MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / flip

Method flip

Ports/CLDC11/src/java/util/BitSet.java:606–621  ·  view source on GitHub ↗
(int pos)

Source from the content-addressed store, hash-verified

604 ///
605 /// - #flip(int, int)
606 public void flip(int pos) {
607 if (pos < 0) {
608 throw new IndexOutOfBoundsException("" + pos);
609 }
610
611 int len = (pos >> OFFSET) + 1;
612 if (len > bits.length) {
613 growLength(len);
614 }
615 bits[len - 1] ^= TWO_N_ARRAY[pos & RIGHT_BITS];
616 if (len > actualArrayLength) {
617 actualArrayLength = len;
618 }
619 isLengthActual = !((actualArrayLength > 0) && (bits[actualArrayLength - 1] == 0));
620 needClear();
621 }
622
623 /// Flips the bits starting from `pos1` to `pos2`. Grows the
624 /// `BitSet` if `pos2 > size`.

Callers

nothing calls this directly

Calls 2

growLengthMethod · 0.95
needClearMethod · 0.95

Tested by

no test coverage detected