|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.ericaro.neoitertools.generators.combinatorics.Combinatorics
public class Combinatorics
provides low level algorithms for permutations and combinations... Based on int[] to described indexes. Warning, those algorithms are memory efficient, and therefore do not copy int[] around all the time. This means that you shouldn't edit the int[] passed in the iterators. The goal is to use those indices for higher level algorithm.
| Constructor Summary | |
|---|---|
Combinatorics()
|
|
| Method Summary | ||
|---|---|---|
static
|
applied(java.util.List<T> elements,
Generator<int[]> indicesGenerator)
Return a Generator over a list of applied transformation ( @see apply(List, int[]) . |
|
static
|
apply(java.util.List<T> origin,
int[] indices)
Apply a transformation, described by the int[] to the given origin, into a new array. |
|
static Generator<int[]> |
combinations(int m,
int n)
Calculate all subsets' indices |
|
static Generator<int[]> |
permutations(int n)
Calculate all permutations' indices |
|
static Generator<int[]> |
product(int[] lengths)
Calculate all product selectors' indices |
|
static
|
select(java.util.List<java.util.List<T>> lists,
int[] indices)
Select on item per list, based on its index read in indices. |
|
static
|
selected(java.util.List<java.util.List<T>> lists,
Generator<int[]> indicesGenerator)
Return an Generator over a list of selection ( @see select(List, int[]) . |
|
static Generator<int[]> |
sublists(int m,
int n)
Calculate sublists' indexes |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Combinatorics()
| Method Detail |
|---|
public static Generator<int[]> permutations(int n)
n -
public static Generator<int[]> product(int[] lengths)
lengths -
public static Generator<int[]> combinations(int m,
int n)
m - larger sizen - size of the subsets
public static Generator<int[]> sublists(int m,
int n)
m - larger sizen - size of the sublists
public static <T> java.util.List<T> apply(java.util.List<T> origin,
int[] indices)
T - origin - indices -
public static <T> java.util.List<T> select(java.util.List<java.util.List<T>> lists,
int[] indices)
size : len( lists )
sizes[i] = len( lists[i] )
then :
if len(indices) > size then indices[i] is associated with lists[i%size]
and
indices[i] in [0 , sizes[i] [
lists - indices -
public static <T> Generator<java.util.List<T>> selected(java.util.List<java.util.List<T>> lists,
Generator<int[]> indicesGenerator)
select(List, int[]) .
lists - indicesGenerator -
public static <T> Generator<java.util.List<T>> applied(java.util.List<T> elements,
Generator<int[]> indicesGenerator)
apply(List, int[]) .
elements - indicesGenerator -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||