This class allows to iterate over all N-tuples (not necessary to be distinct), which can be chosen from {@code N} arrays of integers of the form
arrayi = [0, 1, 2, ..., K
i].
For example, if a set of arrays length is {K
i} = [2,3,2], then the following tuples will be produced
[0, 0, 0] [0, 0, 1] [0, 1, 0] [0, 1, 1] [0, 2, 0] [0, 2, 1] [1, 0, 0] [1, 0, 1] [1, 1, 0] [1, 1, 1] [1, 2, 0] [1, 2, 1]
This class is implemented via output port pattern and the calculation of the next tuple occurs only on the invocation of {@link #take()}. Note: method {@link #take()} returns the same reference on each invocation.So, if it is needed not only to obtain the information from {@link #take()}, but also save the result, it is necessary to clone the returned array.
@author Dmitry Bolotin
@author Stanislav Poslavsky
@since 1.0