<commit_before>package railo.runtime.util;

import railo.runtime.PageContext;
import railo.runtime.engine.ThreadLocalPageContext;
import railo.runtime.type.Objects;
import railo.runtime.type.Query;
import railo.runtime.type.QueryColumn;
import railo.runtime.type.QueryImpl;
import railo.runtime.type.Collection.Key;

/**
 * Stack for Query Objects
 */
public final class QueryStackImpl implements QueryStack {
	Query[] queries=new QueryImpl[20];
	int start=queries.length;
	
	/**
     * @see railo.runtime.util.QueryStack#addQuery(railo.runtime.type.Query)
     */
	public void addQuery(Query query) {
        if(start<1)grow();
        queries[--start]= query;
	}
	public void addQuery(QueryImpl query) {
        if(start<1)grow();
        queries[--start]=query;
	}

    /**
     * @see railo.runtime.util.QueryStack#removeQuery()
     */
	public void removeQuery() {
        //print.ln("queries["+start+"]=null;");
        queries[start++]=null;
	}
	
	/**
     * @see railo.runtime.util.QueryStack#isEmpty()
     */
	public boolean isEmpty() {
		return start==queries.length;
	}

	/**
     * @see railo.runtime.util.QueryStack#getDataFromACollection(java.lang.String)
     */
	public Object getDataFromACollection(String key) {
		return getDataFromACollection(ThreadLocalPageContext.get(),key);
	}
	
	/**
	 * @see railo.runtime.util.QueryStack#getDataFromACollection(railo.runtime.PageContext, java.lang.String)
	 */
	public Object getDataFromACollection(PageContext pc,String key) {
		Object rtn=null;
		
		// get data from queries
		for(int i=start;i<queries.length;i++) {
			rtn=((Objects)queries[i]).get(pc,key,"");
			if(rtn!=null) {
				return rtn;
			}
		}
		return null;
	}

	/**
	 * @see railo.runtime.util.QueryStack#getDataFromACollection(railo.runtime.type.Collection.Key)
	 */
	public Object getDataFromACollection(Key key) {
		return getDataFromACollection(ThreadLocalPageContext.get(),key); 
	}
	
	/**
	 * @see railo.runtime.util.QueryStack#getDataFromACollection(railo.runtime.PageContext, railo.runtime.type.Collection.Key)
	 */
	public Object getDataFromACollection(PageContext pc,Key key) {
		Object rtn=null;
		
		// get data from queries
		for(int i=start;i<queries.length;i++) {
			rtn=((QueryImpl)queries[i]).get(pc,key,"");
			if(rtn!=null) {
				return rtn;
			}
		}
		return null;
	}
	
	/**
     * @see railo.runtime.util.QueryStack#getColumnFromACollection(java.lang.String)
     */
	public QueryColumn getColumnFromACollection(String key) {
		QueryColumn rtn=null;
		
		// get data from queries
		for(int i=start;i<queries.length;i++) {
			rtn=queries[i].getColumn(key,null);
			if(rtn!=null) {
				return rtn;
			}
		}
		return null;
	}

	/**
	 *
	 * @see railo.runtime.util.QueryStack#getColumnFromACollection(railo.runtime.type.Collection.Key)
	 */
	public QueryColumn getColumnFromACollection(Key key) {
		QueryColumn rtn=null;
		
		// get data from queries
		for(int i=start;i<queries.length;i++) {
			rtn=queries[i].getColumn(key,null);
			if(rtn!=null) {
				return rtn;
			}
		}
		return null;
	}
	
	/**
     * @see railo.runtime.util.QueryStack#clear()
     */
	public void clear() {
		for(int i=start;i<queries.length;i++) {
			queries[i]=null;
		}
		start=queries.length;
	}
    
    private void grow() {
        Query[] tmp=new QueryImpl[queries.length+20];
        for(int i=0;i<queries.length;i++) {
            tmp[i+20]=queries[i];
        }
        queries=tmp;
        start+=20;
    }
    
	/**
	 * @see railo.runtime.util.QueryStack#getQueries()
	 */
	public Query[] getQueries() {
		Query[] tmp=new QueryImpl[queries.length-start];
		int count=0;
		for(int i=start;i<queries.length;i++) {
			tmp[count++]=queries[i];
		}
		return tmp;
	}
}<commit_msg>remove unnecessary method addQuery(QueryImpl)<commit_after>package railo.runtime.util;

