Package com._1c.g5.v8.dt.internal.common
Class Combinations
java.lang.Object
com._1c.g5.v8.dt.internal.common.Combinations
- All Implemented Interfaces:
- Iterable<int[]>
- 
Constructor SummaryConstructorsConstructorDescriptionCombinations(int n, int k) Creates an instance whose range is the k-element subsets of {0, ..., n - 1} represented asint[]arrays.
- 
Method SummaryMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Constructor Details- 
Combinationspublic Combinations(int n, int k) Creates an instance whose range is the k-element subsets of {0, ..., n - 1} represented asint[]arrays.The iteration order is lexicographic: the arrays returned by the Ifiteratorare sorted in descending order and they are visited in lexicographic order with significance from right to left. For example,new Combinations(4, 2).iterator()returns an iterator that will generate the following sequence of arrays on successive calls tonext():
 [0, 1], [0, 2], [1, 2], [0, 3], [1, 3], [2, 3]k == 0an iterator containing an empty array is returned; ifk == nan iterator containing [0, ..., n - 1] is returned.- Parameters:
- n- Size of the set from which subsets are selected.
- k- Size of the subsets to be enumerated.
- Throws:
- org.apache.commons.math3.exception.NotPositiveException- if- n < 0.
- org.apache.commons.math3.exception.NumberIsTooLargeException- if- k > n.
 
 
- 
- 
Method Details- 
getNpublic int getN()Gets the size of the set from which combinations are drawn.- Returns:
- the size of the universe.
 
- 
getKpublic int getK()Gets the number of elements in each combination.- Returns:
- the size of the subsets to be enumerated.
 
- 
iterator
 
-