public class MDArray<T> extends MDAbstractArray<T>
T
.MDAbstractArray.ArrayEntry
Constructor and Description |
---|
MDArray(java.lang.Class<T> componentClass,
int[] dimensions)
Creates an empty
MDArray with the dimensions. |
MDArray(java.lang.Class<T> componentClass,
int[] dimensions,
int capacityHyperRows)
Creates an empty
MDArray with the dimensions. |
MDArray(java.lang.Class<T> componentClass,
long[] dimensions)
Creates an empty
MDArray with the dimensions. |
MDArray(java.lang.Class<T> componentClass,
long[] dimensions,
long capacityHyperRows)
Creates an empty
MDArray with the dimensions. |
MDArray(T[] flattenedArray,
int[] dimensions)
|
MDArray(T[] flattenedArray,
int[] dimensions,
boolean checkdimensions)
Creates a
MDArray from the given flattenedArray and dimensions. |
MDArray(T[] flattenedArray,
long[] dimensions)
|
MDArray(T[] flattenedArray,
long[] dimensions,
boolean checkdimensions)
Creates a
MDArray from the given flattenedArray and dimensions. |
Modifier and Type | Method and Description |
---|---|
int |
capacity()
Returns the capacity of elements in the array.
|
boolean |
equals(java.lang.Object obj) |
T |
get(int... indices)
Returns the value of array at the position defined by indices.
|
T |
get(int index)
Returns the value of a one-dimensional array at the position defined by index.
|
T |
get(int indexX,
int indexY)
Returns the value of a two-dimensional array at the position defined by indexX and
indexY.
|
T |
get(int indexX,
int indexY,
int indexZ)
Returns the value of a three-dimensional array at the position defined by indexX,
indexY and indexZ.
|
T[] |
getAsFlatArray()
Returns the array in flattened form.
|
T |
getAsObject(int... indices)
Return an object which has the same value as the element of the array specified by
indices.
|
T |
getAsObject(int linearIndex)
Return an object which has the same value as the element of the array specified by
linearIndex.
|
java.lang.Class<T> |
getComponentClass()
Returns the component type of this array.
|
T[] |
getCopyAsFlatArray()
Returns a copy of the array in flattened form.
|
int |
hashCode() |
void |
set(T value,
int... indices)
Sets the value of array at the position defined by indices.
|
void |
set(T value,
int index)
Sets the value of a one-dimension array at the position defined by
index.
|
void |
set(T value,
int indexX,
int indexY)
Sets the value of a two-dimensional array at the position defined by
indexX and indexY.
|
void |
set(T value,
int indexX,
int indexY,
int indexZ)
Sets the value of a three-dimensional array at the position defined by
indexX, indexY and indexZ.
|
void |
setToObject(T value,
int... indices)
Sets the element of the array specified by indices to the particular
value.
|
void |
setToObject(T value,
int linearIndex)
Sets the element of the array specified by linearIndex to the particular
value.
|
computeIndex, computeIndex, computeIndex, computeReverseIndex, decNumberOfHyperRows, dimensions, getLength, getLength, getLength, getLength, incNumberOfHyperRows, iterator, longDimensions, numberOfHyperRows, rank, size, size, toInt, toLong, toString
public MDArray(java.lang.Class<T> componentClass, long[] dimensions)
MDArray
with the dimensions. Convenience method if
dimensions are available as long[]
.public MDArray(java.lang.Class<T> componentClass, long[] dimensions, long capacityHyperRows)
MDArray
with the dimensions. If
capacityHyperRows > dimensions[0]
, then it will create an array with a capacity
of capacityHyperRows hyper-rows. Convenience method if dimensions are
available as long[]
.public MDArray(T[] flattenedArray, long[] dimensions)
MDArray
from the given flattenedArray
and dimensions
. It is
checked that the arguments are compatible. Convenience method if dimensions are
available as long[]
.public MDArray(T[] flattenedArray, long[] dimensions, boolean checkdimensions)
MDArray
from the given flattenedArray and dimensions.
If checkDimensions is true
, it is checked that the arguments are
compatible. Convenience method if dimensions are available as long[]
.public MDArray(java.lang.Class<T> componentClass, int[] dimensions)
MDArray
with the dimensions.public MDArray(java.lang.Class<T> componentClass, int[] dimensions, int capacityHyperRows)
MDArray
with the dimensions. If
capacityHyperRows > dimensions[0]
, then it will create an array with a capacity
of capacityHyperRows hyper-rows.public MDArray(T[] flattenedArray, int[] dimensions)
MDArray
from the given flattenedArray
and dimensions
. It is
checked that the arguments are compatible.public int capacity()
MDAbstractArray
capacity
in class MDAbstractArray<T>
public T getAsObject(int... indices)
MDAbstractArray
getAsObject
in class MDAbstractArray<T>
public void setToObject(T value, int... indices)
MDAbstractArray
setToObject
in class MDAbstractArray<T>
public T getAsObject(int linearIndex)
MDAbstractArray
getAsObject
in class MDAbstractArray<T>
linearIndex
- The index in the linear array returned by MDAbstractArray.getAsFlatArray()
.public void setToObject(T value, int linearIndex)
MDAbstractArray
setToObject
in class MDAbstractArray<T>
value
- The new value to set.linearIndex
- The index in the linear array returned by MDAbstractArray.getAsFlatArray()
.public T[] getAsFlatArray()
MDAbstractArray
getAsFlatArray
in class MDAbstractArray<T>
public T[] getCopyAsFlatArray()
MDAbstractArray
getCopyAsFlatArray
in class MDAbstractArray<T>
public T get(int... indices)
public T get(int index)
Do not call for arrays other than one-dimensional!
public T get(int indexX, int indexY)
Do not call for arrays other than two-dimensional!
public T get(int indexX, int indexY, int indexZ)
Do not call for arrays other than three-dimensional!
public void set(T value, int... indices)
public void set(T value, int index)
Do not call for arrays other than one-dimensional!
public void set(T value, int indexX, int indexY)
Do not call for arrays other than two-dimensional!
public void set(T value, int indexX, int indexY, int indexZ)
Do not call for arrays other than three-dimensional!
public java.lang.Class<T> getComponentClass()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object