ncsa.tools.common.util
Class CartesianProduct

java.lang.Object
  extended byncsa.tools.common.util.CartesianProduct

public class CartesianProduct
extends java.lang.Object

Iterative is more idiomatic to Java (and safer, stack-wise). Recursive is for Schemers; it's not quite in strict continuation-passing style, but each part is tail recursive. The latter algorithm was tricky, especially from the standpoint of making sure we pass objects by value in the right places. -alr 11/06/05

CAVEAT UTENS! These algorithms have exponential complexity. Use them for only very small problems.

Author:
arossi

Field Summary
static int ITERATIVE
           
static int RECURSIVE
           
 
Method Summary
static java.util.List getProduct(java.util.Map variableLists)
           
static java.util.List getProduct(java.util.Map variableLists, int algorithm)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ITERATIVE

public static final int ITERATIVE
See Also:
Constant Field Values

RECURSIVE

public static final int RECURSIVE
See Also:
Constant Field Values
Method Detail

getProduct

public static java.util.List getProduct(java.util.Map variableLists)

getProduct

public static java.util.List getProduct(java.util.Map variableLists,
                                        int algorithm)