<commit_before>package algorithms;

import algorithms.misc.MiscMath;
import java.math.BigInteger;

/**
Class to iterate over every combination of subsets within n objects in an 
ordered manner.

The class uses Gosper's hack from
  http://read.seas.harvard.edu/cs207/2012/

 * @author nichole
 */
public class SubsetChooser {
    
    private final int n;

    private final int k;

    private long x64;
    
    private final long highBit64;
    
    private BigInteger x;
    
    private final BigInteger highBit;

    private long count = 0;

    private final long np;

    /**
     * constructor with the number of indexes to choose from, n, and the size of
     * the subset, k.
     * @param n the number of indexes that the selector will choose from
     * @param k the subset size of selected indexes
     */
    public SubsetChooser(int n, int k) {
        
        if (k > 13) {
            throw new IllegalArgumentException(
                "currently, class can only handle k < 13, but changes to accomodate larger could be made");
        }

        this.n = n;

        this.k = k;

        count = 1;

        np = MiscMath.computeNDivNMinusK(n, k)/MiscMath.factorial(k);

        if (n < 64) {
            
            highBit64 = 1L << n;

            x64 = (1L << k) - 1;

            x = null;
            
            highBit = null;
            
        } else {
            
            byte[] val = MiscMath.writeToBigEndianBytes((1L << k) - 1);
            x = new BigInteger(val);
            
            BigInteger hb = new BigInteger(MiscMath.writeToBigEndianBytes(1));<commit_msg>added more argument checking to SubsetChooser.java<commit_after>package algorithms;

import algorithms.misc.MiscMath;
import java.math.BigInteger;

/**
Class to iterate over every combination of subsets within n objects in an 
ordered manner.

The class uses Gosper's hack from
  http://read.seas.harvard.edu/cs207/2012/

 * @author nichole
 */
public class SubsetChooser {
    
    private final int n;

    private final int k;

    private long x64;
    
    private final long highBit64;
    
    private BigInteger x;
    
    private final BigInteger highBit;

    private long count = 0;

    private final long np;

    /**
     * constructor with the number of indexes to choose from, n, and the size of
     * the subset, k.
     * @param n the number of indexes that the selector will choose from
     * @param k the subset size of selected indexes.  the maximum value currently
     * accepted is 12.
     */
    public SubsetChooser(int n, int k) {
        
        if (k > 13) {
            throw new IllegalArgumentException(
                "currently, class can only handle k < 13, but changes to accomodate larger could be made");
        }
        if (n < 1) {
            throw new IllegalArgumentException("n must be larger than 0");
        }
        if (k < 1) {
            throw new IllegalArgumentException("k must be larger than 0");
        }
        if (k > n) {
            throw new IllegalArgumentException("k must be less than or equal to n");
        }
        
        this.n = n;

        this.k = k;

        count = 1;

        np = MiscMath.computeNDivNMinusK(n, k)/MiscMath.factorial(k);

        if (n < 64) {
            
            highBit64 = 1L << n;

            x64 = (1L << k) - 1;

            x = null;
            
            highBit = null;
            
        } else {
            
            byte[] val = MiscMath.writeToBigEndianBytes((1L << k) - 1);
            x = new BigInteger(val);
            
            BigInteger hb = new BigInteger(MiscMath.writeToBigEndianBytes(1));
{'fraction_non_alphanumeric': 0.08164383561643836, 'fraction_numerical': 0.017534246575342465, 'mean_word_length': 1.7659090909090909, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1988098', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1028, 'n_words': 371}