<commit_before>/*******************************************************************************
 * This file is part of TERMINAL RECALL
 * Copyright (c) 2012-2015 <NAME>
 * Part of the jTRFP.org project
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Contributors:
 *     chuck - initial API and implementation
 ******************************************************************************/

package org.jtrfp.trcl.pool;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;

import org.jtrfp.trcl.coll.ListActionDispatcher;
import org.jtrfp.trcl.pool.IndexPool.GrowthBehavior;

public class EntryBasedIndexPool<CONTAINED_TYPE> {
    //// BEAN PROPERTIES
    public static final String    NUM_UNUSED_INDICES = "numUnusedIndices",
	                          NUM_USED_INDICES   = "numUsedIndices";
    
    private final IndexPool
    indexPool = new IndexPool();
    private final ListActionDispatcher<Entry<CONTAINED_TYPE>> 
    listActionDispatcher = new ListActionDispatcher<Entry<CONTAINED_TYPE>>(new ArrayList<Entry<CONTAINED_TYPE>>());
    private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
    
    public EntryBasedIndexPool(){
	indexPool.addPropertyChangeListener(IndexPool.NUM_UNUSED_INDICES,new PropertyChangeListener(){
	    @Override
	    public void propertyChange(PropertyChangeEvent evt) {
		pcs.firePropertyChange(NUM_UNUSED_INDICES, evt.getOldValue(), evt.getNewValue());
	    }});
	indexPool.addPropertyChangeListener(IndexPool.NUM_USED_INDICES,new PropertyChangeListener(){
	    @Override
	    public void propertyChange(PropertyChangeEvent evt) {
		pcs.firePropertyChange(NUM_USED_INDICES, evt.getOldValue(), evt.getNewValue());
	    }});
    }//end constructor
    
    /**
     * 
     * @param immutableValue
     * @return The new popped Entry or null if no more are available.
     * @since Mar 23, 2015
     */<commit_msg>Bugfix: Incorrect property String in EntryBasedIndexPool.<commit_after>/*******************************************************************************
 * This file is part of TERMINAL RECALL
 * Copyright (c) 2012-2015 <NAME>
 * Part of the jTRFP.org project
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Contributors:
 *     chuck - initial API and implementation
 ******************************************************************************/

package org.jtrfp.trcl.pool;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;

import org.jtrfp.trcl.coll.ListActionDispatcher;
import org.jtrfp.trcl.pool.IndexPool.GrowthBehavior;

public class EntryBasedIndexPool<CONTAINED_TYPE> {
    //// BEAN PROPERTIES
    public static final String    NUM_UNUSED_INDICES = "numUnusedIndices",
	                          NUM_USED_INDICES   = "numUsedIndices";
    
    private final IndexPool
    indexPool = new IndexPool();
    private final ListActionDispatcher<Entry<CONTAINED_TYPE>> 
    listActionDispatcher = new ListActionDispatcher<Entry<CONTAINED_TYPE>>(new ArrayList<Entry<CONTAINED_TYPE>>());
    private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
    
    public EntryBasedIndexPool(){
	indexPool.addPropertyChangeListener(IndexPool.NUM_UNUSED_INDICES,new PropertyChangeListener(){
	    @Override
	    public void propertyChange(PropertyChangeEvent evt) {
		pcs.firePropertyChange(EntryBasedIndexPool.NUM_UNUSED_INDICES, evt.getOldValue(), evt.getNewValue());
	    }});
	indexPool.addPropertyChangeListener(IndexPool.NUM_USED_INDICES,new PropertyChangeListener(){
	    @Override
	    public void propertyChange(PropertyChangeEvent evt) {
		pcs.firePropertyChange(EntryBasedIndexPool.NUM_USED_INDICES, evt.getOldValue(), evt.getNewValue());
	    }});
    }//end constructor
    
    /**
     * 
     * @param immutableValue
     * @return The new popped Entry or null if no more are available.
     * @since Mar 23, 2015
     */
{'fraction_non_alphanumeric': 0.15055187637969095, 'fraction_numerical': 0.00706401766004415, 'mean_word_length': 4.600741656365884, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4041534', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1206, 'n_words': 295}