public final class MultidimensionalCounter extends Object
| Modifier and Type | Method and Description |
|---|---|
int |
getDimension()
Gets the number of dimensions of the multidimensional counter.
|
int |
getSize()
Gets the total number of elements.
|
int[] |
getSizes()
Gets the number of multidimensional counter slots in each dimension.
|
static MultidimensionalCounter |
of(int... size)
Creates a counter.
|
int[] |
toMulti(int index)
Converts to a multidimensional counter.
|
String |
toString() |
int |
toUni(int... c)
Converts to a unidimensional counter.
|
public static MultidimensionalCounter of(int... size)
size - Counter sizes (number of slots in each dimension).IllegalArgumentException - if one of the sizes is negative
or zero.public int getDimension()
public int[] toMulti(int index)
index - Index in unidimensional counter.IndexOutOfBoundsException - if index is not between
0 and the value returned by getSize() (excluded).public int toUni(int... c)
c - Indices in multidimensional counter.IllegalArgumentException - if the size of c
does not match the size of the array given in the constructor.IndexOutOfBoundsException - if a value of c is not in
the range of the corresponding dimension, as defined in the
constructor.public int getSize()
public int[] getSizes()
Copyright © 2017–2022 The Apache Software Foundation. All rights reserved.