Package it.unimi.di.big.mg4j.index
Class IndexIterators
- java.lang.Object
-
- it.unimi.di.big.mg4j.index.IndexIterators
-
public class IndexIterators extends Object
A class providing static methods and objects that do useful things with index iterators.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classIndexIterators.PositionsIterator
-
Field Summary
Fields Modifier and Type Field Description static IndexIterator[]EMPTY_ARRAY
-
Constructor Summary
Constructors Modifier Constructor Description protectedIndexIterators()
-
Method Summary
Modifier and Type Method Description static int[]positionArray(IndexIterator indexIterator)Returns the positions of an index iterator as an array.static int[]positionArray(IndexIterator indexIterator, int[] position)Writes the positions of an index iterator into an array; if the array is not large enough, it will be reallocated usingIntArrays.grow(int[], int).static IntIteratorpositionIterator(IndexIterator indexIterator)Returns anIntIteratorview of the positions of an index iterator.
-
-
-
Field Detail
-
EMPTY_ARRAY
public static final IndexIterator[] EMPTY_ARRAY
-
-
Method Detail
-
positionArray
public static int[] positionArray(IndexIterator indexIterator) throws IOException
Returns the positions of an index iterator as an array.Note that this method just iterates
IndexIterator.nextPosition(). If the method has already been called, the positions that have been already returned will be missing.- Returns:
- an array containing the positions obtained by repeatedly calling
IndexIterator.nextPosition(). - Throws:
IOException
-
positionArray
public static int[] positionArray(IndexIterator indexIterator, int[] position) throws IOException
Writes the positions of an index iterator into an array; if the array is not large enough, it will be reallocated usingIntArrays.grow(int[], int).Note that this method just iterates
IndexIterator.nextPosition(). If the method has already been called, the positions that have been already returned will be missing.- Returns:
position, if it was large enough to contain all positions; a new, larger array otherwise.- Throws:
IOException
-
positionIterator
public static IntIterator positionIterator(IndexIterator indexIterator)
Returns anIntIteratorview of the positions of an index iterator.Note that this method just offers of a view of
IndexIterator.nextPosition(). If the method has already been called, the positions that have been already returned will be missing.- Returns:
- an
IntIteratorview of the positions obtained by repeatedly callingIndexIterator.nextPosition().
-
-