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

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

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

BitSet.or介绍

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

代码示例

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

  1. protected void merge(BitSet in1, BitSet in2, BitSet out) {
  2. out.clear();
  3. out.or(in1);
  4. out.or(in2);
  5. }

代码示例来源: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: 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: mpetazzoni/ttorrent

  1. public PieceStorageImpl(TorrentByteStorage fileCollectionStorage,
  2. BitSet availablePieces,
  3. int piecesCount,
  4. int pieceSize) {
  5. this.fileCollectionStorage = fileCollectionStorage;
  6. this.readWriteLock = new ReentrantReadWriteLock();
  7. this.piecesCount = piecesCount;
  8. this.pieceSize = pieceSize;
  9. BitSet bitSet = new BitSet(piecesCount);
  10. bitSet.or(availablePieces);
  11. if (bitSet.cardinality() != piecesCount) {
  12. this.availablePieces = bitSet;
  13. }
  14. isOpen = false;
  15. }

代码示例来源:origin: pxb1988/dex2jar

  1. BitSet excludeColor = new BitSet();
  2. BitSet suggestColor = new BitSet();
  3. BitSet globalExcludes = new BitSet();
  4. BitSet usedInOneType = new BitSet();
  5. for (Map.Entry<Character, List<Reg>> e : groups.entrySet()) {
  6. excludeParameters(excludeColor, args, type);
  7. excludeColor.or(globalExcludes); // exclude index used by other types
  8. globalExcludes.or(usedInOneType);
  9. usedInOneType.clear();

代码示例来源:origin: twitter/distributedlog

  1. /**
  2. * Performs a deep copy on <i>other</i>.
  3. */
  4. public AccessControlEntry(AccessControlEntry other) {
  5. __isset_bit_vector.clear();
  6. __isset_bit_vector.or(other.__isset_bit_vector);
  7. this.denyWrite = other.denyWrite;
  8. this.denyTruncate = other.denyTruncate;
  9. this.denyDelete = other.denyDelete;
  10. this.denyAcquire = other.denyAcquire;
  11. this.denyRelease = other.denyRelease;
  12. }

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

  1. @GwtIncompatible // used only from other GwtIncompatible code
  2. @Override
  3. void setBits(BitSet table) {
  4. BitSet tmp = new BitSet();
  5. original.setBits(tmp);
  6. tmp.flip(Character.MIN_VALUE, Character.MAX_VALUE + 1);
  7. table.or(tmp);
  8. }

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

  1. BlockNode block = basicBlocks.get(i);
  2. block.setId(i);
  3. block.setDoms(new BitSet(nBlocks));
  4. block.getDoms().set(0, nBlocks);
  5. entryBlock.getDoms().clear();
  6. entryBlock.getDoms().set(entryBlock.getId());
  7. BitSet dset = new BitSet(nBlocks);
  8. boolean changed;
  9. do {
  10. dset.clear();
  11. dset.or(d);
  12. basicBlocks.forEach(block -> block.getDoms().clear(block.getId()));
  13. idom = preds.get(0);
  14. } else {
  15. BitSet bs = new BitSet(block.getDoms().length());
  16. bs.or(block.getDoms());
  17. for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
  18. BlockNode dom = basicBlocks.get(i);

代码示例来源:origin: twitter/distributedlog

  1. /**
  2. * Performs a deep copy on <i>other</i>.
  3. */
  4. public HeartbeatOptions(HeartbeatOptions other) {
  5. __isset_bit_vector.clear();
  6. __isset_bit_vector.or(other.__isset_bit_vector);
  7. this.sendHeartBeatToReader = other.sendHeartBeatToReader;
  8. }

代码示例来源:origin: atlassian/commonmark-java

  1. public static BitSet calculateSpecialCharacters(BitSet delimiterCharacters) {
  2. BitSet bitSet = new BitSet();
  3. bitSet.or(delimiterCharacters);
  4. bitSet.set('\n');
  5. bitSet.set('`');
  6. bitSet.set('[');
  7. bitSet.set(']');
  8. bitSet.set('\\');
  9. bitSet.set('!');
  10. bitSet.set('<');
  11. bitSet.set('&');
  12. return bitSet;
  13. }

代码示例来源:origin: apache/kylin

  1. final BitSet parent2Key = second.getRepresentation();
  2. final BitSet child1Key = new BitSet(length);
  3. final BitSet child2Key = new BitSet(length);
  4. a.clear(crossoverIndex, length);
  5. BitSet b = (BitSet) parent2Key.clone();
  6. b.clear(0, crossoverIndex);
  7. c.clear(crossoverIndex, length);
  8. BitSet d = (BitSet) parent2Key.clone();
  9. d.clear(0, crossoverIndex);
  10. child1Key.or(a);
  11. child1Key.or(d);
  12. child2Key.or(c);
  13. child2Key.or(b);
  14. return new ChromosomePair(first.newBitsChromosome(child1Key), second.newBitsChromosome(child2Key));

代码示例来源:origin: twitter/distributedlog

  1. /**
  2. * Performs a deep copy on <i>other</i>.
  3. */
  4. public setAcceptNewStream_args(setAcceptNewStream_args other) {
  5. __isset_bit_vector.clear();
  6. __isset_bit_vector.or(other.__isset_bit_vector);
  7. this.enabled = other.enabled;
  8. }

代码示例来源: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: skylot/jadx

  1. BitSet outs = new BitSet(basicBlocks.size());
  2. outs.or(block.getDomFrontier());
  3. for (BlockNode s : block.getCleanSuccessors()) {
  4. BitSet df = s.getDomFrontier();
  5. if (second.getDomFrontier().get(first.getId())) {
  6. fallThroughCases.put(s, second);
  7. df = new BitSet(df.size());
  8. df.set(first.getId());
  9. } else if (first.getDomFrontier().get(second.getId())) {
  10. fallThroughCases.put(s, first);
  11. df = new BitSet(df.size());
  12. df.set(second.getId());
  13. outs.or(df);
  14. outs.clear(block.getId());
  15. if (loop != null) {
  16. outs.clear(loop.getStart().getId());
  17. outs.andNot(b.getDomFrontier());
  18. if (b.contains(AFlag.LOOP_START)) {
  19. outs.clear(b.getId());
  20. } else {
  21. for (BlockNode s : b.getCleanSuccessors()) {

代码示例来源:origin: alibaba/mdrill

  1. /**
  2. * Performs a deep copy on <i>other</i>.
  3. */
  4. public KillOptions(KillOptions other) {
  5. __isset_bit_vector.clear();
  6. __isset_bit_vector.or(other.__isset_bit_vector);
  7. this.wait_secs = other.wait_secs;
  8. }

代码示例来源:origin: mpetazzoni/ttorrent

  1. @Override
  2. public BitSet getAvailablePieces() {
  3. try {
  4. readWriteLock.readLock().lock();
  5. BitSet result = new BitSet(piecesCount);
  6. BitSet availablePieces = this.availablePieces;
  7. boolean isFullyDownloaded = availablePieces == null;
  8. if (isFullyDownloaded) {
  9. result.set(0, piecesCount);
  10. return result;
  11. }
  12. result.or(availablePieces);
  13. return result;
  14. } finally {
  15. readWriteLock.readLock().unlock();
  16. }
  17. }

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

  1. private void removeStrictlyPostDominatedLocations(Set<Location> locations, PostDominatorsAnalysis postDomAnalysis) {
  2. BitSet strictlyDominated = new BitSet();
  3. for (Location loc : locations) {
  4. BitSet allDominatedBy = postDomAnalysis.getAllDominatedBy(loc.getBasicBlock());
  5. allDominatedBy.clear(loc.getBasicBlock().getLabel());
  6. strictlyDominated.or(allDominatedBy);
  7. }
  8. LinkedList<Location> locations2 = new LinkedList<>(locations);
  9. for (Iterator<Location> i = locations.iterator(); i.hasNext();) {
  10. Location loc = i.next();
  11. if (strictlyDominated.get(loc.getBasicBlock().getLabel())) {
  12. i.remove();
  13. continue;
  14. }
  15. for (Location loc2 : locations2) {
  16. if (loc.getBasicBlock().equals(loc2.getBasicBlock())
  17. && loc.getHandle().getPosition() > loc2.getHandle().getPosition()) {
  18. i.remove();
  19. break;
  20. }
  21. }
  22. }
  23. }

代码示例来源:origin: alibaba/mdrill

  1. /**
  2. * Performs a deep copy on <i>other</i>.
  3. */
  4. public RebalanceOptions(RebalanceOptions other) {
  5. __isset_bit_vector.clear();
  6. __isset_bit_vector.or(other.__isset_bit_vector);
  7. this.wait_secs = other.wait_secs;
  8. }

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

  1. private static BitSet validCookieNameOctets(BitSet validCookieValueOctets) {
  2. BitSet bits = new BitSet(8);
  3. bits.or(validCookieValueOctets);
  4. bits.set('(', false);
  5. bits.set(')', false);
  6. bits.set('<', false);
  7. bits.set('>', false);
  8. bits.set('@', false);
  9. bits.set(':', false);
  10. bits.set('/', false);
  11. bits.set('[', false);
  12. bits.set(']', false);
  13. bits.set('?', false);
  14. bits.set('=', false);
  15. bits.set('{', false);
  16. bits.set('}', false);
  17. bits.set(' ', false);
  18. bits.set('\t', false);
  19. return bits;
  20. }

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

  1. private void removeStrictlyDominatedLocations(Set<Location> locations, DominatorsAnalysis domAnalysis) {
  2. BitSet strictlyDominated = new BitSet();
  3. for (Location loc : locations) {
  4. BitSet allDominatedBy = domAnalysis.getAllDominatedBy(loc.getBasicBlock());
  5. allDominatedBy.clear(loc.getBasicBlock().getLabel());
  6. strictlyDominated.or(allDominatedBy);
  7. }
  8. LinkedList<Location> locations2 = new LinkedList<>(locations);
  9. for (Iterator<Location> i = locations.iterator(); i.hasNext();) {
  10. Location loc = i.next();
  11. if (strictlyDominated.get(loc.getBasicBlock().getLabel())) {
  12. i.remove();
  13. continue;
  14. }
  15. for (Location loc2 : locations2) {
  16. if (loc.getBasicBlock().equals(loc2.getBasicBlock())
  17. && loc.getHandle().getPosition() > loc2.getHandle().getPosition()) {
  18. i.remove();
  19. break;
  20. }
  21. }
  22. }
  23. }

相关文章