|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcayleytable.PermutationGenerator
public class PermutationGenerator
Class used to create permutations of a set of numbers from 0 to n-1
Field Summary | |
---|---|
private int[] |
a
array of integers representing current permutation that is being sent back to requestor |
private java.math.BigInteger |
numLeft
BigInteger of the number of permutations that have not been retrieved |
private java.math.BigInteger |
total
BigInteger of the total number of permutations |
Constructor Summary | |
---|---|
PermutationGenerator(int n)
Constructor to create the initial permutation of the list of integers from 0 to a given number. |
Method Summary | |
---|---|
private static java.math.BigInteger |
getFactorial(int n)
Method to compute the factorial of a given integer |
int[] |
getNext()
Method to generate next permutation (algorithm from Rosen p. |
java.math.BigInteger |
getNumLeft()
Method to return number of permutations not yet generated |
java.math.BigInteger |
getTotal()
Method to return total number of permutations |
boolean |
hasMore()
Method to return whether any more permutations are left to use |
void |
reset()
Method to reset the permutation list to the original array |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int[] a
private java.math.BigInteger numLeft
private java.math.BigInteger total
Constructor Detail |
---|
public PermutationGenerator(int n)
n
- integer size of the array to permutateMethod Detail |
---|
public void reset()
public java.math.BigInteger getNumLeft()
public java.math.BigInteger getTotal()
public boolean hasMore()
numLeft
is greater than zeroprivate static java.math.BigInteger getFactorial(int n)
n
- integer to which compute the factorial
public int[] getNext()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |