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

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

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

BitSet.and介绍

[英]Logically ands the bits of this BitSet with bs.
[中]逻辑上,将该位集的位与B进行AND运算。

代码示例

代码示例来源:origin: Alluxio/alluxio

  1. /**
  2. * Mask the actions. (And operation)
  3. * @param actions the acl mask
  4. */
  5. public void mask(AclActions actions) {
  6. mActions.and(actions.mActions);
  7. }

代码示例来源:origin: pentaho/pentaho-kettle

  1. void intersect( BitSet set, boolean inverse ) {
  2. if ( inverse ) {
  3. candidates.andNot( set );
  4. } else {
  5. candidates.and( set );
  6. }
  7. checkEmpty();
  8. }

代码示例来源:origin: Sable/soot

  1. /** Clear a {@link BitSet}. */
  2. public static void clear(BitSet bitSet_) {
  3. bitSet_.and(EMPTY_BITSET);
  4. }

代码示例来源:origin: skylot/jadx

  1. d.and(pred.getDoms());

代码示例来源:origin: org.apache.hadoop/hadoop-common

  1. @Override
  2. public void and(Filter filter) {
  3. if(filter == null
  4. || !(filter instanceof BloomFilter)
  5. || filter.vectorSize != this.vectorSize
  6. || filter.nbHash != this.nbHash) {
  7. throw new IllegalArgumentException("filters cannot be and-ed");
  8. }
  9. this.bits.and(((BloomFilter) filter).bits);
  10. }

代码示例来源:origin: org.codehaus.groovy/groovy

  1. /**
  2. * Bitwise AND together two BitSets.
  3. *
  4. * @param left a BitSet
  5. * @param right another BitSet to bitwise AND
  6. * @return the bitwise AND of both BitSets
  7. * @since 1.5.0
  8. */
  9. public static BitSet and(BitSet left, BitSet right) {
  10. BitSet result = (BitSet) left.clone();
  11. result.and(right);
  12. return result;
  13. }

代码示例来源:origin: osmandapp/Osmand

  1. private boolean checkAllTypesShouldBePresent(BitSet types) {
  2. // Bitset method subset is missing "filterTypes.isSubset(types)"
  3. // reset previous evaluation
  4. // evalFilterTypes.clear(); // not needed same as or()
  5. evalFilterTypes.or(filterTypes);
  6. // evaluate bit intersection and check if filterTypes contained as set in types
  7. evalFilterTypes.and(types);
  8. if(!evalFilterTypes.equals(filterTypes)) {
  9. return false;
  10. }
  11. return true;
  12. }

代码示例来源:origin: apache/incubator-druid

  1. public void and(MutableBitmap mutableBitmap)
  2. {
  3. if (mutableBitmap instanceof WrappedBitSetBitmap) {
  4. WrappedBitSetBitmap bitSet = (WrappedBitSetBitmap) mutableBitmap;
  5. this.bitmap.and(bitSet.bitmap);
  6. } else {
  7. throw new IAE(
  8. "Unknown class type: %s expected %s",
  9. mutableBitmap.getClass().getCanonicalName(),
  10. WrappedBitSetBitmap.class.getCanonicalName()
  11. );
  12. }
  13. }

代码示例来源:origin: google/guava

  1. @GwtIncompatible // used only from other GwtIncompatible code
  2. @Override
  3. void setBits(BitSet table) {
  4. BitSet tmp1 = new BitSet();
  5. first.setBits(tmp1);
  6. BitSet tmp2 = new BitSet();
  7. second.setBits(tmp2);
  8. tmp1.and(tmp2);
  9. table.or(tmp1);
  10. }

代码示例来源:origin: ethereum/ethereumj

  1. public boolean hasTopic(Topic topic) {
  2. BitSet m = new BloomFilter(topic).mask;
  3. BitSet m1 = (BitSet) m.clone();
  4. m1.and(mask);
  5. return m1.equals(m);
  6. }

代码示例来源:origin: stackoverflow.com

  1. BitSet bs1 = new BitSet();
  2. bs1.set(2);
  3. bs1.set(5);
  4. bs1.set(7);
  5. bs1.set(8);
  6. BitSet bs2 = new BitSet();
  7. bs2.set(2);
  8. bs2.set(7);
  9. bs2.set(9);
  10. bs1.and(bs2);
  11. // Prints {2, 7}
  12. System.out.println(bs1);

