public class FloatTupleArrayImpl extends Object implements FloatTupleArray
FloatTupleArray.Factory
Modifier and Type | Field and Description |
---|---|
static float |
DEF_GROW_FACTOR
Factor by which the arrays are grown when they run out of space.
|
protected float[][] |
elements |
Constructor and Description |
---|
FloatTupleArrayImpl(int dim,
int initialSize) |
FloatTupleArrayImpl(int dim,
int initialSize,
float growFactor)
Construct an instance of
initialSize . |
Modifier and Type | Method and Description |
---|---|
void |
add(float[][] values)
Add values.
|
void |
add(float[][] values,
int start,
int num)
Add values.
|
int |
dim()
Get the dimension of the tuple.
|
float[][] |
elements()
Reference to the backing data array.
|
float[] |
get(int idx)
Get a tuple.
|
float |
get(int i,
int j)
Get a value.
|
protected void |
grow()
Grow the internal arrays.
|
void |
set(int i,
int j,
float val)
Set a value.
|
int |
size()
Get the size of the valid data.
|
float[][] |
toArray()
Get contained data as array.
|
public static final float DEF_GROW_FACTOR
protected float[][] elements
public FloatTupleArrayImpl(int dim, int initialSize)
public FloatTupleArrayImpl(int dim, int initialSize, float growFactor)
initialSize
.dim
- The tuple dimension.initialSize
- The initial size of the internal array.growFactor
- Factor to grow by when resizing is necessary.protected void grow()
System.arraycopy
is used for array
expansion.public void add(float[][] values, int start, int num)
add
in interface FloatTupleArray
values
- Source array.start
- index in the source array to start atnum
- number of values to add.public float[][] elements()
elements
in interface FloatTupleArray
public void add(float[][] values)
add
in interface FloatTupleArray
values
- Source array.public void set(int i, int j, float val)
set
in interface FloatTupleArray
i
- dimension index of the values to setj
- tuple index of the value to setval
- the valuepublic float[] get(int idx)
idx
- The index of the tuplepublic float get(int i, int j)
get
in interface FloatTupleArray
i
- dimension indexj
- tuple index.i
at tuple index j
.public float[][] toArray()
NOTE: This is an expensive operation.
toArray
in interface FloatTupleArray
public int size()
size
in interface FloatTupleArray
public int dim()
dim
in interface FloatTupleArray
Copyright © 1996–2023 The SSEC Visualization Project. All rights reserved.