Package edu.cmu.tetrad.util
Class PermutationGenerator
java.lang.Object
edu.cmu.tetrad.util.PermutationGenerator
Generates all of the permutations of [0,..., numObjects - 1], where numObjects is numObjects nonnegative
 integer.  The values of numObjects is given in the constructor, and the sequence of
 choices is obtained by repeatedly calling the next() method.  When the
 sequence is finished, null is returned.
 
A valid combination for the sequence of combinations for numObjects choose b generated by this class is an array x[] of b integers representing the above permutation.
To see what this class does, try calling PermutationGenerator.testPrint(5), for instance.
- Author:
- Joseph Ramsey
- 
Constructor SummaryConstructorsConstructorDescriptionPermutationGenerator(int a) Constructs numObjects new choice generator for numObjects choose b.
- 
Method Summary
- 
Constructor Details- 
PermutationGeneratorpublic PermutationGenerator(int a) Constructs numObjects new choice generator for numObjects choose b. Once this initialization has been performed, successive calls to next() will produce the series of combinations. To begin numObjects new series at any time, call this init method again with new values for numObjects and b.- Parameters:
- a- the number of objects being selected from.
 
 
- 
- 
Method Details- 
nextpublic int[] next()- Returns:
- the next combination in the series, or null if the series is finished.
 
- 
testPrintpublic static void testPrint(int a) This static method will print the series of combinations for numObjects choose b to System.out.- Parameters:
- a- the number of objects being selected from.
 
 
-