Package eu.stratosphere.pact.runtime.test.util

Examples of eu.stratosphere.pact.runtime.test.util.UniformStringPairGenerator


  public void testVariableLengthStringBuildAndRetrieve() {
   
    try {
      final int NUM_MEM_PAGES = 40 * NUM_PAIRS / PAGE_SIZE;
     
      MutableObjectIterator<StringPair> buildInput = new UniformStringPairGenerator(NUM_PAIRS, 1, false);
     
      MutableObjectIterator<StringPair> probeTester = new UniformStringPairGenerator(NUM_PAIRS, 1, false);
     
      MutableObjectIterator<StringPair> updater = new UniformStringPairGenerator(NUM_PAIRS, 1, false);

      MutableObjectIterator<StringPair> updateTester = new UniformStringPairGenerator(NUM_PAIRS, 1, false);
     
      //long start = 0L;
      //long end = 0L;
     
      //long first = System.currentTimeMillis();
     
      //System.out.println("Creating and filling CompactingHashMap...");
      //start = System.currentTimeMillis();
      AbstractMutableHashTable<StringPair> table = new CompactingHashTable<StringPair>(serializerS, comparatorS, getMemory(NUM_MEM_PAGES, PAGE_SIZE));
      table.open();
     
      StringPair target = new StringPair();
      while(buildInput.next(target) != null) {
        table.insert(target);
      }
      //end = System.currentTimeMillis();
      //System.out.println("HashMap ready. Time: " + (end-start) + " ms");
     
      //System.out.println("Starting first probing run...");
      //start = System.currentTimeMillis();

      AbstractHashTableProber<StringPair, StringPair> prober = table.getProber(comparatorS, pairComparatorS);
      StringPair temp = new StringPair();
      while(probeTester.next(target) != null) {
        assertTrue(prober.getMatchFor(target, temp));
        assertEquals(temp.getValue(), target.getValue());
      }
      //end = System.currentTimeMillis();
      //System.out.println("Probing done. Time: " + (end-start) + " ms");
     
      //System.out.println("Starting update...");
      //start = System.currentTimeMillis();
      while(updater.next(target) != null) {
        target.setValue(target.getValue());
        table.insertOrReplaceRecord(target, temp);
      }
      //end = System.currentTimeMillis();
      //System.out.println("Update done. Time: " + (end-start) + " ms");
     
      //System.out.println("Starting second probing run...");
      //start = System.currentTimeMillis();
      while (updateTester.next(target) != null) {
        assertTrue(prober.getMatchFor(target, temp));
        assertEquals(target.getValue(), temp.getValue());
      }
      //end = System.currentTimeMillis();
      //System.out.println("Probing done. Time: " + (end-start) + " ms");
View Full Code Here

TOP

Related Classes of eu.stratosphere.pact.runtime.test.util.UniformStringPairGenerator

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.