Package programming5.arrays

Examples of programming5.arrays.SubsetGenerator.nextSet()


  public MathSet<Set<E>> parts() {
    MathSet<Set<E>> result = new MathSet<Set<E>>();
    E[] elements = (E[])this.toArray();
    SubsetGenerator subsetGen = new SubsetGenerator(this.size());
    int[] subsetIndices;
    while ((subsetIndices = subsetGen.nextSet()) != null) {
      MathSet<E> subset = new MathSet<E>();
      for (int index : subsetIndices) {
        subset.add(elements[index]);
      }
      result.add(subset);
View Full Code Here


  public static <T> Set<Set<T>> parts(Set<T> set) {
    MathSet<Set<T>> result = new MathSet<Set<T>>();
    T[] elements = (T[])set.toArray();
    SubsetGenerator subsetGen = new SubsetGenerator(set.size());
    int[] subsetIndices;
    while ((subsetIndices = subsetGen.nextSet()) != null) {
      MathSet<T> subset = new MathSet<T>();
      for (int index : subsetIndices) {
        subset.add(elements[index]);
      }
      result.add(subset);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.