<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.coll;

import java.util.ArrayList;
import java.util.Collection;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;

import org.apache.commons.collections4.IteratorUtils;
import org.apache.commons.collections4.iterators.ArrayListIterator;

public class ListActionDispatcher<E> implements List<E> {
    protected final List<E>             cache;
    protected final Map<List<E>,Object> targetsMap;
    protected final Set<List<E>>        targets;
    private final int                   startIndex, endIndex;
    
    protected ListActionDispatcher(List<E> cache, Map<List<E>, Object> targetsMap, int startIndex, int endIndex){
	this.cache=cache;
	this.targetsMap=targetsMap;
	this.targets=targetsMap.keySet();
	this.startIndex = startIndex;
	this.endIndex = endIndex;
    }
    
    public ListActionDispatcher(List<E> cache){
	this(cache,new IdentityHashMap<List<E>,Object>(), 0, Integer.MAX_VALUE);
	if(cache==null)
	    throw new NullPointerException("Supplied cache is intolerably null.");
    }//end constructor
    
    public ListActionDispatcher() {
	this(new ArrayList<E>());
    }
    
    private boolean isRoot(){
	return startIndex==0 && endIndex==Integer.MAX_VALUE;
    }<commit_msg>Redesign: ListActionDispatcher can use a DummyCache internally if none specified.<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.coll;

import java.util.Collection;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;

import org.apache.commons.collections4.IteratorUtils;

public class ListActionDispatcher<E> implements List<E> {
    protected final List<E>             cache;
    protected final Map<List<E>,Object> targetsMap;
    protected final Set<List<E>>        targets;
    private final int                   startIndex, endIndex;
    
    protected ListActionDispatcher(List<E> cache, Map<List<E>, Object> targetsMap, int startIndex, int endIndex){
	this.cache=cache;
	this.targetsMap=targetsMap;
	this.targets=targetsMap.keySet();
	this.startIndex = startIndex;
	this.endIndex = endIndex;
    }
    
    public ListActionDispatcher(List<E> cache){
	this(cache,new IdentityHashMap<List<E>,Object>(), 0, Integer.MAX_VALUE);
    }//end constructor
    
    public ListActionDispatcher() {
	this(new DummyList<E>("This ListActionDispatcher has a dummylist."));
    }
    
    private boolean isRoot(){
	return startIndex==0 && endIndex==Integer.MAX_VALUE;
    }
{'fraction_non_alphanumeric': 0.1763922195576872, 'fraction_numerical': 0.007194244604316547, 'mean_word_length': 4.42485549132948, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, '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': '2367431', 'n_tokens_mistral': 1061, 'n_tokens_neox': 1009, 'n_words': 283}