Class SelectionGenerator

java.lang.Object
edu.cmu.tetrad.util.SelectionGenerator

public final class SelectionGenerator extends Object
Generates (nonrecursively) all of the selections from a items, where a is a nonnegative integer. The values of a is given in the constructor, and the sequence of seletions is obtained by repeatedly calling the next() method. When the sequence is finished, null is returned.> 0

A valid combination for the sequence of combinations for a generated by this class is an array x[] of a integers i, 0 <= i < a.

To see what this class does, try calling SelectionGenerator.testPrint(5, 3), for instance.

Version:
$Id: $Id
Author:
josephramsey
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new selection generator for a items.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Getter for the field a.
    int[]
    next.
    static void
    testPrint(int a)
    This static method will print the series of combinations for a choose b to System.out.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SelectionGenerator

      public SelectionGenerator(int a)
      Constructs a new selection generator for a items. Once this initialization has been performed, successive calls to next() will produce the series of selections.
      Parameters:
      a - the number of objects being selected from.
  • Method Details

    • testPrint

      public static void testPrint(int a)
      This static method will print the series of combinations for a choose b to System.out.
      Parameters:
      a - the number of objects being selected from.
    • next

      public int[] next()

      next.

      Returns:
      the next selection in the series, or null if the series is finished.
    • getA

      public int getA()

      Getter for the field a.

      Returns:
      Ibid.