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

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

本文整理了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

private BitSet(long[] bits) {
  this.bits = bits;
  this.longCount = bits.length;
  shrinkSize();
}

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

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

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

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

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

/**
 * Logically ands the bits of this {@code BitSet} with {@code bs}.
 */
public void and(BitSet bs) {
  int minSize = Math.min(this.longCount, bs.longCount);
  for (int i = 0; i < minSize; ++i) {
    bits[i] &= bs.bits[i];
  }
  Arrays.fill(bits, minSize, longCount, 0L);
  shrinkSize();
}

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

@Override public Object clone() {
  try {
    BitSet clone = (BitSet) super.clone();
    clone.bits = bits.clone();
    clone.shrinkSize();
    return clone;
  } catch (CloneNotSupportedException e) {
    throw new AssertionError(e);
  }
}

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

/**
 * Clears the bit at index {@code index}.
 *
 * @throws IndexOutOfBoundsException if {@code index < 0}.
 */
public void clear(int index) {
  if (index < 0) { // TODO: until we have an inlining JIT.
    checkIndex(index);
  }
  int arrayIndex = index / 64;
  if (arrayIndex >= longCount) {
    return;
  }
  bits[arrayIndex] &= ~(1L << index);
  shrinkSize();
}

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

/**
 * Logically xors the bits of this {@code BitSet} with {@code bs}.
 */
public void xor(BitSet bs) {
  int minSize = Math.min(this.longCount, bs.longCount);
  int maxSize = Math.max(this.longCount, bs.longCount);
  ensureCapacity(maxSize);
  for (int i = 0; i < minSize; ++i) {
    bits[i] ^= bs.bits[i];
  }
  if (bs.longCount > minSize) {
    System.arraycopy(bs.bits, minSize, bits, minSize, maxSize - minSize);
  }
  longCount = maxSize;
  shrinkSize();
}

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

shrinkSize();

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

/**
 * Flips the bit at index {@code index}.
 *
 * @throws IndexOutOfBoundsException if {@code index < 0}.
 */
public void flip(int index) {
  if (index < 0) { // TODO: until we have an inlining JIT.
    checkIndex(index);
  }
  int arrayIndex = index / 64;
  if (arrayIndex >= bits.length) {
    ensureCapacity(arrayIndex + 1);
  }
  bits[arrayIndex] ^= (1L << index);
  longCount = Math.max(longCount, arrayIndex + 1);
  shrinkSize();
}

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

shrinkSize();

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

private BitSet(long[] bits) {
  this.bits = bits;
  this.longCount = bits.length;
  shrinkSize();
}

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

private BitSet(long[] bits) {
  this.bits = bits;
  this.longCount = bits.length;
  shrinkSize();
}

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

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

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

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

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

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

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

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

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

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

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

/**
 * Logically ands the bits of this {@code BitSet} with {@code bs}.
 */
public void and(BitSet bs) {
  int minSize = Math.min(this.longCount, bs.longCount);
  for (int i = 0; i < minSize; ++i) {
    bits[i] &= bs.bits[i];
  }
  Arrays.fill(bits, minSize, longCount, 0L);
  shrinkSize();
}

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

/**
 * Logically ands the bits of this {@code BitSet} with {@code bs}.
 */
public void and(BitSet bs) {
  int minSize = Math.min(this.longCount, bs.longCount);
  for (int i = 0; i < minSize; ++i) {
    bits[i] &= bs.bits[i];
  }
  Arrays.fill(bits, minSize, longCount, 0L);
  shrinkSize();
}

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

/**
 * Logically ands the bits of this {@code BitSet} with {@code bs}.
 */
public void and(BitSet bs) {
  int minSize = Math.min(this.longCount, bs.longCount);
  for (int i = 0; i < minSize; ++i) {
    bits[i] &= bs.bits[i];
  }
  Arrays.fill(bits, minSize, longCount, 0L);
  shrinkSize();
}

相关文章