Examples of DoubleIntIndex


Examples of org.hsqldb.lib.DoubleIntIndex

        boolean failed   = false;
        int     testSize = 512;
        org.hsqldb.lib.IntKeyHashMap hIntMap =
            new org.hsqldb.lib.IntKeyHashMap();
        DoubleIntIndex intLookup = new DoubleIntIndex(12, false);

        try {
            intLookup.setKeysSearchTarget();
            populateBySerialIntKeysInt(intLookup, hIntMap, testSize);
            compareByHIteratorInt(intLookup, hIntMap);
            populateByRandomIntKeysInt(intLookup, hIntMap, testSize);
            compareByHIteratorInt(intLookup, hIntMap);
        } catch (Exception e) {
View Full Code Here

Examples of org.hsqldb.lib.DoubleIntIndex

        boolean failed   = false;
        int     testSize = 500;
        org.hsqldb.lib.IntKeyHashMap hIntMap =
            new org.hsqldb.lib.IntKeyHashMap();
        DoubleIntIndex intLookup = new DoubleIntIndex(testSize, false);

        intLookup.setKeysSearchTarget();
        populateByRandomIntKeysInt(intLookup, hIntMap, testSize);
        compareByHIteratorInt(intLookup, hIntMap);

        int[]     sample     = getSampleIntArray(intLookup, 100);
        int[]     sampleVals = new int[sample.length];
        int       i          = 0;
        int       j          = 0;
        StopWatch sw         = new StopWatch();

        try {
            for (j = 0; j < 10000; j++) {
                for (i = 0; i < sample.length; i++) {
                    int pos = intLookup.findFirstEqualKeyIndex(sample[i]);

                    sampleVals[i] = intLookup.getValue(pos);

                    intLookup.remove(pos);
                }

                for (i = 0; i < sample.length; i++) {
                    intLookup.addUnique(sample[i], sampleVals[i]);
                }
            }

            System.out.println(
                sw.elapsedTimeToMessage("Double int table times"));
            intLookup.findFirstEqualKeyIndex(0);    // sort
            compareByHIteratorInt(intLookup, hIntMap);
        } catch (Exception e) {
            System.out.println(
                sw.elapsedTimeToMessage("Double int table error: i =" + i));
View Full Code Here

Examples of org.hsqldb.lib.DoubleIntIndex

  long lostFreeBlockSize;
  boolean isModified;

  public DataFileBlockManager(int paramInt1, int paramInt2, long paramLong)
  {
    this.lookup = new DoubleIntIndex(paramInt1, true);
    this.lookup.setValuesSearchTarget();
    this.capacity = paramInt1;
    this.scale = paramInt2;
    this.lostFreeBlockSize = paramLong;
    this.midSize = 128;
View Full Code Here

Examples of org.hsqldb.lib.DoubleIntIndex

  int[] writeTableToDataFile(Table paramTable)
    throws IOException, HsqlException
  {
    Session localSession = this.database.getSessionManager().getSysSession();
    RowOutputBinary localRowOutputBinary = new RowOutputBinary();
    DoubleIntIndex localDoubleIntIndex = new DoubleIntIndex(paramTable.getPrimaryIndex().sizeEstimate(), false);
    int[] arrayOfInt = paramTable.getIndexRootsArray();
    long l = this.fileOffset;
    int i = 0;
    localDoubleIntIndex.setKeysSearchTarget();
    Trace.printSystemOut("lookup begins: " + this.stopw.elapsedTime());
    RowIterator localRowIterator = paramTable.rowIterator(localSession);
    Row localRow;
    while (localRowIterator.hasNext())
    {
      localRow = localRowIterator.next();
      localDoubleIntIndex.addUnsorted(localRow.getPos(), (int)(l / this.scale));
      if (i % 50000 == 0)
        Trace.printSystemOut("pointer pair for row " + i + " " + localRow.getPos() + " " + l);
      l += localRow.getStorageSize();
      i++;
    }
    Trace.printSystemOut(paramTable.getName().name + " list done ", this.stopw.elapsedTime());
    i = 0;
    localRowIterator = paramTable.rowIterator(localSession);
    while (localRowIterator.hasNext())
    {
      localRow = localRowIterator.next();
      localRowOutputBinary.reset();
      localRow.write(localRowOutputBinary, localDoubleIntIndex);
      this.fileStreamOut.write(localRowOutputBinary.getOutputStream().getBuffer(), 0, localRowOutputBinary.size());
      this.fileOffset += localRow.getStorageSize();
      if (i % 50000 == 0)
        Trace.printSystemOut(i + " rows " + this.stopw.elapsedTime());
      i++;
    }
    for (int j = 0; j < arrayOfInt.length; j++)
    {
      if (arrayOfInt[j] == -1)
        continue;
      int k = localDoubleIntIndex.findFirstEqualKeyIndex(arrayOfInt[j]);
      if (k == -1)
        throw Trace.error(129);
      arrayOfInt[j] = localDoubleIntIndex.getValue(k);
    }
    setTransactionRowLookups(localDoubleIntIndex);
    Trace.printSystemOut(paramTable.getName().name + " : table converted");
    return arrayOfInt;
  }
View Full Code Here

Examples of org.hsqldb.lib.DoubleIntIndex

  }

  public DoubleIntIndex getTransactionIDList()
  {
    Session[] arrayOfSession = this.database.sessionManager.getAllSessions();
    DoubleIntIndex localDoubleIntIndex = new DoubleIntIndex(10, false);
    localDoubleIntIndex.setKeysSearchTarget();
    for (int i = 0; i < arrayOfSession.length; i++)
    {
      HsqlArrayList localHsqlArrayList = arrayOfSession[i].rowActionList;
      int j = 0;
      int k = localHsqlArrayList.size();
      while (j < k)
      {
        Transaction localTransaction = (Transaction)localHsqlArrayList.get(j);
        if (localTransaction.tTable.getTableType() == 4)
          localDoubleIntIndex.addUnique(localTransaction.row.getPos(), 0);
        j++;
      }
    }
    return localDoubleIntIndex;
  }
View Full Code Here

Examples of org.hsqldb_voltpatches.lib.DoubleIntIndex

    public DoubleIntIndex getTransactionIDList() {

        writeLock.lock();

        try {
            DoubleIntIndex lookup = new DoubleIntIndex(10, false);

            lookup.setKeysSearchTarget();

            Iterator it = this.rowActionMap.keySet().iterator();

            for (; it.hasNext(); ) {
                lookup.addUnique(it.nextInt(), 0);
            }

            return lookup;
        } finally {
            writeLock.unlock();
View Full Code Here

Examples of org.hsqldb_voltpatches.lib.DoubleIntIndex

    /**
     *
     */
    public DataFileBlockManager(int capacity, int scale, long lostSize) {

        lookup = new DoubleIntIndex(capacity, true);

        lookup.setValuesSearchTarget();

        this.capacity          = capacity;
        this.scale             = scale;
View Full Code Here

Examples of org.hsqldb_voltpatches.lib.DoubleIntIndex

    int[] writeTableToDataFile(Table table) throws IOException {

        Session session = database.getSessionManager().getSysSession();
        PersistentStore    store  = session.sessionData.getRowStore(table);
        RowOutputInterface rowOut = new RowOutputBinary();
        DoubleIntIndex pointerLookup =
            new DoubleIntIndex(table.getPrimaryIndex().sizeEstimate(store),
                               false);
        int[] rootsArray = table.getIndexRootsArray();
        long  pos        = fileOffset;
        int   count      = 0;

        pointerLookup.setKeysSearchTarget();
        Error.printSystemOut("lookup begins: " + stopw.elapsedTime());

        RowIterator it = table.rowIterator(session);

        for (; it.hasNext(); count++) {
            CachedObject row = it.getNextRow();

            pointerLookup.addUnsorted(row.getPos(), (int) (pos / scale));

            if (count % 50000 == 0) {
                Error.printSystemOut("pointer pair for row " + count + " "
                                     + row.getPos() + " " + pos);
            }

            pos += row.getStorageSize();
        }

        Error.printSystemOut(table.getName().name + " list done ",
                             stopw.elapsedTime());

        count = 0;
        it    = table.rowIterator(session);

        for (; it.hasNext(); count++) {
            CachedObject row = it.getNextRow();

            rowOut.reset();
            row.write(rowOut, pointerLookup);
            fileStreamOut.write(rowOut.getOutputStream().getBuffer(), 0,
                                rowOut.size());

            fileOffset += row.getStorageSize();

            if ((count) % 50000 == 0) {
                Error.printSystemOut(count + " rows " + stopw.elapsedTime());
            }
        }

        for (int i = 0; i < rootsArray.length; i++) {
            if (rootsArray[i] == -1) {
                continue;
            }

            int lookupIndex =
                pointerLookup.findFirstEqualKeyIndex(rootsArray[i]);

            if (lookupIndex == -1) {
                throw Error.error(ErrorCode.DATA_FILE_ERROR);
            }

            rootsArray[i] = pointerLookup.getValue(lookupIndex);
        }

        setTransactionRowLookups(pointerLookup);
        Error.printSystemOut(table.getName().name + " : table converted");
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.