<commit_before>/*
 * 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.
 */
package org.apache.commons.jexl3.internal;

import java.lang.reflect.Array;
import org.apache.commons.jexl3.JexlArithmetic;
import org.apache.commons.jexl3.internal.introspection.MethodKey;
import java.util.HashMap;
import java.util.Map;

/**
 * Helper class to create typed arrays.
 */
public class ArrayBuilder implements JexlArithmetic.ArrayBuilder {
    /** The boxing types to primitive conversion map. */
    private static final int PRIMITIVE_SIZE = 8;
    private static final Map<Class<?>, Class<?>> BOXING_CLASSES;
    static {
        BOXING_CLASSES = new HashMap<Class<?>, Class<?>>(PRIMITIVE_SIZE);
        BOXING_CLASSES.put(Boolean.class, Boolean.TYPE);
        BOXING_CLASSES.put(Byte.class, Byte.TYPE);
        BOXING_CLASSES.put(Character.class, Character.TYPE);
        BOXING_CLASSES.put(Double.class, Double.TYPE);
        BOXING_CLASSES.put(Float.class, Float.TYPE);
        BOXING_CLASSES.put(Integer.class, Integer.TYPE);
        BOXING_CLASSES.put(Long.class, Long.TYPE);
        BOXING_CLASSES.put(Short.class, Short.TYPE);
    }

    private static Class<?> unboxingClass(Class<?> parm) {
        Class<?> prim = BOXING_CLASSES.get(parm);
        return prim == null ? parm : prim;
    }

    /** The intended class array. */
    private Class<?> commonClass = null;
    /** Whether the array stores numbers. */
    private boolean isNumber = true;
    /** Whether we can try unboxing. */
    private boolean unboxing = true;
    /** The untyped list of items being added. */<commit_msg>Nitpicks ( try regain access to account)<commit_after>/*
 * 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.
 */
package org.apache.commons.jexl3.internal;

import org.apache.commons.jexl3.JexlArithmetic;

import java.lang.reflect.Array;
import java.util.IdentityHashMap;
import java.util.Map;

/**
 * Helper class to create typed arrays.
 */
public class ArrayBuilder implements JexlArithmetic.ArrayBuilder {
    /** The boxing types to primitive conversion map. */
    private static final int PRIMITIVE_SIZE = 8;
    private static final Map<Class<?>, Class<?>> BOXING_CLASSES;
    static {
        BOXING_CLASSES = new IdentityHashMap<Class<?>, Class<?>>(PRIMITIVE_SIZE);
        BOXING_CLASSES.put(Boolean.class, Boolean.TYPE);
        BOXING_CLASSES.put(Byte.class, Byte.TYPE);
        BOXING_CLASSES.put(Character.class, Character.TYPE);
        BOXING_CLASSES.put(Double.class, Double.TYPE);
        BOXING_CLASSES.put(Float.class, Float.TYPE);
        BOXING_CLASSES.put(Integer.class, Integer.TYPE);
        BOXING_CLASSES.put(Long.class, Long.TYPE);
        BOXING_CLASSES.put(Short.class, Short.TYPE);
    }

    private static Class<?> unboxingClass(Class<?> parm) {
        Class<?> prim = BOXING_CLASSES.get(parm);
        return prim == null ? parm : prim;
    }

    /** The intended class array. */
    private Class<?> commonClass = null;
    /** Whether the array stores numbers. */
    private boolean isNumber = true;
    /** Whether we can try unboxing. */
    private boolean unboxing = true;
    /** The untyped list of items being added. */
{'fraction_non_alphanumeric': 0.09801809564842741, 'fraction_numerical': 0.003231365790607497, 'mean_word_length': 3.499031007751938, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '2014846', 'n_tokens_mistral': 1359, 'n_tokens_neox': 1297, 'n_words': 447}