// Path: src/main/java/fr/liglab/jlcm/util/ItemAndSupport.java
// public class ItemAndSupport implements Comparable<ItemAndSupport> {
// 	
// 	public int item;
// 	public int support;
// 	
// 	public ItemAndSupport(int i, int s) {
// 		this.item = i;
// 		this.support = s;
// 	}
// 
// 	/**
// 	 *  Returns a negative integer, zero, or a positive integer 
// 	 *  as this object's support is less than, equal to, or 
// 	 *  greater than the specified object's support. 
// 	 */
// 	public int compareTo(ItemAndSupport other) {
// 		if (other.support == this.support) {
// 			return this.item - other.item;
// 		} else {
// 			return other.support - this.support;
// 		}
// 	}
// 
// }
// 
// Path: src/main/java/fr/liglab/jlcm/util/ItemsetsFactory.java
// public class ItemsetsFactory {
// 	
// 	// default constructor FTW
// 	
// 	protected TIntArrayList buffer = new TIntArrayList();
// 	protected int capacity = 50;
// 	
// 	/**
// 	 * If you're going big
// 	 * @param c an estimation of future array's size
// 	 */
// 	public void ensureCapacity(final int c) {
// 		buffer.ensureCapacity(c);
// 	}
// 	
// 	public void add(final int i) {
// 		buffer.add(i);
// 	}
// 	
// 	/**
// 	 * Resets the builder by the way
// 	 * @return an array containing latest items added.
// 	 */
// 	public int[] get() {
// 		if (capacity < buffer.size()) {
// 			capacity = buffer.size();
// 		}
// 		int[] res = buffer.toArray();
// 		buffer.clear(capacity);
// 		return res;
// 	}
// 
// 	public boolean isEmpty() {
// 		return buffer.isEmpty();
// 	}
// 	
// 	/////////////////////////////////////////////////////////////////////////
// 	
// 	
// 	/**
// 	 * @return a new array concatenating each of its arguments
// 	 */
// 	public static int[] extend(final int[] pattern, final int extension, final int[] closure) {
// 		if (closure == null) {
// 			return extend(pattern, extension);
// 		}
// 		
// 		int[] extended = new int[pattern.length + closure.length + 1];
// 		
// 		System.arraycopy(pattern, 0, extended, 0, pattern.length);
// 		extended[pattern.length] = extension;
// 		System.arraycopy(closure, 0, extended, pattern.length + 1, closure.length);
// 
// 		return extended;
// 	}
// 
// 	/**
// 	 * @return a new array concatenating each of its arguments with their contents renamed EXCEPT for 'pattern' !
// 	 */
// 	public static int[] extendRename(final int[] closure, final int extension, final int[] pattern, 
// 			final int[] renaming) {
// 		
// 		int[] extended = new int[pattern.length + closure.length + 1];
// 		
// 		for (int i = 0; i < closure.length; i++) {
// 			extended[i] = renaming[closure[i]];
// 		}
// 		
// 		extended[closure.length] = renaming[extension];
// 		System.arraycopy(pattern, 0, extended, closure.length + 1, pattern.length);
// 		
// 		return extended;
// 	}
// 	
// 	public static int[] extend(final int[] pattern, final int extension, final int[] closure, final int[] ignoreItems) {
// 		if (ignoreItems == null) {
// 			return extend(pattern, extension, closure);
// 		}
// 		
// 		int[] extended = new int[pattern.length + closure.length + 1 + ignoreItems.length];
// 
// 		System.arraycopy(pattern, 0, extended, 0, pattern.length);
// 		extended[pattern.length] = extension;
// 		System.arraycopy(closure, 0, extended, pattern.length + 1, closure.length);
// 		System.arraycopy(ignoreItems, 0, extended, pattern.length + 1 + closure.length, ignoreItems.length);
// 		System.arraycopy(closure, 0, extended, pattern.length+1, closure.length);
// 		
// 		return extended;
// 	}
// 
// 	/**
// 	 * @return a new array concatenating each of its arguments
// 	 */
// 	public static int[] extend(final int[] closure, final int extension) {
// 		int[] extended = new int[closure.length + 1];
// 		
// 		System.arraycopy(closure, 0, extended, 0, closure.length);
// 		extended[closure.length] = extension;
// 		
// 		return extended;
// 	}
// }


import java.util.Arrays;
import java.util.Iterator;
import java.util.PriorityQueue;
import java.util.concurrent.atomic.AtomicInteger;
import fr.liglab.jlcm.util.ItemAndSupport;
import fr.liglab.jlcm.util.ItemsetsFactory;
import gnu.trove.iterator.TIntIntIterator;
import gnu.trove.map.hash.TIntIntHashMap;
			TransactionReader transaction = transactions.next();
			int weight = transaction.getTransactionSupport();

			if (weight > 0) {
				if (transaction.hasNext()) {
					weightsSum += weight;
					transactionsCount++;
				}

				while (transaction.hasNext()) {
					int item = transaction.next();
					if (item <= maxItem) {
						this.supportCounts[item] += weight;
						this.distinctTransactionsCounts[item]++;
					}
				}
			}
		}

		this.transactionsCount = weightsSum;
		this.distinctTransactionsCount = transactionsCount;

		// ignored items
		this.supportCounts[extension] = 0;
		this.distinctTransactionsCounts[extension] = 0;
		this.maxCandidate = extension;

		// item filtering and final computations : some are infrequent, some
		// belong to closure

