Class DoubleDiskDataStorage.BlockIterator
java.lang.Object
org.apfloat.spi.DataStorage.Iterator
org.apfloat.spi.DataStorage.AbstractIterator
org.apfloat.internal.DoubleDiskDataStorage.BlockIterator
- All Implemented Interfaces:
Serializable, AutoCloseable
- Enclosing class:
DoubleDiskDataStorage
- Version:
- 1.8.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ArrayAccessprivate double[]private intprivate intprivate static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidvoidclose()Closes the iterator.<T> TGets the current element as a the specified element type.doubleGets the current element as adouble.voidnext()Advances the position in the stream by one element.<T> voidSets the current element as the specified element type.voidsetDouble(double value) Sets the current element as adouble.Methods inherited from class DataStorage.AbstractIterator
checkGet, checkLength, checkSet, getFloat, getIncrement, getInt, getLength, getLong, getMode, getPosition, hasNext, setFloat, setInt, setLong
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
arrayAccess
-
data
private double[] data -
offset
private int offset -
remaining
private int remaining
-
-
Constructor Details
-
BlockIterator
public BlockIterator(int mode, long startPosition, long endPosition) throws IllegalArgumentException, IllegalStateException, ApfloatRuntimeException
-
-
Method Details
-
next
Description copied from class:DataStorage.AbstractIteratorAdvances the position in the stream by one element.Note: It is important that the iterator is iterated past the last element; that is
next()is calledstartPosition - endPositiontimes. Theget()orset()methods should not be called for the last element.- Overrides:
nextin classDataStorage.AbstractIterator- Throws:
IllegalStateException- If the iterator has been iterated to the end already.ApfloatRuntimeException
-
getDouble
Description copied from class:DataStorage.IteratorGets the current element as adouble.The default implementation calls
DataStorage.Iterator.get(Class)with argumentDouble.TYPE.- Overrides:
getDoublein classDataStorage.AbstractIterator- Returns:
- The current element as a
double. - Throws:
IllegalStateException- If the iterator is at the end.ApfloatRuntimeException
-
setDouble
Description copied from class:DataStorage.IteratorSets the current element as adouble.The default implementation calls
DataStorage.Iterator.set(Class,Object)with first argumentDouble.TYPE.- Overrides:
setDoublein classDataStorage.AbstractIterator- Parameters:
value- The value to be set to the current element as adouble.- Throws:
IllegalStateException- If the iterator is at the end.ApfloatRuntimeException
-
get
Description copied from class:DataStorage.IteratorGets the current element as a the specified element type.The default implementation always throws
UnsupportedOperationException.- Overrides:
getin classDataStorage.Iterator- Type Parameters:
T- The type of the element.- Parameters:
type- The type of the element.- Returns:
- The current element as the specified type.
- Throws:
UnsupportedOperationException- If the element type of the data storage can't be converted to the specified type.IllegalStateException- If the iterator is at the end.
-
set
public <T> void set(Class<T> type, T value) throws UnsupportedOperationException, IllegalArgumentException, IllegalStateException Description copied from class:DataStorage.IteratorSets the current element as the specified element type.The default implementation always throws
UnsupportedOperationException.- Overrides:
setin classDataStorage.Iterator- Type Parameters:
T- The type of the element.- Parameters:
type- The type of the element.value- The value to be set to the current element as the specified type.- Throws:
UnsupportedOperationException- If the element type of the data storage can't be converted to the specified type.IllegalArgumentException- If the value is not of the specified type.IllegalStateException- If the iterator is at the end.
-
close
Closes the iterator. This needs to be called only if the iterator is not iterated to the end.- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classDataStorage.Iterator- Throws:
ApfloatRuntimeException
-
checkAvailable
- Throws:
ApfloatRuntimeException
-