<commit_before>/*
 * Copyright 2012 Greplin, Inc. All Rights Reserved.
 */

package com.greplin.lucene.filter;

import org.apache.lucene.util.FixedBitSet;

/**
 * A mutable sub-slice of a DocIdSet.
 */
public class FixedBitSetSlice extends DocIdSetSlice {

  /**
   * The underlying fixed bit set.
   */
  private final FixedBitSet underlying;


  /**
   * Constructs a DocIdSet that is a slice of a FixedBitSet.
   * @param underlying the underlying FixedBitSet
   * @param start the start of the slice
   * @param end the end of the slice
   */
  public FixedBitSetSlice(
      final FixedBitSet underlying, final int start, final int end) {
    super(underlying, start, end);
    this.underlying = underlying;
  }


  /**
   * @return the underlying FixedBitSet
   */
  public FixedBitSet getUnderlying() {
    return underlying;
  }


  /**
   * Sets the index-th bit of this slice, meaning the
   * (start + index)th bit of the underlying bitset.
   * @param index the index into the slice to set
   */
  public void set(final int index) {
    this.underlying.set(index + this.getStart());
  }


  /**<commit_msg>Add a get bit function to FixedBitSetSlice<commit_after>/*
 * Copyright 2012 Greplin, Inc. All Rights Reserved.
 */

package com.greplin.lucene.filter;

import org.apache.lucene.util.FixedBitSet;

/**
 * A mutable sub-slice of a DocIdSet.
 */
public class FixedBitSetSlice extends DocIdSetSlice {

  /**
   * The underlying fixed bit set.
   */
  private final FixedBitSet underlying;


  /**
   * Constructs a DocIdSet that is a slice of a FixedBitSet.
   * @param underlying the underlying FixedBitSet
   * @param start the start of the slice
   * @param end the end of the slice
   */
  public FixedBitSetSlice(
      final FixedBitSet underlying, final int start, final int end) {
    super(underlying, start, end);
    this.underlying = underlying;
  }


  /**
   * @return the underlying FixedBitSet
   */
  public FixedBitSet getUnderlying() {
    return underlying;
  }


  /**
   * Gets the index-th bit of this slice, meaning the
   * (start + index)th bit of the underlying bitset.
   * @param index the index into the slice to get
   * @return whether the bit is set
   */
  public boolean get(final int index) {
    return this.underlying.get(index + this.getStart());
  }


  /**
   * Sets the index-th bit of this slice, meaning the
   * (start + index)th bit of the underlying bitset.
   * @param index the index into the slice to set
   */
  public void set(final int index) {
    this.underlying.set(index + this.getStart());
  }


  /**
{'fraction_non_alphanumeric': 0.0948309366498251, 'fraction_numerical': 0.003109211037699184, 'mean_word_length': 2.923780487804878, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '676792', 'n_tokens_mistral': 820, 'n_tokens_neox': 770, 'n_words': 281}