<commit_before>package org.apache.commons.ognl;

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public final class ObjectArrayPool
    extends Object
{
    private IntHashMap pools = new IntHashMap( 23 );

    public static class SizePool
        extends Object
    {
        private List arrays = new ArrayList();

        private int arraySize;

        private int size;

        private int created = 0;

        private int recovered = 0;

        private int recycled = 0;

        public SizePool( int arraySize )
        {
            this( arraySize, 0 );
        }

        public SizePool( int arraySize, int initialSize )
        {
            super();
            this.arraySize = arraySize;
            for ( int i = 0; i < initialSize; i++ )
            {
                arrays.add( new Object[arraySize] );
            }
            created = size = initialSize;
        }

        public int getArraySize()
        {
            return arraySize;
        }

        public Object[] create()
        {
            Object[] result;

            if ( size > 0 )
            {
                result = (Object[]) arrays.remove( size - 1 );
                size--;
                recovered++;
            }
            else
            {
                result = new Object[arraySize];
                created++;
            }
            return result;
        }

        public synchronized void recycle( Object[] value )
        {
            if ( value != null )
            {
                if ( value.length != arraySize )
                {
                    throw new IllegalArgumentException( "recycled array size " + value.length
                        + " inappropriate for pool array size " + arraySize );
                }
                Arrays.fill( value, null );
                arrays.add( value );
                size++;
                recycled++;
            }
            else
            {
                throw new IllegalArgumentException( "cannot recycle null object" );
            }
        }

        /**
         * Returns the number of items in the pool
         */
        public int getSize()
        {
            return size;
        }

        /**
         * Returns the number of items this pool has created since it's construction.
         */
        public int getCreatedCount()
        {
            return created;
        }

        /**
         * Returns the number of items this pool has recovered from the pool since its construction.
         */
        public int getRecoveredCount()
        {
            return recovered;
        }

        /**
         * Returns the number of items this pool has recycled since it's construction.
         */
        public int getRecycledCount()
        {
            return recycled;
        }
    }

    public ObjectArrayPool()
    {
        super();
    }

    public IntHashMap getSizePools()
    {
        return pools;
    }

    public synchronized SizePool getSizePool( int arraySize )
    {
        SizePool result = (SizePool) pools.get( arraySize );

        if ( result == null )
        {
            pools.put( arraySize, result = new SizePool( arraySize ) );
        }
        return result;
    }

    public synchronized Object[] create( int arraySize )
    {
        return getSizePool( arraySize ).create();
    }

    public synchronized Object[] create( Object singleton )
    {
        Object[] result = create( 1 );

        result[0] = singleton;
        return result;
    }

    public synchronized Object[] create( Object object1, Object object2 )
    {
        Object[] result = create( 2 );
<commit_msg>fixed pools raw type<commit_after>package org.apache.commons.ognl;

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public final class ObjectArrayPool
    extends Object
{
    private IntHashMap<Integer, SizePool> pools = new IntHashMap<Integer, SizePool>( 23 );

    public static class SizePool
        extends Object
    {
        private List arrays = new ArrayList();

        private int arraySize;

        private int size;

        private int created = 0;

        private int recovered = 0;

        private int recycled = 0;

        public SizePool( int arraySize )
        {
            this( arraySize, 0 );
        }

        public SizePool( int arraySize, int initialSize )
        {
            super();
            this.arraySize = arraySize;
            for ( int i = 0; i < initialSize; i++ )
            {
                arrays.add( new Object[arraySize] );
            }
            created = size = initialSize;
        }

        public int getArraySize()
        {
            return arraySize;
        }

        public Object[] create()
        {
            Object[] result;

            if ( size > 0 )
            {
                result = (Object[]) arrays.remove( size - 1 );
                size--;
                recovered++;
            }
            else
            {
                result = new Object[arraySize];
                created++;
            }
            return result;
        }

        public synchronized void recycle( Object[] value )
        {
            if ( value != null )
            {
                if ( value.length != arraySize )
                {
                    throw new IllegalArgumentException( "recycled array size " + value.length
                        + " inappropriate for pool array size " + arraySize );
                }
                Arrays.fill( value, null );
                arrays.add( value );
                size++;
                recycled++;
            }
            else
            {
                throw new IllegalArgumentException( "cannot recycle null object" );
            }
        }

        /**
         * Returns the number of items in the pool
         */
        public int getSize()
        {
            return size;
        }

        /**
         * Returns the number of items this pool has created since it's construction.
         */
        public int getCreatedCount()
        {
            return created;
        }

        /**
         * Returns the number of items this pool has recovered from the pool since its construction.
         */
        public int getRecoveredCount()
        {
            return recovered;
        }

        /**
         * Returns the number of items this pool has recycled since it's construction.
         */
        public int getRecycledCount()
        {
            return recycled;
        }
    }

    public ObjectArrayPool()
    {
        super();
    }

    public IntHashMap<Integer, SizePool> getSizePools()
    {
        return pools;
    }

    public synchronized SizePool getSizePool( int arraySize )
    {
        SizePool result = pools.get( arraySize );

        if ( result == null )
        {
            pools.put( arraySize, result = new SizePool( arraySize ) );
        }
        return result;
    }

    public synchronized Object[] create( int arraySize )
    {
        return getSizePool( arraySize ).create();
    }

    public synchronized Object[] create( Object singleton )
    {
        Object[] result = create( 1 );

        result[0] = singleton;
        return result;
    }

    public synchronized Object[] create( Object object1, Object object2 )
    {
        Object[] result = create( 2 );

{'fraction_non_alphanumeric': 0.077623542476402, 'fraction_numerical': 0.003997779011660188, 'mean_word_length': 1.5326209223847018, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '2889543', 'n_tokens_mistral': 2236, 'n_tokens_neox': 2118, 'n_words': 787}