Package org.terrier.structures.BasicLexiconEntry

Examples of org.terrier.structures.BasicLexiconEntry.Factory.newInstance()


  }
 
  @Test public void testWritable() throws Exception
  {
    Factory f = new Factory();
    BasicLexiconEntry le = (BasicLexiconEntry)f.newInstance();
    le.setTermId(100);
    le.setOffset(10, (byte)11);
    byte[] b = getBytes(le);
    System.err.println("le written in "+b.length+" bytes");
    assertEquals(b.length, f.getSize());
View Full Code Here


    le.setTermId(100);
    le.setOffset(10, (byte)11);
    byte[] b = getBytes(le);
    System.err.println("le written in "+b.length+" bytes");
    assertEquals(b.length, f.getSize());
    BasicLexiconEntry leReader = (BasicLexiconEntryf.newInstance();
    populateEntry(leReader, b);
    assertEquals(le.getTermId(), leReader.getTermId());
    assertEquals(le.getFrequency(), leReader.getFrequency());
    assertEquals(le.getDocumentFrequency(), leReader.getDocumentFrequency());
    assertEquals(le.getOffset(), leReader.getOffset());
View Full Code Here

  }
 
  @Test public void testWritableFile() throws Exception
  {
    Factory f = new Factory();
    BasicLexiconEntry le = (BasicLexiconEntry)f.newInstance();
    le.setTermId(100);
    le.setOffset(10, (byte)11);
    File tmpFile = tmpfolder.newFile("test.writable");
    DataOutputStream dos = new DataOutputStream(new FileOutputStream(tmpFile));
    le.write(dos);
View Full Code Here

    le.setOffset(10, (byte)11);
    File tmpFile = tmpfolder.newFile("test.writable");
    DataOutputStream dos = new DataOutputStream(new FileOutputStream(tmpFile));
    le.write(dos);
    dos.close();
    BasicLexiconEntry leReader = (BasicLexiconEntry)f.newInstance();
    leReader.readFields(new DataInputStream(new FileInputStream(tmpFile)));
    assertEquals(le.getTermId(), leReader.getTermId());
    assertEquals(le.getFrequency(), leReader.getFrequency());
    assertEquals(le.getDocumentFrequency(), leReader.getDocumentFrequency());
    assertEquals(le.getOffset(), leReader.getOffset());
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.