Package java.util

Examples of java.util.BitSet.flip()


      // test ranges, including possible extension
      int fromIndex, toIndex;
      fromIndex = random().nextInt(sz/2);
      toIndex = fromIndex + random().nextInt(sz - fromIndex);
      BitSet aa = (BitSet)a.clone(); aa.flip(fromIndex,toIndex);
      FixedBitSet bb = b.clone(); bb.flip(fromIndex,toIndex);

      doIterate(aa,bb, mode);   // a problem here is from flip or doIterate

      fromIndex = random().nextInt(sz/2);
View Full Code Here


          idx = random().nextInt(sz);
          a.clear(idx);
          b.fastClear((long) idx);
         
          idx = random().nextInt(sz);
          a.flip(idx);
          b.fastFlip(idx);

          boolean val = b.flipAndGet(idx);
          boolean val2 = b.flipAndGet(idx);
          assertTrue(val != val2);
View Full Code Here

          boolean val = b.flipAndGet(idx);
          boolean val2 = b.flipAndGet(idx);
          assertTrue(val != val2);

          idx = random().nextInt(sz);
          a.flip(idx);
          b.fastFlip((long) idx);

          val = b.flipAndGet((long) idx);
          val2 = b.flipAndGet((long) idx);
          assertTrue(val != val2);
View Full Code Here

      // test ranges, including possible extension
      int fromIndex, toIndex;
      fromIndex = random().nextInt(sz+80);
      toIndex = fromIndex + random().nextInt((sz>>1)+1);
      BitSet aa = (BitSet)a.clone(); aa.flip(fromIndex,toIndex);
      OpenBitSet bb = b.clone(); bb.flip(fromIndex,toIndex);

      doIterate(aa,bb, mode);   // a problem here is from flip or doIterate

      fromIndex = random().nextInt(sz+80);
View Full Code Here

    }

    BitSet singleBitDiff( BitSet x, BitSet y ) {
        BitSet t = new BitSet( x.length() );
        t.or( x );
        t.flip(0, t.size());
        t.and( y );

        switch ( t.cardinality() ) {
            case 0 : return t;
            case 1 : return t;
View Full Code Here

    }

    BitSet singleBitDiff( BitSet x, BitSet y ) {
        BitSet t = new BitSet( x.length() );
        t.or( x );
        t.flip(0, t.size());
        t.and( y );

        switch ( t.cardinality() ) {
            case 0 : return t;
            case 1 : return t;
View Full Code Here

    int totalCharacters = table.cardinality();
    if (totalCharacters * 2 <= DISTINCT_CHARS) {
      return precomputedPositive(totalCharacters, table, description);
    } else {
      // TODO(user): is it worth it to worry about the last character of large matchers?
      table.flip(Character.MIN_VALUE, Character.MAX_VALUE + 1);
      int negatedCharacters = DISTINCT_CHARS - totalCharacters;
      String suffix = ".negate()";
      String negatedDescription = description.endsWith(suffix)
          ? description.substring(0, description.length() - suffix.length())
          : description + suffix;
View Full Code Here

    @GwtIncompatible("java.util.BitSet")
    @Override
    void setBits(BitSet table) {
      BitSet tmp = new BitSet();
      original.setBits(tmp);
      tmp.flip(Character.MIN_VALUE, Character.MAX_VALUE + 1);
      table.or(tmp);
    }

    @Override public CharMatcher negate() {
      return original;
View Full Code Here

    }

    BitSet singleBitDiff( BitSet x, BitSet y ) {
        BitSet t = new BitSet( x.length() );
        t.or( x );
        t.flip(0, t.size());
        t.and( y );

        switch ( t.cardinality() ) {
            case 0 : return t;
            case 1 : return t;
View Full Code Here

          idx = random().nextInt(sz);
          a.clear(idx);
          b.clear(idx);
         
          idx = random().nextInt(sz);
          a.flip(idx);
          b.flip(idx, idx+1);

          idx = random().nextInt(sz);
          a.flip(idx);
          b.flip(idx, idx+1);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.