|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.espertech.esper.collection.PermutationEnumeration
public class PermutationEnumeration
Provides a N! (n-faculty) number of permutations for N elements. Example: for 3 elements provides 6 permutations exactly as follows: {0, 1, 2} {0, 2, 1} {1, 0, 2} {1, 2, 0} {2, 0, 1} {2, 1, 0}
Constructor Summary | |
---|---|
PermutationEnumeration(int numElements)
Ctor. |
Method Summary | |
---|---|
protected static int |
faculty(int num)
Computes faculty of N. |
protected static int[] |
getFactors(int numElements)
Returns factors for computing the permutation. |
protected static int[] |
getPermutation(int numElements,
int permutation,
int[] factors)
Returns permutation. |
boolean |
hasMoreElements()
|
int[] |
nextElement()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PermutationEnumeration(int numElements)
numElements
- - number of elements in each permutation.Method Detail |
---|
public boolean hasMoreElements()
hasMoreElements
in interface java.util.Enumeration<int[]>
public int[] nextElement()
nextElement
in interface java.util.Enumeration<int[]>
protected static int[] getPermutation(int numElements, int permutation, int[] factors)
numElements
- - number of elements in each permutationpermutation
- - number of permutation to compute, between 0 and numElements!factors
- - factors for each index
protected static int[] getFactors(int numElements)
numElements
- - number of factors to compute
protected static int faculty(int num)
num
- to compute faculty for
|
© 2006-2015 EsperTech Inc. All rights reserved. Visit us at espertech.com |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |