mondrian.util
Class CombiningGenerator<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<List<E>>
          extended by mondrian.util.CombiningGenerator<E>
All Implemented Interfaces:
Iterable<List<E>>, Collection<List<E>>, List<List<E>>

public class CombiningGenerator<E>
extends AbstractList<List<E>>

A list that, given a collection of elements, contains every possible combination of those objects (also known as the power set of those objects).

Author:
LBoudreau, jhyde

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
CombiningGenerator(Collection<E> elements)
          Creates a CombiningGenerator.
 
Method Summary
 List<E> get(int index)
           
static void main(String[] args)
          Ad hoc test.
static
<T> CombiningGenerator<T>
of(Collection<T> elements)
          Creates a CombiningGenerator, inferring the type from the argument.
 int size()
           
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

CombiningGenerator

public CombiningGenerator(Collection<E> elements)
Creates a CombiningGenerator.

Parameters:
elements - Elements to iterate over
Method Detail

of

public static <T> CombiningGenerator<T> of(Collection<T> elements)
Creates a CombiningGenerator, inferring the type from the argument.

Type Parameters:
T - Element type
Parameters:
elements - Elements to iterate over
Returns:
Combing generator containing the power set

get

public List<E> get(int index)
Specified by:
get in interface List<List<E>>
Specified by:
get in class AbstractList<List<E>>

size

public int size()
Specified by:
size in interface Collection<List<E>>
Specified by:
size in interface List<List<E>>
Specified by:
size in class AbstractCollection<List<E>>

main

public static void main(String[] args)
Ad hoc test. See also UtilTest.testCombiningGenerator.

Parameters:
args - ignored

Get Mondrian at SourceForge.net. Fast, secure and free Open Source software downloads