<commit_before>/*
 * Copyright 2002-2004 <NAME>.
 * 
 * Licensed 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.krysalis.barcode4j;

import java.util.Map;

import org.krysalis.barcode4j.impl.codabar.Codabar;
import org.krysalis.barcode4j.impl.code128.Code128;
import org.krysalis.barcode4j.impl.code39.Code39;
import org.krysalis.barcode4j.impl.int2of5.Interleaved2Of5;
import org.krysalis.barcode4j.impl.postnet.POSTNET;
import org.krysalis.barcode4j.impl.upcean.EAN13;
import org.krysalis.barcode4j.impl.upcean.EAN8;
import org.krysalis.barcode4j.impl.upcean.UPCA;
import org.krysalis.barcode4j.impl.upcean.UPCE;

/**
 * This is a simple implementation of a BarcodeClassResolver.
 * 
 * @author <NAME>
 * @version $Id$
 */
public class DefaultBarcodeClassResolver implements BarcodeClassResolver {

    private Map classes;

    /**
     * Main constructor.
     * <br>
     * Already registers a default set of implementations.
     */
    public DefaultBarcodeClassResolver() {
        registerBarcodeClass("codabar", Codabar.class.getName());
        registerBarcodeClass("code39", Code39.class.getName());
        registerBarcodeClass("code128", Code128.class.getName());
        registerBarcodeClass("2of5", Interleaved2Of5.class.getName());
        registerBarcodeClass("intl2of5", Interleaved2Of5.class.getName());
        registerBarcodeClass("interleaved2of5", Interleaved2Of5.class.getName());
        registerBarcodeClass("ean-13", EAN13.class.getName());
        registerBarcodeClass("ean13", EAN13.class.getName());
        registerBarcodeClass("ean-8", EAN8.class.getName());
        registerBarcodeClass("ean8", EAN8.class.getName());
        registerBarcodeClass("upc-a", UPCA.class.getName());
        registerBarcodeClass("upca", UPCA.class.getName());
        registerBarcodeClass("upc-e", UPCE.class.getName());
        registerBarcodeClass("upce", UPCE.class.getName());
        registerBarcodeClass("postnet", POSTNET.class.getName());
    }

    /**
     * Registers a barcode implementation.
     * @param name short name to use as a key
     * @param classname fully qualified classname
     */
    public void registerBarcodeClass(String name, String classname) {
        if (this.classes == null) {
            this.classes = new java.util.HashMap();
        }
        this.classes.put(name.toLowerCase(), classname);
    }

    /**
     * @see org.krysalis.barcode4j.BarcodeClassResolver#resolve(String)
     */
    public Class resolve(String name) throws ClassNotFoundException {
        String clazz = null;
        if (this.classes != null) {<commit_msg>Removed import dependencies to make this class usable in barcode4j-light.jar<commit_after>/*
 * Copyright 2002-2004 <NAME>.
 * 
 * Licensed 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.krysalis.barcode4j;

import java.util.Map;

/**
 * This is a simple implementation of a BarcodeClassResolver.
 * 
 * @author <NAME>
 * @version $Id$
 */
public class DefaultBarcodeClassResolver implements BarcodeClassResolver {

    private Map classes;

    /**
     * Main constructor.
     * <br>
     * Already registers a default set of implementations.
     */
    public DefaultBarcodeClassResolver() {
        registerBarcodeClass("codabar", "org.krysalis.barcode4j.impl.codabar.Codabar");
        registerBarcodeClass("code39", "org.krysalis.barcode4j.impl.code39.Code39");
        registerBarcodeClass("code128", "org.krysalis.barcode4j.impl.code128.Code128");
        registerBarcodeClass("2of5", "org.krysalis.barcode4j.impl.int2of5.Interleaved2Of5");
        registerBarcodeClass("intl2of5", "org.krysalis.barcode4j.impl.int2of5.Interleaved2Of5");
        registerBarcodeClass("interleaved2of5", "org.krysalis.barcode4j.impl.int2of5.Interleaved2Of5");
        registerBarcodeClass("ean-13", "org.krysalis.barcode4j.impl.upcean.EAN13");
        registerBarcodeClass("ean13", "org.krysalis.barcode4j.impl.upcean.EAN13");
        registerBarcodeClass("ean-8", "org.krysalis.barcode4j.impl.upcean.EAN8");
        registerBarcodeClass("ean8", "org.krysalis.barcode4j.impl.upcean.EAN8");
        registerBarcodeClass("upc-a", "org.krysalis.barcode4j.impl.upcean.UPCA");
        registerBarcodeClass("upca", "org.krysalis.barcode4j.impl.upcean.UPCA");
        registerBarcodeClass("upc-e", "org.krysalis.barcode4j.impl.upcean.UPCE");
        registerBarcodeClass("upce", "org.krysalis.barcode4j.impl.upcean.UPCE");
        registerBarcodeClass("postnet", "org.krysalis.barcode4j.impl.postnet.POSTNET");
    }

    /**
     * Registers a barcode implementation.
     * @param name short name to use as a key
     * @param classname fully qualified classname
     */
    public void registerBarcodeClass(String name, String classname) {
        if (this.classes == null) {
            this.classes = new java.util.HashMap();
        }
        this.classes.put(name.toLowerCase(), classname);
    }

    /**
     * @see org.krysalis.barcode4j.BarcodeClassResolver#resolve(String)
     */
    public Class resolve(String name) throws ClassNotFoundException {
        String clazz = null;
        if (this.classes != null) {
{'fraction_non_alphanumeric': 0.11598694942903752, 'fraction_numerical': 0.02430668841761827, 'mean_word_length': 3.585639491398654, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2894879', 'n_tokens_mistral': 1947, 'n_tokens_neox': 1908, 'n_words': 415}