|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.rapidminer.tools.math.CombinationGenerator
public class CombinationGenerator
This class can be used to iterate over all combinations of r elements out of n.
Usage:
CombinationGenerator x = new CombinationGenerator(elements.length, 3);
while (x.hasMore()) {
int[] indices = x.getNext();
}
| Constructor Summary | |
|---|---|
CombinationGenerator(int n,
int r)
|
|
| Method Summary | |
|---|---|
int[] |
getNext()
Generates the next combination by using the algorithm proposed by Rosen. |
java.math.BigInteger |
getNumberOfCombinationsLeft()
Return number of combinations not yet generated. |
java.math.BigInteger |
getTotal()
Returns the total number of combinations. |
boolean |
hasMore()
Returns true if there are more combinations left. |
void |
reset()
Resets this combination generator. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CombinationGenerator(int n,
int r)
| Method Detail |
|---|
public void reset()
public java.math.BigInteger getNumberOfCombinationsLeft()
public boolean hasMore()
public java.math.BigInteger getTotal()
public int[] getNext()
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||