public abstract class AbstractDataStorageBuilder extends Object implements DataStorageBuilder
ApfloatContext, different types of data storages
are created.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractDataStorageBuilder()
Subclass constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract DataStorage |
createCachedDataStorage()
Create a cached data storage.
|
DataStorage |
createCachedDataStorage(long size)
Get a data storage that is cached in memory, if possible, for the requested size of data.
|
DataStorage |
createDataStorage(DataStorage dataStorage)
Convert cached data storage to the appropriate normal data storage type.
|
DataStorage |
createDataStorage(long size)
Get an appropriate type of data storage for the requested size of data.
|
protected abstract DataStorage |
createNonCachedDataStorage()
Create a non-cached data storage.
|
protected abstract long |
getMaxCachedSize()
Get the maximum cached data storage size.
|
protected abstract boolean |
isCached(DataStorage dataStorage)
Test if the data storage is of cached type.
|
protected AbstractDataStorageBuilder()
public DataStorage createDataStorage(long size) throws ApfloatRuntimeException
DataStorageBuilder
Note that the returned data storage object is not set to have the
requested size, so the client should call the object's DataStorage.setSize(long)
method before storing data to it.
createDataStorage in interface DataStorageBuildersize - The size of data to be stored in the storage, in bytes.DataStorage object of an appropriate type for storing size bytes of data.ApfloatRuntimeExceptionpublic DataStorage createCachedDataStorage(long size) throws ApfloatRuntimeException
DataStorageBuilder
Note that the returned data storage object is not set to have the
requested size, so the client should call the object's DataStorage.setSize(long)
method before storing data to it.
createCachedDataStorage in interface DataStorageBuildersize - The size of data to be stored in the storage, in bytes.DataStorage object of an appropriate type for storing size bytes of data, cached if possible.ApfloatRuntimeExceptionpublic DataStorage createDataStorage(DataStorage dataStorage) throws ApfloatRuntimeException
DataStorageBuilder
If the data storage already has the appropriate type for its size, the data
storage may be returned unchanged. The argument data storage does not necessarily
have to be created with the DataStorageBuilder.createCachedDataStorage(long) method, it can
be created as well with the DataStorageBuilder.createDataStorage(long) method.
If the given data storage does not have the appropriate type for its size, then a new data storage of the appropriate type is created and the data is copied to it.
createDataStorage in interface DataStorageBuilderdataStorage - The data storage to be converted, if necessary.DataStorage that can be the original data storage or a copy of it, with the appropriate type.ApfloatRuntimeExceptionprotected abstract long getMaxCachedSize()
protected abstract DataStorage createCachedDataStorage() throws ApfloatRuntimeException
ApfloatRuntimeExceptionprotected abstract DataStorage createNonCachedDataStorage() throws ApfloatRuntimeException
ApfloatRuntimeExceptionprotected abstract boolean isCached(DataStorage dataStorage) throws ApfloatRuntimeException
dataStorage - The data storage.ApfloatRuntimeExceptionCopyright © 2024. All rights reserved.