代码示例来源:origin: prestodb/presto

  1. @GwtIncompatible // used only from other GwtIncompatible code
  2. @Override
  3. void setBits(BitSet table) {
  4. BitSet tmp1 = new BitSet();
  5. first.setBits(tmp1);
  6. BitSet tmp2 = new BitSet();
  7. second.setBits(tmp2);
  8. tmp1.and(tmp2);
  9. table.or(tmp1);
  10. }

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

  1. /**
  2. * Called to coalesce a successor's usage into the current BB. Important: This should be called
  3. * before live variable analysis begins, because we don't bother merging this.in or this.born.
  4. */
  5. void absorb(Usage succ) {
  6. BitSet b = (BitSet) this.def.clone();
  7. b.flip(0, nLocals);
  8. b.and(succ.use);
  9. this.use.or(b);
  10. this.def.or(succ.def);
  11. }

代码示例来源:origin: google/j2objc

  1. @GwtIncompatible // used only from other GwtIncompatible code
  2. @Override
  3. void setBits(BitSet table) {
  4. BitSet tmp1 = new BitSet();
  5. first.setBits(tmp1);
  6. BitSet tmp2 = new BitSet();
  7. second.setBits(tmp2);
  8. tmp1.and(tmp2);
  9. table.or(tmp1);
  10. }

代码示例来源:origin: oracle/helidon

  1. @Override
  2. void setBits(BitSet table) {
  3. BitSet tmp1 = new BitSet();
  4. first.setBits(tmp1);
  5. BitSet tmp2 = new BitSet();
  6. second.setBits(tmp2);
  7. tmp1.and(tmp2);
  8. table.or(tmp1);
  9. }

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

  1. @GwtIncompatible // used only from other GwtIncompatible code
  2. @Override
  3. void setBits(BitSet table) {
  4. BitSet tmp1 = new BitSet();
  5. first.setBits(tmp1);
  6. BitSet tmp2 = new BitSet();
  7. second.setBits(tmp2);
  8. tmp1.and(tmp2);
  9. table.or(tmp1);
  10. }

代码示例来源:origin: org.apache.lucene/lucene-core

  1. /**
  2. * Returns the set of live states. A state is "live" if an accept state is
  3. * reachable from it and if it is reachable from the initial state.
  4. */
  5. private static BitSet getLiveStates(Automaton a) {
  6. BitSet live = getLiveStatesFromInitial(a);
  7. live.and(getLiveStatesToAccept(a));
  8. return live;
  9. }

代码示例来源:origin: skylot/jadx

  1. public static BlockNode getPathCross(MethodNode mth, BlockNode b1, BlockNode b2) {
  2. if (b1 == null || b2 == null) {
  3. return null;
  4. }
  5. BitSet b = new BitSet();
  6. b.or(b1.getDomFrontier());
  7. b.and(b2.getDomFrontier());
  8. b.clear(b1.getId());
  9. b.clear(b2.getId());
  10. if (b.cardinality() == 1) {
  11. BlockNode end = mth.getBasicBlocks().get(b.nextSetBit(0));
  12. if (isPathExists(b1, end) && isPathExists(b2, end)) {
  13. return end;
  14. }
  15. }
  16. if (isPathExists(b1, b2)) {
  17. return b2;
  18. }
  19. if (isPathExists(b2, b1)) {
  20. return b1;
  21. }
  22. return null;
  23. }

代码示例来源:origin: Sable/soot

  1. @Override
  2. public void intersection(FlowSet<T> otherFlow, FlowSet<T> destFlow) {
  3. if (sameType(otherFlow) && sameType(destFlow)) {
  4. ArrayPackedSet<T> other = (ArrayPackedSet<T>) otherFlow;
  5. ArrayPackedSet<T> dest = (ArrayPackedSet<T>) destFlow;
  6. copyBitSet(dest).and(other.bits);
  7. } else {
  8. super.intersection(otherFlow, destFlow);
  9. }
  10. }

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

  1. @Override
  2. public void meetInto(BitSet fact, Edge edge, BitSet result) throws DataflowAnalysisException {
  3. if (!edgeChooser.choose(edge)) {
  4. return;
  5. }
  6. if (isTop(fact)) {
  7. return;
  8. } else if (isTop(result)) {
  9. copy(fact, result);
  10. } else {
  11. // Meet is intersection
  12. result.and(fact);
  13. }
  14. }

相关文章