< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/dom/BitArray.java

Print this page




 116      */
 117     public final int getNextBit(int startBit) {
 118         for (int i = (startBit >>> 5) ; i<=_intSize; i++) {
 119             int bits = _bits[i];
 120             if (bits != 0) {
 121                 for (int b = (startBit % 32); b<32; b++) {
 122                     if ((bits & _masks[b]) != 0) {
 123                         return((i << 5) + b);
 124                     }
 125                 }
 126             }
 127             startBit = 0;
 128         }
 129         return(DTMAxisIterator.END);
 130     }
 131 
 132     /**
 133      * This method returns the Nth bit that is set in the bit array. The
 134      * current position is cached in the following 4 variables and will
 135      * help speed up a sequence of next() call in an index iterator. This
 136      * method is a mess, but it is fast and it works, so don't fuck with it.
 137      */
 138     private int _pos = Integer.MAX_VALUE;
 139     private int _node = 0;
 140     private int _int = 0;
 141     private int _bit = 0;
 142 
 143     public final int getBitNumber(int pos) {
 144 
 145         // Return last node if position we're looking for is the same
 146         if (pos == _pos) return(_node);
 147 
 148         // Start from beginning of position we're looking for is before
 149         // the point where we left off the last time.
 150         if (pos < _pos) {
 151             _int = _bit = _pos = 0;
 152         }
 153 
 154         // Scan through the bit array - skip integers that have no bits set
 155         for ( ; _int <= _intSize; _int++) {
 156             int bits = _bits[_int];




 116      */
 117     public final int getNextBit(int startBit) {
 118         for (int i = (startBit >>> 5) ; i<=_intSize; i++) {
 119             int bits = _bits[i];
 120             if (bits != 0) {
 121                 for (int b = (startBit % 32); b<32; b++) {
 122                     if ((bits & _masks[b]) != 0) {
 123                         return((i << 5) + b);
 124                     }
 125                 }
 126             }
 127             startBit = 0;
 128         }
 129         return(DTMAxisIterator.END);
 130     }
 131 
 132     /**
 133      * This method returns the Nth bit that is set in the bit array. The
 134      * current position is cached in the following 4 variables and will
 135      * help speed up a sequence of next() call in an index iterator. This
 136      * method is a mess, but it is fast and it works, so don't change it.
 137      */
 138     private int _pos = Integer.MAX_VALUE;
 139     private int _node = 0;
 140     private int _int = 0;
 141     private int _bit = 0;
 142 
 143     public final int getBitNumber(int pos) {
 144 
 145         // Return last node if position we're looking for is the same
 146         if (pos == _pos) return(_node);
 147 
 148         // Start from beginning of position we're looking for is before
 149         // the point where we left off the last time.
 150         if (pos < _pos) {
 151             _int = _bit = _pos = 0;
 152         }
 153 
 154         // Scan through the bit array - skip integers that have no bits set
 155         for ( ; _int <= _intSize; _int++) {
 156             int bits = _bits[_int];


< prev index next >