// Path: src/main/java/fr/liglab/jlcm/util/ItemAndSupport.java
// public class ItemAndSupport implements Comparable<ItemAndSupport> {
// 	
// 	public int item;
// 	public int support;
// 	
// 	public ItemAndSupport(int i, int s) {
// 		this.item = i;
// 		this.support = s;
// 	}
// 
// 	/**
// 	 *  Returns a negative integer, zero, or a positive integer 
// 	 *  as this object's support is less than, equal to, or 
// 	 *  greater than the specified object's support. 
// 	 */
// 	public int compareTo(ItemAndSupport other) {
// 		if (other.support == this.support) {
// 			return this.item - other.item;
// 		} else {
// 			return other.support - this.support;
// 		}
// 	}
// 
// }
// 
// Path: src/main/java/fr/liglab/jlcm/util/ItemsetsFactory.java
// public class ItemsetsFactory {
// 	
// 	// default constructor FTW
// 	
// 	protected TIntArrayList buffer = new TIntArrayList();
// 	protected int capacity = 50;
// 	
// 	/**
// 	 * If you're going big
// 	 * @param c an estimation of future array's size
// 	 */
// 	public void ensureCapacity(final int c) {
// 		buffer.ensureCapacity(c);
// 	}
// 	
// 	public void add(final int i) {
// 		buffer.add(i);
// 	}
// 	
// 	/**
// 	 * Resets the builder by the way
// 	 * @return an array containing latest items added.
// 	 */
// 	public int[] get() {
// 		if (capacity < buffer.size()) {
// 			capacity = buffer.size();
// 		}
// 		int[] res = buffer.toArray();
// 		buffer.clear(capacity);
// 		return res;
// 	}
// 
// 	public boolean isEmpty() {
// 		return buffer.isEmpty();
// 	}
// 	
// 	/////////////////////////////////////////////////////////////////////////
// 	
// 	
// 	/**
// 	 * @return a new array concatenating each of its arguments
// 	 */
// 	public static int[] extend(final int[] pattern, final int extension, final int[] closure) {
// 		if (closure == null) {
// 			return extend(pattern, extension);
// 		}
// 		
// 		int[] extended = new int[pattern.length + closure.length + 1];
// 		
// 		System.arraycopy(pattern, 0, extended, 0, pattern.length);
// 		extended[pattern.length] = extension;
// 		System.arraycopy(closure, 0, extended, pattern.length + 1, closure.length);
// 
// 		return extended;
// 	}
// 
// 	/**
// 	 * @return a new array concatenating each of its arguments with their contents renamed EXCEPT for 'pattern' !
// 	 */
// 	public static int[] extendRename(final int[] closure, final int extension, final int[] pattern, 
// 			final int[] renaming) {
// 		
// 		int[] extended = new int[pattern.length + closure.length + 1];
// 		
// 		for (int i = 0; i < closure.length; i++) {
// 			extended[i] = renaming[closure[i]];
// 		}
// 		
// 		extended[closure.length] = renaming[extension];
// 		System.arraycopy(pattern, 0, extended, closure.length + 1, pattern.length);
// 		
// 		return extended;
// 	}
// 	
// 	public static int[] extend(final int[] pattern, final int extension, final int[] closure, final int[] ignoreItems) {
// 		if (ignoreItems == null) {
// 			return extend(pattern, extension, closure);
// 		}
// 		
// 		int[] extended = new int[pattern.length + closure.length + 1 + ignoreItems.length];
// 
// 		System.arraycopy(pattern, 0, extended, 0, pattern.length);
// 		extended[pattern.length] = extension;
// 		System.arraycopy(closure, 0, extended, pattern.length + 1, closure.length);
// 		System.arraycopy(ignoreItems, 0, extended, pattern.length + 1 + closure.length, ignoreItems.length);
// 		System.arraycopy(closure, 0, extended, pattern.length+1, closure.length);
// 		
// 		return extended;
// 	}
// 
// 	/**
// 	 * @return a new array concatenating each of its arguments
// 	 */
// 	public static int[] extend(final int[] closure, final int extension) {
// 		int[] extended = new int[closure.length + 1];
// 		
// 		System.arraycopy(closure, 0, extended, 0, closure.length);
// 		extended[closure.length] = extension;
// 		
// 		return extended;
// 	}
// }


// Path: src/main/java/fr/liglab/jlcm/internals/Counters.java
import java.util.Arrays;
import java.util.Iterator;
import java.util.PriorityQueue;
import java.util.concurrent.atomic.AtomicInteger;
import fr.liglab.jlcm.util.ItemAndSupport;
import fr.liglab.jlcm.util.ItemsetsFactory;
import gnu.trove.iterator.TIntIntIterator;
import gnu.trove.map.hash.TIntIntHashMap;

			TransactionReader transaction = transactions.next();
			int weight = transaction.getTransactionSupport();

			if (weight > 0) {
				if (transaction.hasNext()) {
					weightsSum += weight;
					transactionsCount++;
				}

				while (transaction.hasNext()) {
					int item = transaction.next();
					if (item <= maxItem) {
						this.supportCounts[item] += weight;
						this.distinctTransactionsCounts[item]++;
					}
				}
			}
		}

		this.transactionsCount = weightsSum;
		this.distinctTransactionsCount = transactionsCount;

		// ignored items
		this.supportCounts[extension] = 0;
		this.distinctTransactionsCounts[extension] = 0;
		this.maxCandidate = extension;

		// item filtering and final computations : some are infrequent, some
		// belong to closure

		ItemsetsFactory closureBuilder = new ItemsetsFactory();