public class SparseBackingBuffer extends Object implements MatrixBackingBuffer, Cloneable
HashMap as internal datastructure.
Only values that differ from the defaultValue (can be set via SparseBackingBuffer(float))
are actually stored.
If you intend to place values in most possible matrix positions, this is not a suitable implementation.| Constructor and Description |
|---|
SparseBackingBuffer()
Sparse backing buffer with default value
0f. |
SparseBackingBuffer(float defaultValue)
Creates a sparse backing buffer with the given default value.
|
| Modifier and Type | Method and Description |
|---|---|
void |
allocate(int size)
Allocates the internal data structure.
|
Object |
clone() |
float |
get(int index)
Reads a value.
|
boolean |
isAllocated()
Indicates whether the internal data structure is already allocated.
|
void |
set(int index,
float value)
Write a value.
|
public SparseBackingBuffer(float defaultValue)
defaultValue - default valuepublic SparseBackingBuffer()
0f.public void allocate(int size)
MatrixBackingBufferallocate in interface MatrixBackingBuffersize - sizepublic boolean isAllocated()
MatrixBackingBufferisAllocated in interface MatrixBackingBufferpublic void set(int index,
float value)
MatrixBackingBufferset in interface MatrixBackingBufferindex - indexvalue - valuepublic float get(int index)
MatrixBackingBufferget in interface MatrixBackingBufferindex - indexpublic Object clone() throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionCopyright © 2011–2020 tagtraum industries incorporated. All rights reserved.