Package org.terrier.structures.seralization

Examples of org.terrier.structures.seralization.FixedSizeIntWritableFactory


    {
      forwardWriters[i] = new MultiFSOMapWriter(
        _index.getPath() + "/" + _index.getPrefix() + "."+structureName+"-"+i+FSOrderedMapFile.USUAL_EXTENSION,
        REVERSE_KEY_LOOKUP_WRITING_BUFFER_SIZE,
        keyFactories[i] = new FixedSizeTextFactory(valueLensChars[forwardKeys[i]]),
        new FixedSizeIntWritableFactory()
        );
      forwardKeyValuesSorted[i] = true;
    }
   
    this.valueLensBytes = new int[keyNames.length];
View Full Code Here


    key2forwardOffset = new TObjectIntHashMap<String>(2);
    final String[] forwardKeys = index.getIndexProperty("index."+structureName+".reverse-key-names", "").split("\\s*,\\s*");
    forwardMetaMaps = (Map<Text,IntWritable>[])new Map[forwardKeys.length];
    keyFactories = (FixedSizeWriteableFactory<Text>[])new FixedSizeWriteableFactory[forwardKeys.length];
    i=0;
    final FixedSizeIntWritableFactory valueFactory = new FixedSizeIntWritableFactory();
    for(String keyName : forwardKeys)
    {
      if (keyName.trim().equals(""))
        continue;
      key2forwardOffset.put(keyName, 1+i);
View Full Code Here

 
  @Test public void testStream() throws Exception
  {
    FixedSizeTextFactory keyFactory = new FixedSizeTextFactory(20);
    FSOrderedMapFile.EntryIterator<Text, IntWritable> inputStream = new FSOrderedMapFile.EntryIterator<Text, IntWritable>(
        file, keyFactory, new FixedSizeIntWritableFactory());
    readStream(inputStream);
    inputStream.close();
  }
View Full Code Here

 
  @Test public void testStreamSkip() throws Exception
  {
    FixedSizeTextFactory keyFactory = new FixedSizeTextFactory(20);
    FSOrderedMapFile.EntryIterator<Text, IntWritable> inputStream = new FSOrderedMapFile.EntryIterator<Text, IntWritable>(
        file, keyFactory, new FixedSizeIntWritableFactory());
    readStreamSkip(inputStream, testKeys.length);
    inputStream.close();
  }
View Full Code Here

  }
 
  @Test public void testOnDisk() throws Exception
  {
    FixedSizeTextFactory keyFactory = new FixedSizeTextFactory(20);
    FSOrderedMapFile<Text, IntWritable> mapfile = new FSOrderedMapFile<Text, IntWritable>(file, false, keyFactory, new FixedSizeIntWritableFactory());
    checkKeys(keyFactory, mapfile);
  }
View Full Code Here

  }
 
  @Test public void testInMemory() throws Exception
  {
    FixedSizeTextFactory keyFactory = new FixedSizeTextFactory(20);
    Map<Text, IntWritable> mapfileInMem = new FSOrderedMapFile.MapFileInMemory<Text, IntWritable>(file, keyFactory, new FixedSizeIntWritableFactory());
    checkKeys(keyFactory, mapfileInMem);
  }
View Full Code Here

  @Test public void testInMemoryRandomDataInputMemory() throws Exception
  {
    FixedSizeTextFactory keyFactory = new FixedSizeTextFactory(20);
    Map<Text, IntWritable> mapfileInMem = new FSOrderedMapFile<Text, IntWritable>(
        new RandomDataInputMemory(file), file,
        keyFactory, new FixedSizeIntWritableFactory());
    checkKeys(keyFactory, mapfileInMem);
  }
View Full Code Here

  }
 
  /** Test that random access on one on disk works as expected */
  @Test public void testRandom() throws Exception
  {
    List<IntWritable> list = new FSArrayFile<IntWritable>(arrayFile, false, new FixedSizeIntWritableFactory());
    testRandom(list);
  }
View Full Code Here

  }
 
  /** Test that random access on one in memory works as expected */
  @Test public void testRandomInMem() throws Exception
  {
    List<IntWritable> list = new FSArrayFileInMem<IntWritable>(arrayFile, false, new FixedSizeIntWritableFactory());
    testRandom(list);
  }
View Full Code Here

  }
 
  /** Test that the stream works as expected */
  @Test public void testStream() throws Exception
  {
    Iterator<IntWritable> iterator = new FSArrayFile.ArrayFileIterator<IntWritable>(arrayFile, new FixedSizeIntWritableFactory());
    int i=0;
    while(iterator.hasNext())
    {
      assertEquals(TEST_INTEGERS[i], iterator.next().get());
      i++;
View Full Code Here

TOP

Related Classes of org.terrier.structures.seralization.FixedSizeIntWritableFactory

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.