Tabnine Logo
BitSet
Code IndexAdd Tabnine to your IDE (free)

How to use
BitSet
in
java.util

Best Java code snippets using java.util.BitSet (Showing top 20 results out of 15,291)

Refine searchRefine arrow

  • TTupleProtocol
  • TList
  • TMap
origin: jenkinsci/jenkins

public ArgumentListBuilder prepend(String... args) {
  // left-shift the mask
  BitSet nm = new BitSet(this.args.size()+args.length);
  for(int i=0; i<this.args.size(); i++)
    nm.set(i+args.length, mask.get(i));
  mask = nm;
  this.args.addAll(0, Arrays.asList(args));
  return this;
}
origin: pxb1988/dex2jar

private void initExcludeColor(BitSet excludeColor, Reg as) {
  excludeColor.clear();
  for (Reg ex : as.excludes) {
    if (ex.reg >= 0) {
      excludeColor.set(ex.reg);
      if (ex.type == 'J' || ex.type == 'D') {
        excludeColor.set(ex.reg + 1);
      }
    }
  }
}
origin: apache/incubator-druid

/**
 * Clear the info about which rows (in which original iterators and which row nums within them) were combined on
 * the previous step.
 */
private void clearCombinedRowsInfo()
{
 for (int originalIteratorIndex = indexesOfCurrentlyCombinedOriginalIterators.nextSetBit(0);
    originalIteratorIndex >= 0;
    originalIteratorIndex = indexesOfCurrentlyCombinedOriginalIterators.nextSetBit(originalIteratorIndex + 1)) {
  minCurrentlyCombinedRowNumByOriginalIteratorIndex[originalIteratorIndex] =
    MIN_CURRENTLY_COMBINED_ROW_NUM_UNSET_VALUE;
 }
 indexesOfCurrentlyCombinedOriginalIterators.clear();
}
origin: google/guava

private BitSetMatcher(BitSet table, String description) {
 super(description);
 if (table.length() + Long.SIZE < table.size()) {
  table = (BitSet) table.clone();
  // If only we could actually call BitSet.trimToSize() ourselves...
 }
 this.table = table;
}
origin: netty/netty

  public void setCleanerFlag(int index) {
    if (cleanerFlags == null) {
      cleanerFlags = new BitSet();
    }
    cleanerFlags.set(index);
  }
}
origin: redisson/redisson

private static byte[] toByteArrayReverse(BitSet bits) {
  byte[] bytes = new byte[bits.length() / 8 + 1];
  for (int i = 0; i < bits.length(); i++) {
    if (bits.get(i)) {
      final int value = bytes[i / 8] | (1 << (7 - (i % 8)));
      bytes[i / 8] = (byte) value;
    }
  }
  return bytes;
}
origin: apache/zeppelin

@Override
public void write(org.apache.thrift.protocol.TProtocol prot, appendOutput_args struct) throws org.apache.thrift.TException {
 TTupleProtocol oprot = (TTupleProtocol) prot;
 BitSet optionals = new BitSet();
 if (struct.isSetEvent()) {
  optionals.set(0);
 }
 oprot.writeBitSet(optionals, 1);
 if (struct.isSetEvent()) {
  struct.event.write(oprot);
 }
}
origin: apache/zeppelin

 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, getAllResources_result struct) throws org.apache.thrift.TException {
  TTupleProtocol iprot = (TTupleProtocol) prot;
  BitSet incoming = iprot.readBitSet(1);
  if (incoming.get(0)) {
   {
    org.apache.thrift.protocol.TList _list29 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
    struct.success = new ArrayList<String>(_list29.size);
    String _elem30;
    for (int _i31 = 0; _i31 < _list29.size; ++_i31)
    {
     _elem30 = iprot.readString();
     struct.success.add(_elem30);
    }
   }
   struct.setSuccessIsSet(true);
  }
 }
}
origin: apache/hive

 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, EnvironmentContext struct) throws org.apache.thrift.TException {
  TTupleProtocol iprot = (TTupleProtocol) prot;
  BitSet incoming = iprot.readBitSet(1);
  if (incoming.get(0)) {
   {
    org.apache.thrift.protocol.TMap _map324 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
    struct.properties = new HashMap<String,String>(2*_map324.size);
    String _key325;
    String _val326;
    for (int _i327 = 0; _i327 < _map324.size; ++_i327)
    {
     _key325 = iprot.readString();
     _val326 = iprot.readString();
     struct.properties.put(_key325, _val326);
    }
   }
   struct.setPropertiesIsSet(true);
  }
 }
}
origin: stanfordnlp/CoreNLP

/** helper for gap encoding. */
private static byte[] bitSetToByteArray(BitSet bitSet) {
 while (bitSet.length() % 8 != 0) { bitSet.set(bitSet.length(), true); }
 byte[] array = new byte[bitSet.length()/8];
 for (int i = 0; i < array.length; i++) {
  int offset = i * 8;
  int index = 0;
  for (int j = 0; j < 8; j++) {
   index <<= 1;
   if (bitSet.get(offset+j)) { index++; }
  }
  array[i] = (byte)(index - 128);
 }
 return array;
}
origin: apache/zeppelin

