visad.util
Class FloatTupleArrayImpl
- java.lang.Object
-
- visad.util.FloatTupleArrayImpl
-
- All Implemented Interfaces:
- FloatTupleArray
public class FloatTupleArrayImpl extends java.lang.Object implements FloatTupleArray
Growable array of float tuples.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface visad.util.FloatTupleArray
FloatTupleArray.Factory
-
-
Field Summary
Fields Modifier and Type Field and Description static floatDEF_GROW_FACTORFactor by which the arrays are grown when they run out of space.
-
Constructor Summary
Constructors Constructor and Description FloatTupleArrayImpl(int dim, int initialSize)FloatTupleArrayImpl(int dim, int initialSize, float growFactor)Construct an instance ofinitialSize.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(float[][] values)Add values.voidadd(float[][] values, int start, int num)Add values.intdim()Get the dimension of the tuple.float[][]elements()Reference to the backing data array.float[]get(int idx)Get a tuple.floatget(int i, int j)Get a value.voidset(int i, int j, float val)Set a value.intsize()Get the size of the valid data.float[][]toArray()Get contained data as array.
-
-
-
Field Detail
-
DEF_GROW_FACTOR
public static final float DEF_GROW_FACTOR
Factor by which the arrays are grown when they run out of space.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
FloatTupleArrayImpl
public FloatTupleArrayImpl(int dim, int initialSize)
-
FloatTupleArrayImpl
public FloatTupleArrayImpl(int dim, int initialSize, float growFactor)Construct an instance ofinitialSize.- Parameters:
dim- The tuple dimension.initialSize- The initial size of the internal array.growFactor- Factor to grow by when resizing is necessary.
-
-
Method Detail
-
add
public void add(float[][] values, int start, int num)Add values. If there is not enough space for the number of values to be added the array is continually grown until there is room.- Specified by:
addin interfaceFloatTupleArray- Parameters:
values- Source array.start- index in the source array to start atnum- number of values to add.
-
elements
public float[][] elements()
Reference to the backing data array. Any changes made to this array will be reflected in the actual data.- Specified by:
elementsin interfaceFloatTupleArray- Returns:
- This may return a reference or copy depending on the implementation.
-
add
public void add(float[][] values)
Add values. If there is not enough space for the number of values to be added the array is continually grown until there is room.- Specified by:
addin interfaceFloatTupleArray- Parameters:
values- Source array.
-
set
public void set(int i, int j, float val)Set a value.- Specified by:
setin interfaceFloatTupleArray- Parameters:
i- dimension index of the values to setj- tuple index of the value to setval- the value
-
get
public float[] get(int idx)
Get a tuple.- Parameters:
idx- The index of the tuple- Returns:
- an array of the tuple values at the provided index.
-
get
public float get(int i, int j)Get a value.- Specified by:
getin interfaceFloatTupleArray- Parameters:
i- dimension indexj- tuple index.- Returns:
- The value for tuple
iat tuple indexj.
-
toArray
public float[][] toArray()
Get contained data as array. The size of the array is exactly the size of the data.NOTE: This is an expensive operation.
- Specified by:
toArrayin interfaceFloatTupleArray- Returns:
- A copy of the array data.
-
size
public int size()
Get the size of the valid data.- Specified by:
sizein interfaceFloatTupleArray- Returns:
- size of array
-
dim
public int dim()
Get the dimension of the tuple.- Specified by:
dimin interfaceFloatTupleArray- Returns:
- The array tuple dimension
-
-
DMelt 3.0 © DataMelt by jWork.ORG