|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgrapht.experimental.permutation.IntegerPermutationIter
public class IntegerPermutationIter
Iterates through permutations of N elements.
Constructor Summary | |
---|---|
IntegerPermutationIter(int N)
Creates an array of size N with elements 1,2,...,n-1 Useful for describing regular permutations. |
|
IntegerPermutationIter(int[] array)
Uses a predefined array (sorted), for example: [3,1,1,2,1]-->[1,1,1,2,3]; note that there are much less than 5! premutations here, because of the repetitive 1s. |
Method Summary | |
---|---|
int[] |
getCurrent()
|
int[] |
getNext()
Facade. |
boolean |
hasNext()
Efficiency: O(N) implementation, try to take the next! |
boolean |
hasNextPermutaions()
|
Object |
next()
|
int[] |
nextPermutation()
|
void |
remove()
UNIMPLEMENTED. |
String |
toString(int[] array)
Utility method to convert the array into a string examples: [] [0] [0,1][1,0] |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IntegerPermutationIter(int N)
N
- public IntegerPermutationIter(int[] array)
array
- creates a copy of it (so sort / later changes will not
matter)Method Detail |
---|
public boolean hasNext()
public Object next()
public int[] getNext()
public int[] getCurrent()
public String toString(int[] array)
array
- public void remove()
Iterator.remove()
public int[] nextPermutation()
nextPermutation
in interface ArrayPermutationsIter
public boolean hasNextPermutaions()
hasNextPermutaions
in interface ArrayPermutationsIter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |