<commit_before>package org.codehaus.xfire.aegis.type.basic;

import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.xml.namespace.QName;

import org.codehaus.xfire.XFireRuntimeException;
import org.codehaus.xfire.aegis.type.Type;
import org.codehaus.xfire.aegis.type.TypeMapping;

public class TypeInfo
{
    private Map qname2name = new HashMap();
    private Class typeClass;
    private List attributes = new ArrayList();
    private List elements = new ArrayList();
    private String defaultNamespace;
    private QName schemaType;
    private PropertyDescriptor[] descriptors;
    private TypeMapping typeMapping;
    
    public TypeInfo(Class typeClass, QName complexType)
    {
        this.typeClass = typeClass;
        this.defaultNamespace = complexType.getNamespaceURI();
        
        initializeProperties();
    }

    protected TypeInfo(Class typeClass)
    {
        this.typeClass = typeClass;

        initializeProperties();
    }
    
    public void initialize()
    {
        try
        {
            for (int i = 0; i < descriptors.length; i++)
            {
                String name = descriptors[i].getName();

                if (isAttribute(descriptors[i]))
                {
                    mapAttribute(name, createQName(descriptors[i]));
                }
                else if (isElement(descriptors[i]))
                {
                    mapElement(name, createQName(descriptors[i]));
                }
            }
        }
        catch (Exception e)
        {
            throw new XFireRuntimeException("Couldn't create TypeInfo.", e);
        }
    }
    protected PropertyDescriptor[] getPropertyDescriptors()
    {
        return descriptors;
    }

    protected PropertyDescriptor getPropertyDescriptor(String name)
    {
        for (int i = 0; i < descriptors.length; i++)
        {
            if (descriptors[i].getName().equals(name));
                return descriptors[i];
        }
        
        return null;
    }

    /**
     * Get the type class for the field with the specified QName.
     * @param object
     * @param name
     * @param namespace
     * @return
     * @throws XFireFault
     */
    protected Type getType(QName name) 
    {
        Type type = getTypeMapping().getType(name);
        
        if (type == null)<commit_msg>Several hours of frustration later, it turns out to be a misplaced ";"<commit_after>package org.codehaus.xfire.aegis.type.basic;

import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.xml.namespace.QName;

import org.codehaus.xfire.XFireRuntimeException;
import org.codehaus.xfire.aegis.type.Type;
import org.codehaus.xfire.aegis.type.TypeMapping;

public class TypeInfo
{
    private Map qname2name = new HashMap();
    private Class typeClass;
    private List attributes = new ArrayList();
    private List elements = new ArrayList();
    private String defaultNamespace;
    private QName schemaType;
    private PropertyDescriptor[] descriptors;
    private TypeMapping typeMapping;
    
    public TypeInfo(Class typeClass, QName complexType)
    {
        this.typeClass = typeClass;
        this.defaultNamespace = complexType.getNamespaceURI();
        
        initializeProperties();
    }

    protected TypeInfo(Class typeClass)
    {
        this.typeClass = typeClass;

        initializeProperties();
    }
    
    public void initialize()
    {
        try
        {
            for (int i = 0; i < descriptors.length; i++)
            {
                String name = descriptors[i].getName();

                if (isAttribute(descriptors[i]))
                {
                    mapAttribute(name, createQName(descriptors[i]));
                }
                else if (isElement(descriptors[i]))
                {
                    mapElement(name, createQName(descriptors[i]));
                }
            }
        }
        catch (Exception e)
        {
            throw new XFireRuntimeException("Couldn't create TypeInfo.", e);
        }
    }
    protected PropertyDescriptor[] getPropertyDescriptors()
    {
        return descriptors;
    }

    protected PropertyDescriptor getPropertyDescriptor(String name)
    {
        for (int i = 0; i < descriptors.length; i++)
        {
            if (descriptors[i].getName().equals(name))
                return descriptors[i];
        }
        
        return null;
    }

    /**
     * Get the type class for the field with the specified QName.
     * @param object
     * @param name
     * @param namespace
     * @return
     * @throws XFireFault
     */
    protected Type getType(QName name) 
    {
        Type type = getTypeMapping().getType(name);
        
        if (type == null)
{'fraction_non_alphanumeric': 0.09347065682083171, 'fraction_numerical': 0.001165954139137194, 'mean_word_length': 2.1288753799392097, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '6036850', 'n_tokens_mistral': 1413, 'n_tokens_neox': 1371, 'n_words': 333}