java.util.BitSet.shrinkSize()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中java.util.BitSet.shrinkSize()方法的一些代码示例,展示了BitSet.shrinkSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BitSet.shrinkSize()方法的具体详情如下:
包路径:java.util.BitSet
类名称:BitSet
方法名:shrinkSize

BitSet.shrinkSize介绍

[英]Updates 'longCount' by inspecting 'bits'. Assumes that the new longCount is
[中]通过检查“位”更新“长计数”。假设新的longCount为

代码示例

代码示例来源:origin: robovm/robovm

  1. private BitSet(long[] bits) {
  2. this.bits = bits;
  3. this.longCount = bits.length;
  4. shrinkSize();
  5. }

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Clears all bits in this {@code BitSet} which are also set in {@code bs}.
  3. */
  4. public void andNot(BitSet bs) {
  5. int minSize = Math.min(this.longCount, bs.longCount);
  6. for (int i = 0; i < minSize; ++i) {
  7. bits[i] &= ~bs.bits[i];
  8. }
  9. shrinkSize();
  10. }

代码示例来源:origin: robovm/robovm

  1. private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
  2. ois.defaultReadObject();
  3. // The serialized form doesn't include a 'longCount' field, so we'll have to scan the array.
  4. this.longCount = this.bits.length;
  5. shrinkSize();
  6. }
  7. }

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Logically ands the bits of this {@code BitSet} with {@code bs}.
  3. */
  4. public void and(BitSet bs) {
  5. int minSize = Math.min(this.longCount, bs.longCount);
  6. for (int i = 0; i < minSize; ++i) {
  7. bits[i] &= bs.bits[i];
  8. }
  9. Arrays.fill(bits, minSize, longCount, 0L);
  10. shrinkSize();
  11. }

代码示例来源:origin: robovm/robovm

  1. @Override public Object clone() {
  2. try {
  3. BitSet clone = (BitSet) super.clone();
  4. clone.bits = bits.clone();
  5. clone.shrinkSize();
  6. return clone;
  7. } catch (CloneNotSupportedException e) {
  8. throw new AssertionError(e);
  9. }
  10. }

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Clears the bit at index {@code index}.
  3. *
  4. * @throws IndexOutOfBoundsException if {@code index < 0}.
  5. */
  6. public void clear(int index) {
  7. if (index < 0) { // TODO: until we have an inlining JIT.
  8. checkIndex(index);
  9. }
  10. int arrayIndex = index / 64;
  11. if (arrayIndex >= longCount) {
  12. return;
  13. }
  14. bits[arrayIndex] &= ~(1L << index);
  15. shrinkSize();
  16. }

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Logically xors the bits of this {@code BitSet} with {@code bs}.
  3. */
  4. public void xor(BitSet bs) {
  5. int minSize = Math.min(this.longCount, bs.longCount);
  6. int maxSize = Math.max(this.longCount, bs.longCount);
  7. ensureCapacity(maxSize);
  8. for (int i = 0; i < minSize; ++i) {
  9. bits[i] ^= bs.bits[i];
  10. }
  11. if (bs.longCount > minSize) {
  12. System.arraycopy(bs.bits, minSize, bits, minSize, maxSize - minSize);
  13. }
  14. longCount = maxSize;
  15. shrinkSize();
  16. }

代码示例来源:origin: robovm/robovm

  1. shrinkSize();

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Flips the bit at index {@code index}.
  3. *
  4. * @throws IndexOutOfBoundsException if {@code index < 0}.
  5. */
  6. public void flip(int index) {
  7. if (index < 0) { // TODO: until we have an inlining JIT.
  8. checkIndex(index);
  9. }
  10. int arrayIndex = index / 64;
  11. if (arrayIndex >= bits.length) {
  12. ensureCapacity(arrayIndex + 1);
  13. }
  14. bits[arrayIndex] ^= (1L << index);
  15. longCount = Math.max(longCount, arrayIndex + 1);
  16. shrinkSize();
  17. }

代码示例来源:origin: robovm/robovm

  1. shrinkSize();

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

  1. private BitSet(long[] bits) {
  2. this.bits = bits;
  3. this.longCount = bits.length;
  4. shrinkSize();
  5. }

代码示例来源:origin: ibinti/bugvm

  1. private BitSet(long[] bits) {
  2. this.bits = bits;
  3. this.longCount = bits.length;
  4. shrinkSize();
  5. }

代码示例来源:origin: MobiVM/robovm

  1. /**
  2. * Clears all bits in this {@code BitSet} which are also set in {@code bs}.
  3. */
  4. public void andNot(BitSet bs) {
  5. int minSize = Math.min(this.longCount, bs.longCount);
  6. for (int i = 0; i < minSize; ++i) {
  7. bits[i] &= ~bs.bits[i];
  8. }
  9. shrinkSize();
  10. }

代码示例来源:origin: ibinti/bugvm

  1. private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
  2. ois.defaultReadObject();
  3. // The serialized form doesn't include a 'longCount' field, so we'll have to scan the array.
  4. this.longCount = this.bits.length;
  5. shrinkSize();
  6. }
  7. }

代码示例来源:origin: MobiVM/robovm

  1. private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
  2. ois.defaultReadObject();
  3. // The serialized form doesn't include a 'longCount' field, so we'll have to scan the array.
  4. this.longCount = this.bits.length;
  5. shrinkSize();
  6. }
  7. }

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

  1. private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
  2. ois.defaultReadObject();
  3. // The serialized form doesn't include a 'longCount' field, so we'll have to scan the array.
  4. this.longCount = this.bits.length;
  5. shrinkSize();
  6. }
  7. }

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

  1. /**
  2. * Clears all bits in this {@code BitSet} which are also set in {@code bs}.
  3. */
  4. public void andNot(BitSet bs) {
  5. int minSize = Math.min(this.longCount, bs.longCount);
  6. for (int i = 0; i < minSize; ++i) {
  7. bits[i] &= ~bs.bits[i];
  8. }
  9. shrinkSize();
  10. }

代码示例来源:origin: FlexoVM/flexovm

  1. /**
  2. * Logically ands the bits of this {@code BitSet} with {@code bs}.
  3. */
  4. public void and(BitSet bs) {
  5. int minSize = Math.min(this.longCount, bs.longCount);
  6. for (int i = 0; i < minSize; ++i) {
  7. bits[i] &= bs.bits[i];
  8. }
  9. Arrays.fill(bits, minSize, longCount, 0L);
  10. shrinkSize();
  11. }

代码示例来源:origin: MobiVM/robovm

  1. /**
  2. * Logically ands the bits of this {@code BitSet} with {@code bs}.
  3. */
  4. public void and(BitSet bs) {
  5. int minSize = Math.min(this.longCount, bs.longCount);
  6. for (int i = 0; i < minSize; ++i) {
  7. bits[i] &= bs.bits[i];
  8. }
  9. Arrays.fill(bits, minSize, longCount, 0L);
  10. shrinkSize();
  11. }

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

  1. /**
  2. * Logically ands the bits of this {@code BitSet} with {@code bs}.
  3. */
  4. public void and(BitSet bs) {
  5. int minSize = Math.min(this.longCount, bs.longCount);
  6. for (int i = 0; i < minSize; ++i) {
  7. bits[i] &= bs.bits[i];
  8. }
  9. Arrays.fill(bits, minSize, longCount, 0L);
  10. shrinkSize();
  11. }

相关文章