| 
 | " 2013 FRC Java API" | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.squawk.util.BitSet
public final class BitSet
This class provides mechanisms for manipulating a bit set.
| Constructor Summary | |
|---|---|
| BitSet()Creates a new BitSet instance whose underlying byte array is controlled by the instance. | |
| BitSet(byte[] bits)Creates a new BitSet instance whose underlying byte array is controlled by the client of the instance. | |
| Method Summary | |
|---|---|
|  boolean | areBitsExternal() | 
|  int | cardinality()Returns the number of bits set to 1 in this BitSet. | 
|  void | clear()Clears all of the bits in this BitSet. | 
|  void | clear(int bitIndex)Clears the bit at a given index. | 
|  void | copyInto(byte[] bits)Copies the bit set representation into a provided byte array. | 
|  boolean | equals(Object obj)Compares this object against the specified object. | 
|  boolean | get(int bitIndex)Returns the value of the bit with the specified index. | 
|  int | hashCode()Returns a hash code value for this bit set. | 
|  int | length()Returns the "logical size" of this BitSet: the index of
 the highest set bit in theBitSetplus one. | 
|  int | nextSetBit(int fromIndex)Returns the index of the first bit that is set to truethat occurs on or after the specified starting index. | 
|  void | or(BitSet other)Performs a logical OR of this bit set with the bit set argument. | 
|  void | or(BitSet other,
   int shift)Performs a logical OR of this bit set with a given bit set. | 
|  void | set(int bitIndex)Sets the bit at a given index. | 
|  int | size()Returns the number of bits of space actually in use by this BitSetto represent bit values. | 
|  String | toString()Returns a string representation of this bit set. | 
| protected  void | validateIndex(int bitIndex)Determines if a given bit index is valid. | 
| Methods inherited from class java.lang.Object | 
|---|
| getClass, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public BitSet()
public BitSet(byte[] bits)
bits - the underlying byte array| Method Detail | 
|---|
public boolean areBitsExternal()
protected void validateIndex(int bitIndex)
bitIndex - the bit index to test
IndexOutOfBoundsException - is the given index is negativepublic void copyInto(byte[] bits)
bits - the byte array to copy into
NullPointerException - if the given buffer is null.public int length()
BitSet: the index of
 the highest set bit in the BitSet plus one.
BitSet.public int size()
BitSet to represent bit values.
public void set(int bitIndex)
bitIndex - the index of the bit to set
IndexOutOfBoundsException - if the given bit index is negative or if this is
        an external BitSet instance and bitIndex >= this.size()public void clear(int bitIndex)
bitIndex - the index of the bit to clear
IndexOutOfBoundsException - if the given bit index is negativepublic void clear()
public boolean get(int bitIndex)
true if the bit with the index bitIndex
 is currently set in this BitSet; otherwise, the result
 is false.
bitIndex - the bit index.
IndexOutOfBoundsException - if the given bit index is negativepublic int cardinality()
BitSet.
BitSet.public void or(BitSet other)
other
 was set. The semantics of this operation can be expressed as:
 
      this = this | other;
 
other - a bit set
public void or(BitSet other,
               int shift)
      this = this | (other >= 0 ? other << offset : other >> offset);
 
other - a bit setshift - the amount by which other should be logically shifted before being or'ed with this bit setpublic boolean equals(Object obj)
true if and only if the argument is
 not null and is a Bitset object that has
 exactly the same set of bits set to true as this bit
 set. That is, for every nonnegative int index k,
 ((BitSet)obj).get(k) == this.get(k)must be true. The current sizes of the two bit sets are not compared.
Overrides the equals method of Object.
equals in class Objectobj - the object to compare with.
true if the objects are the same;
          false otherwise.BitSet.size()public int hashCode()
hashCode in class ObjectObject.equals(java.lang.Object), 
Hashtablepublic int nextSetBit(int fromIndex)
true
 that occurs on or after the specified starting index. If no such
 bit exists then -1 is returned.
 To iterate over the true bits use the following loop:
 
 for (int i = oopMap.nextSetBit(0); i >= 0; i = oopMap.nextSetBit(i + 1)) {
     // operate on index i here
 }
 
fromIndex - the index to start checking from (inclusive). This must be positive
IndexOutOfBoundsException - if the specified index is negative.public String toString()
BitSet contains a bit in the set
 state, the decimal representation of that index is included in
 the result. Such indices are listed in order from lowest to
 highest, separated by ", " (a comma and a space) and
 surrounded by braces, resulting in the usual mathematical
 notation for a set of integers.
 Overrides the toString method of Object.
 
Example:
BitSet drPepper = new BitSet();Now
drPepper.toString() returns "{}".
drPepper.set(2);Now
drPepper.toString() returns "{2}".
drPepper.set(4); drPepper.set(10);Now
drPepper.toString() returns "{2, 4, 10}".
toString in class Object| 
 | " 2013 FRC Java API" | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||