com.espertech.esper.collection
Class CombinationEnumeration

java.lang.Object
  extended by com.espertech.esper.collection.CombinationEnumeration
All Implemented Interfaces:
java.util.Enumeration<java.lang.Object[]>

public class CombinationEnumeration
extends java.lang.Object
implements java.util.Enumeration<java.lang.Object[]>

Provided a 2-dimensional array of values, provide all possible combinations:

     For example, an array { {1}, {"A", "B"}, {"X", "Y"} } provides these combinations:
        1 A X
        1 A Y
        1 B X
        1 B Y
 
. Usage Note: Do not hold on to the returned object array as nextElement() returns the same array with changed values for each enumeration.

Each array element must be non-null and length 1 or more.

Does not detect duplicates in values.

Allows any number for the first dimension.

The algorithm adds 1 to the right and overflows until done.


Constructor Summary
CombinationEnumeration(java.lang.Object[][] combinations)
           
 
Method Summary
static CombinationEnumeration fromZeroBasedRanges(int[] zeroBasedRanges)
           
 boolean hasMoreElements()
           
 java.lang.Object[] nextElement()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CombinationEnumeration

public CombinationEnumeration(java.lang.Object[][] combinations)
Method Detail

fromZeroBasedRanges

public static CombinationEnumeration fromZeroBasedRanges(int[] zeroBasedRanges)

hasMoreElements

public boolean hasMoreElements()
Specified by:
hasMoreElements in interface java.util.Enumeration<java.lang.Object[]>

nextElement

public java.lang.Object[] nextElement()
Specified by:
nextElement in interface java.util.Enumeration<java.lang.Object[]>

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com