public class MultidimensionalCounter extends Object implements Iterable<Integer>
Modifier and Type | Class and Description |
---|---|
class |
MultidimensionalCounter.Iterator
Perform iteration over the multidimensional counter.
|
Constructor and Description |
---|
MultidimensionalCounter(int... sizeIn)
Create a counter.
|
Modifier and Type | Method and Description |
---|---|
int |
getCount(int... c)
Convert to unidimensional counter.
|
int[] |
getCounts(int index)
Convert to multidimensional counter.
|
int |
getDimension()
Get the number of dimensions of the multidimensional counter.
|
int |
getSize()
Get the total number of elements.
|
int[] |
getSizes()
Get the number of multidimensional counter slots in each dimension.
|
MultidimensionalCounter.Iterator |
iterator()
Create an iterator over this counter.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public MultidimensionalCounter(int... sizeIn)
sizeIn
- Counter sizes (number of slots in each dimension).NotStrictlyPositiveException
- if one of the sizes is
negative or zero.public MultidimensionalCounter.Iterator iterator()
public int getDimension()
public int[] getCounts(int index)
index
- Index in unidimensional counter.OutOfRangeException
- if index
is not between 0
and the value returned by getSize()
(excluded).public int getCount(int... c)
c
- Indices in multidimensional counter.DimensionMismatchException
- if the size of c
does not match the size of the array given in the constructor.OutOfRangeException
- 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 © 2023 CNES. All rights reserved.