import railo.runtime.PageContext;
import railo.runtime.engine.ThreadLocalPageContext;
import railo.runtime.type.Objects;
import railo.runtime.type.Query;
import railo.runtime.type.QueryColumn;
import railo.runtime.type.QueryImpl;
import railo.runtime.type.Collection.Key;

/**
 * Stack for Query Objects
 */
public final class QueryStackImpl implements QueryStack {
	Query[] queries=new QueryImpl[20];
	int start=queries.length;
	
	/**
     * @see railo.runtime.util.QueryStack#addQuery(railo.runtime.type.Query)
     */
	public void addQuery(Query query) {
        if(start<1)grow();
        queries[--start]= query;
	}
	/*public void addQueryImpl(QueryImpl query) {
        if(start<1)grow();
        queries[--start]=query;
	}*/

    /**
     * @see railo.runtime.util.QueryStack#removeQuery()
     */
	public void removeQuery() {
        //print.ln("queries["+start+"]=null;");
        queries[start++]=null;
	}
	
	/**
     * @see railo.runtime.util.QueryStack#isEmpty()
     */
	public boolean isEmpty() {
		return start==queries.length;
	}

	/**
     * @see railo.runtime.util.QueryStack#getDataFromACollection(java.lang.String)
     */
	public Object getDataFromACollection(String key) {
		return getDataFromACollection(ThreadLocalPageContext.get(),key);
	}
	
	/**
	 * @see railo.runtime.util.QueryStack#getDataFromACollection(railo.runtime.PageContext, java.lang.String)
	 */
	public Object getDataFromACollection(PageContext pc,String key) {
		Object rtn=null;
		
		// get data from queries
		for(int i=start;i<queries.length;i++) {
			rtn=((Objects)queries[i]).get(pc,key,"");
			if(rtn!=null) {
				return rtn;
			}
		}
		return null;
	}

	/**
	 * @see railo.runtime.util.QueryStack#getDataFromACollection(railo.runtime.type.Collection.Key)
	 */
	public Object getDataFromACollection(Key key) {
		return getDataFromACollection(ThreadLocalPageContext.get(),key); 
	}
	
	/**
	 * @see railo.runtime.util.QueryStack#getDataFromACollection(railo.runtime.PageContext, railo.runtime.type.Collection.Key)
	 */
	public Object getDataFromACollection(PageContext pc,Key key) {
		Object rtn=null;
		
		// get data from queries
		for(int i=start;i<queries.length;i++) {
			rtn=((QueryImpl)queries[i]).get(pc,key,"");
			if(rtn!=null) {
				return rtn;
			}
		}
		return null;
	}
	
	/**
     * @see railo.runtime.util.QueryStack#getColumnFromACollection(java.lang.String)
     */
	public QueryColumn getColumnFromACollection(String key) {
		QueryColumn rtn=null;
		
		// get data from queries
		for(int i=start;i<queries.length;i++) {
			rtn=queries[i].getColumn(key,null);
			if(rtn!=null) {
				return rtn;
			}
		}
		return null;
	}

	/**
	 *
	 * @see railo.runtime.util.QueryStack#getColumnFromACollection(railo.runtime.type.Collection.Key)
	 */
	public QueryColumn getColumnFromACollection(Key key) {
		QueryColumn rtn=null;
		
		// get data from queries
		for(int i=start;i<queries.length;i++) {
			rtn=queries[i].getColumn(key,null);
			if(rtn!=null) {
				return rtn;
			}
		}
		return null;
	}
	
	/**
     * @see railo.runtime.util.QueryStack#clear()
     */
	public void clear() {
		for(int i=start;i<queries.length;i++) {
			queries[i]=null;
		}
		start=queries.length;
	}
    
    private void grow() {
        Query[] tmp=new QueryImpl[queries.length+20];
        for(int i=0;i<queries.length;i++) {
            tmp[i+20]=queries[i];
        }
        queries=tmp;
        start+=20;
    }
    
	/**
	 * @see railo.runtime.util.QueryStack#getQueries()
	 */
	public Query[] getQueries() {
		Query[] tmp=new QueryImpl[queries.length-start];
		int count=0;
		for(int i=start;i<queries.length;i++) {
			tmp[count++]=queries[i];
		}
		return tmp;
	}
}
{'fraction_non_alphanumeric': 0.15091299677765843, 'fraction_numerical': 0.00322234156820623, 'mean_word_length': 3.5420731707317072, 'pattern_counts': {'":': 0, '<': 21, '<?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': '2768727', 'n_tokens_mistral': 2824, 'n_tokens_neox': 2633, 'n_words': 393}