![JAR search and dependency download from the Maven repository](/logo.png)
test.it.unimi.dsi.big.mg4j.search.AndDocumentIteratorTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mg4j-big Show documentation
Show all versions of mg4j-big Show documentation
MG4J (Managing Gigabytes for Java) is a free full-text search engine for large document collections written in Java. The big version is a fork of the original MG4J that can handle more than 2^31 terms and documents.
The newest version!
package it.unimi.dsi.big.mg4j.search;
import static org.junit.Assert.*;
import java.io.IOException;
import org.junit.Test;
public class AndDocumentIteratorTest {
@Test
public void testExtentDocumentIterator() throws IOException {
IntArrayDocumentIterator i0 = new IntArrayDocumentIterator( new long[] { 0, 1, 2 },
new int[][][] {
{ { 0, 1 }, { 1, 2 } },
{ { 0, 1 }, { 1, 2 } },
{ { 1 }, { 2 } },
} );
IntArrayDocumentIterator i1 = new IntArrayDocumentIterator( new long[] { 0, 1, 2 },
new int[][][] {
{ { 5, 7 } },
{ {} },
{ { 2 }, { 3 }, { 4 } },
} );
DocumentIterator andDocumentIterator = AndDocumentIterator.getInstance( i0, i1 );
assertEquals( 0, andDocumentIterator.nextDocument() );
assertEquals( 5, andDocumentIterator.intervalIterator().extent() );
assertEquals( 1, andDocumentIterator.nextDocument() );
assertEquals( 2, andDocumentIterator.intervalIterator().extent() );
assertEquals( 2, andDocumentIterator.nextDocument() );
assertEquals( 2, andDocumentIterator.intervalIterator().extent() );
assertEquals( -1, andDocumentIterator.nextDocument() );
assertEquals( -1, andDocumentIterator.nextDocument() );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy