public abstract class BaseDataBuffer extends Object implements DataBuffer
DataBuffer.Type
Modifier and Type | Field and Description |
---|---|
protected boolean |
isPersist |
protected int |
length |
static int |
MAPPING_SIZE |
protected List<ByteBuffer> |
mappings |
protected RandomAccessFile |
memoryMappedBuffer |
protected String |
path |
protected WeakReference<DataBuffer> |
ref |
protected Collection<String> |
referencing |
Modifier | Constructor and Description |
---|---|
protected |
BaseDataBuffer(int length)
Instantiate a buffer with the given length
|
Modifier and Type | Method and Description |
---|---|
void |
addReferencing(String id)
Add a referencing element to this buffer
|
void |
assign(DataBuffer... buffers)
Assign the given data buffers to this buffer
|
void |
assign(DataBuffer data)
Assign the contents of this buffer
to this buffer
|
void |
assign(int[] indices,
double[] data,
boolean contiguous)
Assign the given elements to the given indices
|
void |
assign(int[] indices,
double[] data,
boolean contiguous,
int inc)
Assign the given elements to the given indices
|
void |
assign(int[] indices,
float[] data,
boolean contiguous)
Assign the given elements to the given indices
|
void |
assign(int[] indices,
float[] data,
boolean contiguous,
int inc)
Assign the given elements to the given indices
|
void |
assign(int[] offsets,
int[] strides,
DataBuffer... buffers)
Assign the given buffers to this buffer
based on the given offsets and strides.
|
void |
assign(int[] offsets,
int[] strides,
int n,
DataBuffer... buffers)
Assign the given buffers to this buffer
based on the given offsets and strides.
|
void |
assign(Number value)
Assign the given value to the buffer
|
IComplexNumber |
getComplex(int i)
Returns a complex number
|
IComplexDouble |
getComplexDouble(int i)
Get the complex double at the specified index
|
IComplexFloat |
getComplexFloat(int i)
Get the complex float
|
double[] |
getDoublesAt(int offset,
int length)
Get the doubles at a particular offset
|
double[] |
getDoublesAt(int offset,
int inc,
int length)
Get the doubles at a particular offset
|
float[] |
getFloatsAt(int offset,
int length)
Get the doubles at a particular offset
|
float[] |
getFloatsAt(int offset,
int inc,
int length)
Get the doubles at a particular offset
|
boolean |
isPersist()
Whether the buffer should be persistent.
|
int |
length()
Returns the length of the buffer
|
void |
persist()
Mark this buffer as persistent
|
void |
put(int i,
IComplexNumber result) |
Collection<String> |
references()
The referencers pointing to this buffer
|
void |
removeReferencing(String id)
Remove the referenced id if it exists
|
static byte[] |
toByteArray(double value) |
static byte[] |
toByteArray(float value) |
static byte[] |
toByteArray(int value) |
static double |
toDouble(byte[] bytes) |
static float |
toFloat(byte[] bytes) |
static int |
toInt(byte[] bytes) |
public static final int MAPPING_SIZE
protected final List<ByteBuffer> mappings
protected int length
protected String path
protected transient RandomAccessFile memoryMappedBuffer
protected Collection<String> referencing
protected transient WeakReference<DataBuffer> ref
protected boolean isPersist
protected BaseDataBuffer(int length)
length
- the length of the bufferpublic void persist()
DataBuffer
persist
in interface DataBuffer
public boolean isPersist()
DataBuffer
isPersist
in interface DataBuffer
public static byte[] toByteArray(double value)
public static byte[] toByteArray(float value)
public static byte[] toByteArray(int value)
public static double toDouble(byte[] bytes)
public static int toInt(byte[] bytes)
public static float toFloat(byte[] bytes)
public void removeReferencing(String id)
DataBuffer
removeReferencing
in interface DataBuffer
id
- the id to removepublic Collection<String> references()
DataBuffer
references
in interface DataBuffer
public void addReferencing(String id)
DataBuffer
addReferencing
in interface DataBuffer
id
- the id to referencepublic void assign(int[] indices, float[] data, boolean contiguous, int inc)
DataBuffer
assign
in interface DataBuffer
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the indices are contiguous or notinc
- the number to increment by when assigningpublic void assign(int[] indices, double[] data, boolean contiguous, int inc)
DataBuffer
assign
in interface DataBuffer
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the data is contiguous or notinc
- the number to increment by when assigningpublic void assign(DataBuffer data)
DataBuffer
assign
in interface DataBuffer
data
- the data to assignpublic void assign(int[] indices, float[] data, boolean contiguous)
DataBuffer
assign
in interface DataBuffer
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the indices are contiguous or notpublic void assign(int[] indices, double[] data, boolean contiguous)
DataBuffer
assign
in interface DataBuffer
indices
- the indices to assigndata
- the data to assigncontiguous
- whether the data is contiguous or notpublic int length()
DataBuffer
length
in interface DataBuffer
public void assign(Number value)
DataBuffer
assign
in interface DataBuffer
value
- the value to assignpublic double[] getDoublesAt(int offset, int length)
DataBuffer
getDoublesAt
in interface DataBuffer
offset
- the offset to startlength
- the length of the arraypublic float[] getFloatsAt(int offset, int inc, int length)
DataBuffer
getFloatsAt
in interface DataBuffer
offset
- the offset to startinc
- the increment to uselength
- the length of the arraypublic double[] getDoublesAt(int offset, int inc, int length)
DataBuffer
getDoublesAt
in interface DataBuffer
offset
- the offset to startinc
- the increment to uselength
- the length of the arraypublic float[] getFloatsAt(int offset, int length)
DataBuffer
getFloatsAt
in interface DataBuffer
offset
- the offset to startlength
- the length of the arraypublic IComplexFloat getComplexFloat(int i)
DataBuffer
getComplexFloat
in interface DataBuffer
i
- the i togetepublic IComplexDouble getComplexDouble(int i)
DataBuffer
getComplexDouble
in interface DataBuffer
i
- the indexpublic IComplexNumber getComplex(int i)
DataBuffer
getComplex
in interface DataBuffer
i
- the complex number cto getpublic void put(int i, IComplexNumber result)
put
in interface DataBuffer
public void assign(int[] offsets, int[] strides, DataBuffer... buffers)
DataBuffer
assign
in interface DataBuffer
offsets
- the offsets to usestrides
- the strides to usebuffers
- the buffers to assign data frompublic void assign(int[] offsets, int[] strides, int n, DataBuffer... buffers)
DataBuffer
assign
in interface DataBuffer
offsets
- the offsets to usestrides
- the strides to usen
- the number of elements to operate onbuffers
- the buffers to assign data frompublic void assign(DataBuffer... buffers)
DataBuffer
assign
in interface DataBuffer
buffers
- the buffers to assignCopyright © 2015. All Rights Reserved.