public abstract class Array extends VType
The data is stored in a linear structure. The sizes array gives the dimensionality
and size for each dimension. The ordering defined by the sizes is [..., zSize, ySize, xSize]
.
Typical iteration is:
for (...) { for (int z = 0; z < zSize; z++) { for (int y = 0; y < ySize; y++) { for (int x = 0; x < xSize; x++) { array.getData().getDouble(... + z*ySize + y*xSize + x); } } } }
Constructor and Description |
---|
Array() |
Modifier and Type | Method and Description |
---|---|
abstract Object |
getData()
Return the object containing the array data.
|
abstract ListInt |
getSizes()
The shape of the multidimensional array.
|
public abstract Object getData()
This method will either return a List
or a ListNumber
depending of the array type. A collection is returned, instead of an
array, so that the type implementation can be immutable or can at
least try to prevent modifications. ListNumber has also several
advantages over the Java arrays, including the ability to iterate the list
regardless of numeric type.
If a numeric array is actually needed, refer to CollectionNumbers
.
public abstract ListInt getSizes()
The size of the returned list will be the number of the dimension of the array. Each number represents the size of each dimension. The total number of elements in the array is therefore the product of all the numbers in the list returned.
Copyright © 2015. All rights reserved.