Package org.apfloat.internal
Class DoubleDiskDataStorage
- java.lang.Object
-
- org.apfloat.spi.DataStorage
-
- org.apfloat.internal.DiskDataStorage
-
- org.apfloat.internal.DoubleDiskDataStorage
-
- All Implemented Interfaces:
java.io.Serializable
public class DoubleDiskDataStorage extends DiskDataStorage
Disk-based data storage for thedoubleelement type.- Version:
- 1.8.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classDoubleDiskDataStorage.BlockIteratorprivate classDoubleDiskDataStorage.DoubleDiskArrayAccessprivate classDoubleDiskDataStorage.MemoryArrayAccessprivate classDoubleDiskDataStorage.TransposedMemoryArrayAccess-
Nested classes/interfaces inherited from class org.apfloat.spi.DataStorage
DataStorage.AbstractIterator, DataStorage.Iterator
-
-
Field Summary
Fields Modifier and Type Field Description private static longserialVersionUID-
Fields inherited from class org.apfloat.spi.DataStorage
READ, READ_WRITE, WRITE
-
-
Constructor Summary
Constructors Modifier Constructor Description DoubleDiskDataStorage()Default constructor.protectedDoubleDiskDataStorage(DoubleDiskDataStorage doubleDiskDataStorage, long offset, long length)Subsequence constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ArrayAccesscreateArrayAccess(int mode, int startColumn, int columns, int rows)Create an empty ArrayAccess.protected ArrayAccesscreateTransposedArrayAccess(int mode, int startColumn, int columns, int rows)Create an empty transposed ArrayAccess.protected intgetUnitSize()Size of the element type, in bytes.protected ArrayAccessimplGetArray(int mode, long offset, int length)Gets an array access to the data of this data storage when it is treated as a linear block.protected DataStorageimplSubsequence(long offset, long length)Implementation of getting a subsequence of this data storage.DataStorage.Iteratoriterator(int mode, long startPosition, long endPosition)Constructs a new iterator.-
Methods inherited from class org.apfloat.internal.DiskDataStorage
cleanUp, gc, getBlockSize, getFileChannel, getFilename, implCopyFrom, implGetArray, implGetSize, implGetTransposedArray, implSetSize, isCached, setArray, setTransposedArray, transferFrom, transferTo
-
Methods inherited from class org.apfloat.spi.DataStorage
copyFrom, copyFrom, getArray, getArray, getOffset, getSize, getTransposedArray, isReadOnly, isSubsequenced, setReadOnly, setSize, subsequence
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DoubleDiskDataStorage
public DoubleDiskDataStorage() throws ApfloatRuntimeExceptionDefault constructor.- Throws:
ApfloatRuntimeException
-
DoubleDiskDataStorage
protected DoubleDiskDataStorage(DoubleDiskDataStorage doubleDiskDataStorage, long offset, long length)
Subsequence constructor.- Parameters:
doubleDiskDataStorage- The originating data storage.offset- The subsequence starting position.length- The subsequence length.
-
-
Method Detail
-
implSubsequence
protected DataStorage implSubsequence(long offset, long length) throws ApfloatRuntimeException
Description copied from class:DataStorageImplementation of getting a subsequence of this data storage. The validity of the arguments of this method do not need to be checked.- Specified by:
implSubsequencein classDataStorage- Parameters:
offset- The subsequence starting position.length- The subsequence length.- Returns:
- Data storage that represents the specified part of this data storage.
- Throws:
ApfloatRuntimeException
-
implGetArray
protected ArrayAccess implGetArray(int mode, long offset, int length) throws ApfloatRuntimeException
Description copied from class:DataStorageGets an array access to the data of this data storage when it is treated as a linear block. The validity of the arguments of this method do not need to be checked.- Specified by:
implGetArrayin classDataStorage- Parameters:
mode- Access mode for the array access:DataStorage.READ,DataStorage.WRITEor both.offset- Starting position of the array access in the data storage.length- Number of accessible elements in the array access.- Returns:
- The array access.
- Throws:
ApfloatRuntimeException
-
createArrayAccess
protected ArrayAccess createArrayAccess(int mode, int startColumn, int columns, int rows)
Description copied from class:DiskDataStorageCreate an empty ArrayAccess.- Specified by:
createArrayAccessin classDiskDataStorage- Parameters:
mode- Whether the array is prepared for reading, writing or both. The value should beDataStorage.READ,DataStorage.WRITEor a combination of these.startColumn- The starting column where data is stored.columns- The number of columns of data.rows- The number of rows of data.- Returns:
- Access to an empty array of the specified size and position.
-
createTransposedArrayAccess
protected ArrayAccess createTransposedArrayAccess(int mode, int startColumn, int columns, int rows)
Description copied from class:DiskDataStorageCreate an empty transposed ArrayAccess.- Specified by:
createTransposedArrayAccessin classDiskDataStorage- Parameters:
mode- Whether the array is prepared for reading, writing or both. The value should beDataStorage.READ,DataStorage.WRITEor a combination of these.startColumn- The starting column where data is stored.columns- The number of columns of data.rows- The number of rows of data.- Returns:
- Access to an empty array of the specified size and position.
-
iterator
public DataStorage.Iterator iterator(int mode, long startPosition, long endPosition) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, ApfloatRuntimeException
Description copied from class:DataStorageConstructs a new iterator. Elements can be iterated either in forward or in reverse order, depending on ifstartPositionis less than or greater thanendPosition, correspondingly.- Specified by:
iteratorin classDataStorage- Parameters:
mode- Access mode for iterator:DataStorage.READ,DataStorage.WRITEor both.startPosition- Starting position of iterator in the data set. For reverse access, the first element in the iterator isstartPosition - 1.endPosition- End position of iterator in the data set. For forward access, the last accessible element in the iterator isendPosition - 1.- Returns:
- An iterator.
- Throws:
java.lang.IllegalArgumentException- If the requested area is out of bounds of the data storage.java.lang.IllegalStateException- If write access is requested for a read-only data storage.ApfloatRuntimeException
-
getUnitSize
protected int getUnitSize()
Description copied from class:DiskDataStorageSize of the element type, in bytes.- Specified by:
getUnitSizein classDiskDataStorage- Returns:
- Size of the element type, in bytes.
-
-