Logo Search packages:      
Sourcecode: jlex version File versions  Download package

static boolean JLex::SparseBitSet::equals ( SparseBitSet  a,
SparseBitSet  b 
) [inline, static]

Compares two SparseBitSets for equality.

Returns:
true if the objects are the same; false otherwise.

Definition at line 7687 of file Main.java.

References bits, offs, and size.

                                                                 {
      for (int i=0, j=0; i<a.size || j<b.size; ) {
          if (i<a.size && (j>=b.size || a.offs[i] < b.offs[j])) {
            if (a.bits[i++]!=0) return false;
          } else if (j<b.size && (i>=a.size || a.offs[i] > b.offs[j])) {
            if (b.bits[j++]!=0) return false;
          } else { // equal keys
            if (a.bits[i++]!=b.bits[j++]) return false;
          }
      }
      return true;
    }

Generated by  Doxygen 1.6.0   Back to index