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

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

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

/**
 * Mask the actions. (And operation)
 * @param actions the acl mask
 */
public void mask(AclActions actions)  {
 mActions.and(actions.mActions);
}

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

void intersect( BitSet set, boolean inverse ) {
 if ( inverse ) {
  candidates.andNot( set );
 } else {
  candidates.and( set );
 }
 checkEmpty();
}

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

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

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

d.and(pred.getDoms());

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

@Override
public void and(Filter filter) {
 if(filter == null
   || !(filter instanceof BloomFilter)
   || filter.vectorSize != this.vectorSize
   || filter.nbHash != this.nbHash) {
  throw new IllegalArgumentException("filters cannot be and-ed");
 }
 this.bits.and(((BloomFilter) filter).bits);
}

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

/**
 * Bitwise AND together two BitSets.
 *
 * @param left  a BitSet
 * @param right another BitSet to bitwise AND
 * @return the bitwise AND of both BitSets
 * @since 1.5.0
 */
public static BitSet and(BitSet left, BitSet right) {
  BitSet result = (BitSet) left.clone();
  result.and(right);
  return result;
}

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

private boolean checkAllTypesShouldBePresent(BitSet types) {
  // Bitset method subset is missing "filterTypes.isSubset(types)"    
  // reset previous evaluation
  // evalFilterTypes.clear(); // not needed same as or()
  evalFilterTypes.or(filterTypes);
  // evaluate bit intersection and check if filterTypes contained as set in types
  evalFilterTypes.and(types);
  if(!evalFilterTypes.equals(filterTypes)) {
    return false;
  }
  return true;
}

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

public void and(MutableBitmap mutableBitmap)
{
 if (mutableBitmap instanceof WrappedBitSetBitmap) {
  WrappedBitSetBitmap bitSet = (WrappedBitSetBitmap) mutableBitmap;
  this.bitmap.and(bitSet.bitmap);
 } else {
  throw new IAE(
    "Unknown class type: %s  expected %s",
    mutableBitmap.getClass().getCanonicalName(),
    WrappedBitSetBitmap.class.getCanonicalName()
  );
 }
}

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

@GwtIncompatible // used only from other GwtIncompatible code
@Override
void setBits(BitSet table) {
 BitSet tmp1 = new BitSet();
 first.setBits(tmp1);
 BitSet tmp2 = new BitSet();
 second.setBits(tmp2);
 tmp1.and(tmp2);
 table.or(tmp1);
}

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

public boolean hasTopic(Topic topic) {
  BitSet m = new BloomFilter(topic).mask;
  BitSet m1 = (BitSet) m.clone();
  m1.and(mask);
  return m1.equals(m);
}

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

BitSet bs1 = new BitSet();
bs1.set(2);
bs1.set(5);
bs1.set(7);
bs1.set(8);

BitSet bs2 = new BitSet();
bs2.set(2);
bs2.set(7);
bs2.set(9);

bs1.and(bs2);

// Prints {2, 7}
System.out.println(bs1);

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

@GwtIncompatible // used only from other GwtIncompatible code
@Override
void setBits(BitSet table) {
 BitSet tmp1 = new BitSet();
 first.setBits(tmp1);
 BitSet tmp2 = new BitSet();
 second.setBits(tmp2);
 tmp1.and(tmp2);
 table.or(tmp1);
}

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

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

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

@GwtIncompatible // used only from other GwtIncompatible code
@Override
void setBits(BitSet table) {
 BitSet tmp1 = new BitSet();
 first.setBits(tmp1);
 BitSet tmp2 = new BitSet();
 second.setBits(tmp2);
 tmp1.and(tmp2);
 table.or(tmp1);
}

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

@Override
void setBits(BitSet table) {
  BitSet tmp1 = new BitSet();
  first.setBits(tmp1);
  BitSet tmp2 = new BitSet();
  second.setBits(tmp2);
  tmp1.and(tmp2);
  table.or(tmp1);
}

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

@GwtIncompatible // used only from other GwtIncompatible code
@Override
void setBits(BitSet table) {
 BitSet tmp1 = new BitSet();
 first.setBits(tmp1);
 BitSet tmp2 = new BitSet();
 second.setBits(tmp2);
 tmp1.and(tmp2);
 table.or(tmp1);
}

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

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

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

public static BlockNode getPathCross(MethodNode mth, BlockNode b1, BlockNode b2) {
  if (b1 == null || b2 == null) {
    return null;
  }
  BitSet b = new BitSet();
  b.or(b1.getDomFrontier());
  b.and(b2.getDomFrontier());
  b.clear(b1.getId());
  b.clear(b2.getId());
  if (b.cardinality() == 1) {
    BlockNode end = mth.getBasicBlocks().get(b.nextSetBit(0));
    if (isPathExists(b1, end) && isPathExists(b2, end)) {
      return end;
    }
  }
  if (isPathExists(b1, b2)) {
    return b2;
  }
  if (isPathExists(b2, b1)) {
    return b1;
  }
  return null;
}

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

@Override
public void intersection(FlowSet<T> otherFlow, FlowSet<T> destFlow) {
 if (sameType(otherFlow) && sameType(destFlow)) {
  ArrayPackedSet<T> other = (ArrayPackedSet<T>) otherFlow;
  ArrayPackedSet<T> dest = (ArrayPackedSet<T>) destFlow;
  copyBitSet(dest).and(other.bits);
 } else {
  super.intersection(otherFlow, destFlow);
 }
}

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

@Override
public void meetInto(BitSet fact, Edge edge, BitSet result) throws DataflowAnalysisException {
  if (!edgeChooser.choose(edge)) {
    return;
  }
  if (isTop(fact)) {
    return;
  } else if (isTop(result)) {
    copy(fact, result);
  } else {
    // Meet is intersection
    result.and(fact);
  }
}

相关文章