|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcombinatorics.CombinatoricOperator<T>
combinatorics.Combinator<T>
T - The type of the elements of which combinations are to be
returned.public final class Combinator<T>
A class that sequentially returns all combinations of a certain number out of an array of given elements. Thanks to Michael Gillegand for the base implementation: http://www.merriampark.com/comb.htm.
| Field Summary |
|---|
| Fields inherited from class combinatorics.CombinatoricOperator |
|---|
elements, indices |
| Constructor Summary | |
|---|---|
Combinator(T[] elements,
int r)
Initialise a new Combinator, with given elements and size of the arrays to be returned. |
|
| Method Summary | |
|---|---|
protected void |
computeNext()
Compute the next array of indices. |
protected double |
initialiseTotal(int n,
int r)
Compute the total number of elements to return. |
| Methods inherited from class combinatorics.CombinatoricOperator |
|---|
collectionToArray, factorial, getNumLeft, getTotal, hasNext, initialiseIndices, iterator, next, remove, reset |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Combinator(T[] elements,
int r)
elements - The elements of which combinations have to be computed.r - The size of the combinations to compute.| Method Detail |
|---|
protected double initialiseTotal(int n,
int r)
initialiseTotal in class CombinatoricOperator<T>n - The number of elements the operator works on.r - The size of the arrays to return.
CombinatoricOperator.initialiseTotal(int, int)protected void computeNext()
computeNext in class CombinatoricOperator<T>CombinatoricOperator.computeNext()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||