Package it.unimi.di.big.mg4j.tool
Class Combine.GammaCodedIntIterator
- java.lang.Object
-
- it.unimi.di.big.mg4j.tool.Combine.GammaCodedIntIterator
-
- All Implemented Interfaces:
IntIterator
,Closeable
,AutoCloseable
,Iterator<Integer>
,PrimitiveIterator<Integer,IntConsumer>
,PrimitiveIterator.OfInt
- Enclosing class:
- Combine
protected static final class Combine.GammaCodedIntIterator extends Object implements IntIterator, Closeable
A partialIntIterator
implementation based on γ-coded integers.Instances of this class adapt an
InputBitStream
to anIntIterator
by reading γ-coded integers. The implementation is partial becausehasNext()
always returns true—the user must know in advance how many timesnextInt()
may be safely called.- See Also:
Combine.sizes(int)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface java.util.PrimitiveIterator
PrimitiveIterator.OfDouble, PrimitiveIterator.OfInt, PrimitiveIterator.OfLong
-
-
Constructor Summary
Constructors Constructor Description GammaCodedIntIterator(InputBitStream inputBitStream)
-
Method Summary
Modifier and Type Method Description void
close()
Delegates to the underlyingInputBitStream
.boolean
hasNext()
Returns true.int
nextInt()
Returns the next γ-coded integer in the underlyingInputBitStream
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntIterator
forEachRemaining, next, skip
-
Methods inherited from interface java.util.PrimitiveIterator.OfInt
forEachRemaining
-
-
-
-
Constructor Detail
-
GammaCodedIntIterator
public GammaCodedIntIterator(InputBitStream inputBitStream)
-
-
Method Detail
-
hasNext
public boolean hasNext()
Returns true.
-
nextInt
public int nextInt()
Returns the next γ-coded integer in the underlyingInputBitStream
.- Specified by:
nextInt
in interfaceIntIterator
- Specified by:
nextInt
in interfacePrimitiveIterator.OfInt
- Returns:
- the result of
InputBitStream.readGamma()
.
-
close
public void close() throws IOException
Delegates to the underlyingInputBitStream
.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-