public class MultidimensionalCounter
extends java.lang.Object
implements java.lang.Iterable<java.lang.Integer>
Modifier and Type | Class and Description |
---|---|
class |
MultidimensionalCounter.Iterator
Perform iteration over the multidimensional counter.
|
Constructor and Description |
---|
MultidimensionalCounter(int... size)
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.
|
java.lang.String |
toString() |
public MultidimensionalCounter(int... size)
size
- Counter sizes (number of slots in each dimension).NotStrictlyPositiveException
- if one of the sizes is
negative or zero.public MultidimensionalCounter.Iterator iterator()
iterator
in interface java.lang.Iterable<java.lang.Integer>
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) throws OutOfRangeException
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()
public java.lang.String toString()
toString
in class java.lang.Object
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"