org.jlab.groot.math
Class MultiIndex
- java.lang.Object
-
- org.jlab.groot.math.MultiIndex
-
- All Implemented Interfaces:
- java.io.Serializable
public class MultiIndex extends java.lang.Object implements java.io.SerializableHandles the indexing of multidimensional arrays.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description MultiIndex()Initializes the arrays to size 0.MultiIndex(int... d)Initializes the variables based on the number of arguments
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intgetArrayIndex(int... ind)Gets the needed size for 1D, 2D, and 3D arrays to be stored in a 1D arrayintgetArraySize()Gets the size of the resulting 1D array from the dimension sizesvoidsetDimensions(int... d)Sets the dimension sizes at each index and initializes every element of the current index to -1.
-
-
-
Constructor Detail
-
MultiIndex
public MultiIndex()
Initializes the arrays to size 0.
-
MultiIndex
public MultiIndex(int... d)
Initializes the variables based on the number of arguments- Parameters:
d- the list of dimension sizes. Used to determine the array sizes.
-
-
Method Detail
-
setDimensions
public final void setDimensions(int... d)
Sets the dimension sizes at each index and initializes every element of the current index to -1.- Parameters:
d- the list of dimension sizes
-
getArraySize
public int getArraySize()
Gets the size of the resulting 1D array from the dimension sizes- Returns:
- the size of the 1D array from storing everything in the multi-dimensional arrays
-
getArrayIndex
public int getArrayIndex(int... ind)
Gets the needed size for 1D, 2D, and 3D arrays to be stored in a 1D array- Parameters:
ind- The size of each dimension- Returns:
- The size of the 1D array from storing all the elements
-
-
DMelt 3.0 © DataMelt by jWork.ORG