<commit_before>/*
 * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
 * Copyright (C) 2008 - Javolution (http://javolution.org/)
 * All rights reserved.
 * 
 * Permission to use, copy, modify, and distribute this software is
 * freely granted, provided that this notice is preserved.
 *
 * 20-sep-2012:
 * copied to com.precog.util.BitSet to allow some small additions to the API.
 */
package com.precog.util;

import javolution.util.*;
import javolution.util.FastCollection.Record;

import java.lang.UnsupportedOperationException;
import java.util.Set;
import javax.realtime.MemoryArea;
import javolution.context.ObjectFactory;
import javolution.lang.MathLib;
import javolution.lang.Reusable;

/**
 * <p> This class represents either a table of bits or a set of non-negative 
 *     numbers.</p>
 * 
 * <p> This class is integrated with the collection framework (as 
 *     a set of {@link Index indices} and obeys the collection semantic
 *     for methods such as {@link #size} (cardinality) or {@link #equals}
 *     (same set of indices).</p>
 * 
 * @author  <a href="mailto:<EMAIL>"><NAME></a>
 * @version 5.3, February 24, 2008
 */
public class BitSet extends FastCollection <Index>  implements Set <Index> , Reusable {

    /**
     * Holds the set factory.
     */
    private static final ObjectFactory FACTORY = new ObjectFactory() {

        public Object create() {
            return new BitSet();
        }
    };
    /**
     * Holds the bits (64 bits per long).
     */
    private long[] bits;

    public long[] getBits() {
        return bits;
    }

    public void setBits(long[] arr) {
        bits = arr;
        _length = arr.length << 6;
        if (_length < 0) {
            throw new IllegalArgumentException("array too long");
        }
    }

    /**
     * Holds the length in words (long) of this bit set.<commit_msg>Fix bone-headed BitSet bug I introduced.<commit_after>/*
 * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
 * Copyright (C) 2008 - Javolution (http://javolution.org/)
 * All rights reserved.
 * 
 * Permission to use, copy, modify, and distribute this software is
 * freely granted, provided that this notice is preserved.
 *
 * 20-sep-2012:
 * copied to com.precog.util.BitSet to allow some small additions to the API.
 */
package com.precog.util;

import javolution.util.*;
import javolution.util.FastCollection.Record;

import java.lang.UnsupportedOperationException;
import java.util.Set;
import javax.realtime.MemoryArea;
import javolution.context.ObjectFactory;
import javolution.lang.MathLib;
import javolution.lang.Reusable;

/**
 * <p> This class represents either a table of bits or a set of non-negative 
 *     numbers.</p>
 * 
 * <p> This class is integrated with the collection framework (as 
 *     a set of {@link Index indices} and obeys the collection semantic
 *     for methods such as {@link #size} (cardinality) or {@link #equals}
 *     (same set of indices).</p>
 * 
 * @author  <a href="mailto:<EMAIL>"><NAME></a>
 * @version 5.3, February 24, 2008
 */
public class BitSet extends FastCollection <Index>  implements Set <Index> , Reusable {

    /**
     * Holds the set factory.
     */
    private static final ObjectFactory FACTORY = new ObjectFactory() {

        public Object create() {
            return new BitSet();
        }
    };
    /**
     * Holds the bits (64 bits per long).
     */
    private long[] bits;

    public long[] getBits() {
        return bits;
    }

    public void setBits(long[] arr) {
        bits = arr;
        _length = arr.length;
    }

    /**
     * Holds the length in words (long) of this bit set.
{'fraction_non_alphanumeric': 0.11162790697674418, 'fraction_numerical': 0.01149110807113543, 'mean_word_length': 2.8524762908324552, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 23, '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': '6638671', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1052, 'n_words': 379}