com.sun.tools.javac.util
Class Bits

java.lang.Object
  extended by com.sun.tools.javac.util.Bits

public class Bits
extends java.lang.Object

A class for extensible, mutable bit sets.

This is NOT part of any API supported by Sun Microsystems. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.


Constructor Summary
Bits()
          Construct an initially empty set.
Bits(int[] bits)
          Construct a set consisting initially of given bit vector.
Bits(int start, int limit)
          Construct a set consisting initially of given range.
 
Method Summary
 Bits andSet(Bits xs)
          this set = this set & xs.
 void clear()
          This set = {}.
 Bits diffSet(Bits xs)
          this set = this set \ xs.
 Bits dup()
          Return a copy of this set.
 void excl(int x)
          Exclude x from this set.
 void incl(int x)
          Include x in this set.
 void inclRange(int start, int limit)
          Include [start..limit) in this set.
 boolean isMember(int x)
          Is x an element of this set?
static void main(java.lang.String[] args)
          Test Bits.nextBit(int).
 int nextBit(int x)
          Return the index of the least bit position >= x that is set.
 Bits orSet(Bits xs)
          this set = this set | xs.
 java.lang.String toString()
          a string representation of this set.
 Bits xorSet(Bits xs)
          this set = this set ^ xs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Bits

public Bits()
Construct an initially empty set.


Bits

public Bits(int[] bits)
Construct a set consisting initially of given bit vector.


Bits

public Bits(int start,
            int limit)
Construct a set consisting initially of given range.

Method Detail

clear

public void clear()
This set = {}.


dup

public Bits dup()
Return a copy of this set.


incl

public void incl(int x)
Include x in this set.


inclRange

public void inclRange(int start,
                      int limit)
Include [start..limit) in this set.


excl

public void excl(int x)
Exclude x from this set.


isMember

public boolean isMember(int x)
Is x an element of this set?


andSet

public Bits andSet(Bits xs)
this set = this set & xs.


orSet

public Bits orSet(Bits xs)
this set = this set | xs.


diffSet

public Bits diffSet(Bits xs)
this set = this set \ xs.


xorSet

public Bits xorSet(Bits xs)
this set = this set ^ xs.


nextBit

public int nextBit(int x)
Return the index of the least bit position >= x that is set. If none are set, returns -1. This provides a nice way to iterate over the members of a bit set:
  for (int i = bits.nextBit(0); i>=0; i = bits.nextBit(i+1)) ...
  


toString

public java.lang.String toString()
a string representation of this set.

Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)
Test Bits.nextBit(int).



Copyright © 2009. All Rights Reserved.