@Deprecated public class Permutor extends Object
0 [0, 1, 2] 1 [0, 2, 1] 2 [1, 0, 2] ...where the number to the left of each permutation is the rank - really just the index in this ordered list. The list is created on demand, by a process called unranking where the rank is converted to the permutation that appears at that point in the list.
The algorithms used are from the book "Combinatorial Generation : Algorithms, Generation, and Search" (or C.A.G.E.S.) by D.L. Kreher and D.R. Stinson
Constructor and Description |
---|
Permutor(int size)
Deprecated.
Create a permutor that will generate permutations of numbers up to
size . |
Modifier and Type | Method and Description |
---|---|
int |
calculateMaxRank()
Deprecated.
Calculate the max possible rank for permutations of N numbers.
|
int[] |
getCurrentPermutation()
Deprecated.
Get the permutation that is currently being used.
|
int[] |
getNextPermutation()
Deprecated.
Get the next permutation in the list.
|
int[] |
getRandomNextPermutation()
Deprecated.
Randomly skip ahead in the list of permutations.
|
int |
getRank()
Deprecated.
|
boolean |
hasNext()
Deprecated.
|
void |
setPermutation(int[] permutation)
Deprecated.
Set the currently used permutation.
|
void |
setRank(int rank)
Deprecated.
Set the permutation to use, given its rank.
|
public Permutor(int size)
size
.size
- the size of the permutations to generatepublic boolean hasNext()
public void setRank(int rank)
rank
- the order of the permutation in the listpublic int getRank()
public void setPermutation(int[] permutation)
permutation
- the permutation to use, as an int arraypublic int[] getRandomNextPermutation()
public int[] getNextPermutation()
public int[] getCurrentPermutation()
public int calculateMaxRank()
Copyright © 2021. All rights reserved.