Class LongMemoryDataStorage.ReadWriteIterator
- All Implemented Interfaces:
Serializable, AutoCloseable
- Direct Known Subclasses:
LongMemoryDataStorage.ReadOnlyIterator, LongMemoryDataStorage.WriteOnlyIterator
- Enclosing class:
LongMemoryDataStorage
- Version:
- 1.9.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate long[]private intprivate intprivate static final long -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedReadWriteIterator(int mode, long startPosition, long endPosition) ReadWriteIterator(long startPosition, long endPosition) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidChecks if the iterator is at the end yet.<T> TGets the current element as a the specified element type.longgetLong()Gets the current element as along.booleanhasNext()Check ifnext()can be called without going past the end of the sequence.voidnext()Advances the position in the stream by one element.<T> voidSets the current element as the specified element type.voidsetLong(long value) Sets the current element as along.Methods inherited from class DataStorage.AbstractIterator
checkGet, checkSet, getDouble, getFloat, getIncrement, getInt, getLength, getMode, getPosition, setDouble, setFloat, setIntMethods inherited from class DataStorage.Iterator
close
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
data
private long[] data -
position
private int position -
length
private int length
-
-
Constructor Details
-
ReadWriteIterator
public ReadWriteIterator(long startPosition, long endPosition) throws IllegalArgumentException, IllegalStateException, ApfloatRuntimeException -
ReadWriteIterator
protected ReadWriteIterator(int mode, long startPosition, long endPosition) throws IllegalArgumentException, IllegalStateException, ApfloatRuntimeException
-
-
Method Details
-
hasNext
public boolean hasNext()Description copied from class:DataStorage.AbstractIteratorCheck ifnext()can be called without going past the end of the sequence. That is, ifnext()can be called without deliberately causing an exception.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:
hasNextin classDataStorage.AbstractIterator- Returns:
trueifDataStorage.AbstractIterator.next()can be called, otherwisefalse.
-
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.
-
getLong
Description copied from class:DataStorage.IteratorGets the current element as along.The default implementation calls
DataStorage.Iterator.get(Class)with argumentLong.TYPE.- Overrides:
getLongin classDataStorage.AbstractIterator- Returns:
- The current element as a
long. - Throws:
IllegalStateException- If the iterator is at the end.
-
setLong
Description copied from class:DataStorage.IteratorSets the current element as along.The default implementation calls
DataStorage.Iterator.set(Class,Object)with first argumentLong.TYPE.- Overrides:
setLongin classDataStorage.AbstractIterator- Parameters:
value- The value to be set to the current element as along.- Throws:
IllegalStateException- If the iterator is at the end.
-
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.
-
checkLength
Description copied from class:DataStorage.AbstractIteratorChecks if the iterator is at the end yet.- Overrides:
checkLengthin classDataStorage.AbstractIterator- Throws:
IllegalStateException- If the iterator is at end.
-