crn
Class PermutationGenerator
java.lang.Object
crn.PermutationGenerator
- public class PermutationGenerator
- extends java.lang.Object
Systematically generate permutations.
- Author:
- http://www.merriampark.com/perm.htm
Field Summary |
private int[] |
a
|
private java.math.BigInteger |
numLeft
|
private java.math.BigInteger |
total
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
a
private int[] a
numLeft
private java.math.BigInteger numLeft
total
private java.math.BigInteger total
PermutationGenerator
public PermutationGenerator(int n)
- Parameters:
n
-
reset
public void reset()
getNumLeft
public java.math.BigInteger getNumLeft()
- Returns:
- Gets the number of left possibilities.
getTotal
public java.math.BigInteger getTotal()
- Returns:
- Gets the total number of possibilities.
hasMore
public boolean hasMore()
- Returns:
- A boolean value indicating if there are some more permutations to be visited.
getFactorial
private static java.math.BigInteger getFactorial(int n)
- Parameters:
n
-
- Returns:
- Gets the factorial of the given number.
getNext
public int[] getNext()
- Returns:
- Gets an array being the next permutation.