Package java.util

Examples of java.util.BitSet


   
    if (y < 0 || y - 1 + height >= this.height) {
      return true;
    }

    final BitSet result = new BitSet();
    for (int i = x; i < x + width; i++) {
      result.or(colls[i]);
    }

    return !result.get(y, y + height).isEmpty();
  }
View Full Code Here


     *
     * @return converted boolean array as BitSet
     */
    public static BitSet getBitSetFromBooleanArray(boolean[] buf)
    {
        BitSet set = new BitSet();
        for (int i = 0; i < buf.length; i++)
        {
            if( buf[i] )
            {
                set.set(i);
            }
        }

        return set;
    }   
View Full Code Here

  }

  public String decode(final String str) {
    try {
      // create a BitSet based on the binary representation
      final BitSet nameSet = createBitSet(str);
       // xor the BitSet with the key
      nameSet.xor(key);

      // turn the xor'd BitSet back into a String
      final StringBuilder strBuff = new StringBuilder(str.length() * 7);
      for (int i = 0; i < nameSet.size(); i++) {
        if (nameSet.get(i)) {
          strBuff.append('1');
        } else {
          strBuff.append('0');
        }
      }
View Full Code Here

      stringSizeBinary = stringToBinary(sizeOfEncodedString.substring(
          i - 1, i));
      binaryString = stringSizeBinary.concat(binaryString);
    }
    // create a BitSet based on the binary representation
    final BitSet nameSet = createBitSet(binaryString);
    // xor the BitSet with the key
    nameSet.xor(key);

    // turn the xor'd BitSet back into a String so it can be written to file
    final StringBuilder strBuff = new StringBuilder(str.length() * 7);
    for (int i = 0; i < nameSet.size(); i++) {
      if (nameSet.get(i)) {
        strBuff.append('1');
      } else {
        strBuff.append('0');
      }
    }
View Full Code Here

  /** creates a BitSet based on a string representation of binary digits.
   * @param binaryString
   * @return the created BitSet
   * */
  private BitSet createBitSet(final String binaryString) {
    final BitSet bset = new BitSet(binaryString.length());
    boolean bitTrue = false;
    for (int i = 0; i < binaryString.length(); i++) {
      if (binaryString.charAt(i) == '1') {
        bitTrue = true;
      } else {
        bitTrue = false;
      }
      bset.set(i, bitTrue);
    }
    return bset;
  }
View Full Code Here

    private void playbackSavepoint(PagerSavepoint pSavepoint) throws SqlJetException {
        long szJ; /* Effective size of the main journal */
        long iHdrOff; /* End of first segment of main-journal records */
        int ii; /* Loop counter */
        SqlJetException rc = null; /* Return code */
        BitSet pDone = null; /* Bitvec to ensure pages played back only once */

        /* Allocate a bitvec to use to store the set of pages rolled back */
        if (pSavepoint != null) {
            pDone = new BitSet(pSavepoint.nOrig);
        }

        /*
         * Truncate the database back to the size it was before the savepoint
         * being reverted was opened.
View Full Code Here

             */
            assert (nRec == 0);
            assert (dbOrigSize == 0);
            assert (pagesInJournal == null);
            getPageCount();
            pagesInJournal = new BitSet(dbSize);
            dbOrigSize = dbSize;
            writeJournalHdr();
        }
        assert (!journalOpen || journalOff > 0);
    }
View Full Code Here

        assert (state.compareTo(SqlJetPagerState.RESERVED) >= 0);
        assert (useJournal);
        assert (pagesInJournal == null);

        getPageCount();
        pagesInJournal = new BitSet(dbSize);

        try {

            if (!journalOpen) {
                if (tempFile) {
View Full Code Here

                    aNew[ii].iOffset = journalOff;
                } else {
                    aNew[ii].iOffset = JOURNAL_HDR_SZ();
                }
                aNew[ii].iSubRec = stmtNRec;
                aNew[ii].pInSavepoint = new BitSet(dbSize);
            }

            /* Open the sub-journal, if it is not already opened. */
            openSubJournal();
        }
View Full Code Here

            return;
        }

        if (pPager.pagesAlwaysRollback == null) {
            assert (pPager.pagesInJournal != null);
            pPager.pagesAlwaysRollback = new BitSet(pPager.dbOrigSize);
        }
        pPager.pagesAlwaysRollback.set(pgno);
        if (flags.contains(SqlJetPageFlags.DIRTY) && pPager.nSavepoint == 0) {
            assert (pPager.state.compareTo(SqlJetPagerState.SHARED) >= 0);
            if (pPager.dbSize == pgno && pPager.dbOrigSize < pPager.dbSize) {
View Full Code Here

TOP

Related Classes of java.util.BitSet

Copyright © 2018 www.massapicom. 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.