<commit_before>package eu.nicecode.eliasfano;

import java.util.Iterator;

/**
 * This class reads an array compressed with {@link eu.nicecode.eliasfano.EliasFano} in a stream fashion.
 * 
 * @author <NAME>
 *
 */
public class EliasFanoIterator implements Iterator<Integer> {

	private int idx = 0;
	private int curr = -1;
	
	private long inOffset;
	private long highBitsOffset;
	private long lowBitsOffset;
	
	private Bits bits;
	
	private byte[] in;
	private int size;
	private int l;
	private int delta = 0;
	
	/**
	 * 
	 * @param in the data compressed using {@link eu.nicecode.eliasfano.EliasFano}
	 * @param inOffset {@code in}'s offset
	 * @param size the number of elements in the uncompressed data
	 * @param l the number of lower bits used to compress the data
	 */
	public EliasFanoIterator(byte[] in, int inOffset, int size, int l) {
		
		this.in = in;
		
		this.size = size;
		
		this.l = l;
		
		this.inOffset = inOffset;
		lowBitsOffset = inOffset * Byte.SIZE;
		highBitsOffset = roundUp(lowBitsOffset + (l * size), Byte.SIZE);

		bits = new Bits();
	}
	
	/*
	 * TODO: factorize this method
	 */
	private long roundUp(long val, long den) {

		val = val == 0 ? den : val;
		return (val % den == 0) ? val : val + (den - (val % den));

	}
	
	@Override
	public boolean hasNext() {
		
		return idx < size;
	}

	@Override
	public Integer next() {
		<commit_msg>minor changes<commit_after>package eu.nicecode.eliasfano;

import java.util.Iterator;

/**
 * This class reads an array compressed with {@link eu.nicecode.eliasfano.EliasFano} in a stream fashion.
 * 
 * @author <NAME>
 *
 */
public class EliasFanoIterator implements Iterator<Integer> {

	private int idx = 0;
	private int curr = -1;
	
	private long inOffset;
	private long highBitsOffset;
	private long lowBitsOffset;
	
	private Bits bits;
	
	private byte[] in;
	private int size;
	private int l;
	private int delta = 0;
	
	/**
	 * 
	 * @param in the data compressed using {@link eu.nicecode.eliasfano.EliasFano}
	 * @param inOffset {@code in}'s offset
	 * @param size the number of elements in the uncompressed data
	 * @param l the number of lower bits used to compress the data
	 */
	public EliasFanoIterator(byte[] in, int inOffset, int size, int l) {
		
		this.in = in;
		
		this.size = size;
		
		this.l = l;
		
		this.inOffset = inOffset;
		lowBitsOffset = inOffset * Byte.SIZE;
		highBitsOffset = roundUp(lowBitsOffset + (l * size), Byte.SIZE);

		bits = new Bits();
	}
	
	/*
	 * TODO: factorize this method
	 */
	private long roundUp(long val, long den) {

		val = val == 0 ? den : val;
		return (val % den == 0) ? val : val + (den - (val % den));

	}
	
	
	public boolean hasNext() {
		
		return idx < size;
	}

	
	public Integer next() {
		
{'fraction_non_alphanumeric': 0.11168258633357825, 'fraction_numerical': 0.0036737692872887582, 'mean_word_length': 3.125757575757576, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '7143317', 'n_tokens_mistral': 1007, 'n_tokens_neox': 884, 'n_words': 309}