Package org.hsqldb.lib

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


        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

  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

  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

  }

  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

TOP

Related Classes of org.hsqldb.lib.DoubleIntIndex

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.