public abstract class DiskDataStorage extends DataStorage
DataStorage.AbstractIterator, DataStorage.Iterator
READ, READ_WRITE, WRITE
Modifier | Constructor and Description |
---|---|
protected |
DiskDataStorage()
Default constructor.
|
protected |
DiskDataStorage(DiskDataStorage diskDataStorage,
long offset,
long length)
Subsequence constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract ArrayAccess |
createArrayAccess(int mode,
int startColumn,
int columns,
int rows)
Create an empty ArrayAccess.
|
protected abstract ArrayAccess |
createTransposedArrayAccess(int mode,
int startColumn,
int columns,
int rows)
Create an empty transposed ArrayAccess.
|
protected static int |
getBlockSize()
Convenience method for getting the block size (in bytes) for the
current
ApfloatContext . |
protected FileChannel |
getFileChannel()
The
FileChannel of the underlying disk file. |
protected String |
getFilename()
Filename of the underlying disk data storage.
|
protected abstract int |
getUnitSize()
Size of the element type, in bytes.
|
protected void |
implCopyFrom(DataStorage dataStorage,
long size)
Copies the specified number of elements from another data storage to this data storage.
|
protected ArrayAccess |
implGetArray(int mode,
int startColumn,
int columns,
int rows)
Maps a block of data to a memory array when the data is treated as a matrix.
|
protected long |
implGetSize()
Return the size of the whole data storage, not including sub-sequence settings.
|
protected ArrayAccess |
implGetTransposedArray(int mode,
int startColumn,
int columns,
int rows)
Maps a transposed block of data to a memory array when the data is treated as a matrix.
|
protected void |
implSetSize(long size)
Sets the size of the data storage.
|
boolean |
isCached()
Is this object cached in memory.
|
protected void |
setArray(ArrayAccess arrayAccess,
int startColumn,
int columns,
int rows)
Write the data back to the same location in the file that was retrieved with
implGetArray(int,int,int,int) . |
protected void |
setTransposedArray(ArrayAccess arrayAccess,
int startColumn,
int columns,
int rows)
Write the data back to the same location in the file that was retrieved with
implGetTransposedArray(int,int,int,int) . |
protected void |
transferFrom(ReadableByteChannel in,
long position,
long size)
Transfer from a readable channel, possibly in multiple chunks.
|
protected void |
transferTo(WritableByteChannel out,
long position,
long size)
Transfer to a writable channel, possibly in multiple chunks.
|
copyFrom, copyFrom, getArray, getArray, getOffset, getSize, getTransposedArray, implGetArray, implSubsequence, isReadOnly, isSubsequenced, iterator, setReadOnly, setSize, subsequence
protected DiskDataStorage() throws ApfloatRuntimeException
ApfloatRuntimeException
protected DiskDataStorage(DiskDataStorage diskDataStorage, long offset, long length)
diskDataStorage
- The originating data storage.offset
- The subsequence starting position.length
- The subsequence length.public boolean isCached()
DataStorage
isCached
in class DataStorage
true
if this object is cached in memory, false
if not.protected void implCopyFrom(DataStorage dataStorage, long size) throws ApfloatRuntimeException
DataStorage
implCopyFrom
in class DataStorage
dataStorage
- The data storage where the data should be copied from.size
- The number of elements to be copied.ApfloatRuntimeException
protected long implGetSize() throws ApfloatRuntimeException
DataStorage
implGetSize
in class DataStorage
ApfloatRuntimeException
protected void implSetSize(long size) throws ApfloatRuntimeException
DataStorage
implSetSize
in class DataStorage
size
- The size of the data storage.ApfloatRuntimeException
protected ArrayAccess implGetArray(int mode, int startColumn, int columns, int rows) throws ApfloatRuntimeException
DataStorage
implGetArray
in class DataStorage
mode
- Whether the array is prepared for reading, writing or both. The value should be DataStorage.READ
, DataStorage.WRITE
or a combination of these.startColumn
- The starting column where data is read.columns
- The number of columns of data to read.rows
- The number of rows of data to read. This should be equivalent to n1, number of rows in the matrix.columns
x rows
containing the data.ApfloatRuntimeException
protected ArrayAccess implGetTransposedArray(int mode, int startColumn, int columns, int rows) throws ApfloatRuntimeException
DataStorage
implGetTransposedArray
in class DataStorage
mode
- Whether the array is prepared for reading, writing or both. The value should be DataStorage.READ
, DataStorage.WRITE
or a combination of these.startColumn
- The starting column where data is read.columns
- The number of columns of data to read.rows
- The number of rows of data to read. This should be equivalent to n1, number of rows in the matrix.columns
x rows
containing the transposed data.ApfloatRuntimeException
protected void setArray(ArrayAccess arrayAccess, int startColumn, int columns, int rows) throws ApfloatRuntimeException
implGetArray(int,int,int,int)
.arrayAccess
- The transposed array access.startColumn
- The starting column where data is stored.columns
- The number of columns of data.rows
- The number of rows of data.ApfloatRuntimeException
protected void setTransposedArray(ArrayAccess arrayAccess, int startColumn, int columns, int rows) throws ApfloatRuntimeException
implGetTransposedArray(int,int,int,int)
.arrayAccess
- The transposed array access.startColumn
- The starting column where data is stored.columns
- The number of columns of data.rows
- The number of rows of data.ApfloatRuntimeException
protected abstract ArrayAccess createArrayAccess(int mode, int startColumn, int columns, int rows)
mode
- Whether the array is prepared for reading, writing or both. The value should be DataStorage.READ
, DataStorage.WRITE
or 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.protected abstract ArrayAccess createTransposedArrayAccess(int mode, int startColumn, int columns, int rows)
mode
- Whether the array is prepared for reading, writing or both. The value should be DataStorage.READ
, DataStorage.WRITE
or 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.protected void transferFrom(ReadableByteChannel in, long position, long size) throws ApfloatRuntimeException
in
- Input channel.position
- Start position of transfer.size
- Total number of bytes to transfer.ApfloatRuntimeException
protected void transferTo(WritableByteChannel out, long position, long size) throws ApfloatRuntimeException
out
- Output channel.position
- Start position of transfer.size
- Total number of bytes to transfer.ApfloatRuntimeException
protected static int getBlockSize()
ApfloatContext
.protected abstract int getUnitSize()
protected final String getFilename()
protected final FileChannel getFileChannel()
FileChannel
of the underlying disk file.FileChannel
of the underlying disk file.Copyright © 2019. All rights reserved.