@Override
public void write(org.apache.thrift.protocol.TProtocol prot, getStatus_result struct) throws org.apache.thrift.TException {
 TTupleProtocol oprot = (TTupleProtocol) prot;
 BitSet optionals = new BitSet();
 if (struct.isSetSuccess()) {
  optionals.set(0);
 }
 oprot.writeBitSet(optionals, 1);
 if (struct.isSetSuccess()) {
  oprot.writeString(struct.success);
 }
}
origin: skylot/jadx

  if (s.getIDom() != block) {
    if (domFrontier == null) {
      domFrontier = new BitSet(blocks.size());
    domFrontier.set(s.getId());
  for (int p = frontier.nextSetBit(0); p >= 0; p = frontier.nextSetBit(p + 1)) {
    if (blocks.get(p).getIDom() != block) {
      if (domFrontier == null) {
        domFrontier = new BitSet(blocks.size());
      domFrontier.set(p);
if (domFrontier == null || domFrontier.cardinality() == 0) {
  domFrontier = EMPTY;
origin: spring-projects/spring-framework

private void doParse(String[] fields) {
  setNumberHits(this.seconds, fields[0], 0, 60);
  setNumberHits(this.minutes, fields[1], 0, 60);
  setNumberHits(this.hours, fields[2], 0, 24);
  setDaysOfMonth(this.daysOfMonth, fields[3]);
  setMonths(this.months, fields[4]);
  setDays(this.daysOfWeek, replaceOrdinals(fields[5], "SUN,MON,TUE,WED,THU,FRI,SAT"), 8);
  if (this.daysOfWeek.get(7)) {
    // Sunday can be represented as 0 or 7
    this.daysOfWeek.set(0);
    this.daysOfWeek.clear(7);
  }
}
origin: google/guava

 @Override
 void setBits(BitSet table) {
  if (containsZero) {
   table.set(0);
  }
  for (char c : this.table) {
   if (c != 0) {
    table.set(c);
   }
  }
 }
}
origin: apache/zeppelin

@Override
public void write(org.apache.thrift.protocol.TProtocol prot, resourceGet_result struct) throws org.apache.thrift.TException {
 TTupleProtocol oprot = (TTupleProtocol) prot;
 BitSet optionals = new BitSet();
 if (struct.isSetSuccess()) {
  optionals.set(0);
 }
 oprot.writeBitSet(optionals, 1);
 if (struct.isSetSuccess()) {
  oprot.writeBinary(struct.success);
 }
}
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: apache/zeppelin

@Override
public void write(org.apache.thrift.protocol.TProtocol prot, getProgress_result struct) throws org.apache.thrift.TException {
 TTupleProtocol oprot = (TTupleProtocol) prot;
 BitSet optionals = new BitSet();
 if (struct.isSetSuccess()) {
  optionals.set(0);
 }
 oprot.writeBitSet(optionals, 1);
 if (struct.isSetSuccess()) {
  oprot.writeI32(struct.success);
 }
}
origin: google/guava

@Override
public boolean matches(char c) {
 return table.get(c);
}
origin: google/guava

@GwtIncompatible // java.util.BitSet
private void doTestSetBits(CharMatcher matcher) {
 BitSet bitset = new BitSet();
 matcher.setBits(bitset);
 for (int i = Character.MIN_VALUE; i <= Character.MAX_VALUE; i++) {
  assertEquals(matcher.matches((char) i), bitset.get(i));
 }
}
origin: google/guava

static CharMatcher from(BitSet chars, String description) {
 // Compute the filter.
 long filter = 0;
 int size = chars.cardinality();
 boolean containsZero = chars.get(0);
 // Compute the hash table.
 char[] table = new char[chooseTableSize(size)];
 int mask = table.length - 1;
 for (int c = chars.nextSetBit(0); c != -1; c = chars.nextSetBit(c + 1)) {
  // Compute the filter at the same time.
  filter |= 1L << c;
  int index = smear(c) & mask;
  while (true) {
   // Check for empty.
   if (table[index] == 0) {
    table[index] = (char) c;
    break;
   }
   // Linear probing.
   index = (index + 1) & mask;
  }
 }
 return new SmallCharMatcher(table, filter, containsZero, description);
}
java.utilBitSet

Javadoc

The BitSet class implements a bit array. Each element is either true or false. A BitSet is created with a given size and grows automatically if this size is exceeded.

Most used methods

  • set
    Sets the bit at the specified index to the specified value.
  • get
    Returns a new BitSet composed of bits from this BitSet from fromIndex(inclusive) to toIndex(exclusiv
  • <init>
    Creates a bit set using words as the internal representation. The last word (if there is one) must b
  • clear
    Sets the bits from the specified fromIndex(inclusive) to the specified toIndex(exclusive) to false.
  • nextSetBit
  • cardinality
    Returns the number of bits set to true in thisBitSet.
  • length
    Returns the "logical size" of this BitSet: the index of the highest set bit in the BitSet plus one.
  • or
    Performs a logical OR of this bit set with the bit set argument. This bit set is modified so that a
  • clone
    Cloning this BitSet produces a new BitSet that is equal to it. The clone of the bit set is another b
  • size
    Returns the number of bits of space actually in use by thisBitSet to represent bit values. The maxim
  • isEmpty
    Returns true if this BitSet contains no bits that are set to true.
  • nextClearBit
    Returns the index of the first bit that is set to false that occurs on or after the specified starti
  • isEmpty,
  • nextClearBit,
  • and,
  • equals,
  • flip,
  • valueOf,
  • hashCode,
  • andNot,
  • toByteArray,
  • toString

Popular in Java

  • Making http requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setRequestProperty (URLConnection)
  • getContentResolver (Context)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Join (org.hibernate.mapping)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now