public abstract class PermutationGenerator
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int |
nElements |
protected long |
nGenerated |
protected long |
nPermutations |
protected int[] |
permutation |
Modifier | Constructor and Description |
---|---|
protected |
PermutationGenerator(int nElements) |
Modifier and Type | Method and Description |
---|---|
protected abstract long |
computeNumberOfPermutations() |
long |
getNumberOfGeneratedPermutations() |
long |
getNumberOfPermutations() |
boolean |
hasNext() |
protected void |
initPermutations() |
abstract int[] |
next()
return the next permutation or throw a NoSuchElementException if there is none.
|
void |
printOn(java.io.PrintStream ps)
for debugging purposes
|
static void |
printOn(java.io.PrintStream ps,
long nGenerated,
int[] perm) |
abstract void |
reset() |
protected final int nElements
protected int[] permutation
protected long nPermutations
protected long nGenerated
protected void initPermutations()
protected abstract long computeNumberOfPermutations()
public abstract void reset()
public long getNumberOfPermutations()
public long getNumberOfGeneratedPermutations()
public void printOn(java.io.PrintStream ps)
public static void printOn(java.io.PrintStream ps, long nGenerated, int[] perm)
public boolean hasNext()
public abstract int[] next()