<commit_before>package org.drools.lang.api;

import org.drools.compiler.TypeDeclarationError;
import org.drools.lang.descr.PatternDescr;
import org.drools.lang.descr.TypeDeclarationDescr;
import org.drools.lang.descr.TypeFieldDescr;
import org.drools.rule.TypeDeclaration;

public class FieldDescrBuilderImpl extends BaseDescrBuilderImpl<TypeFieldDescr>
    implements
    FieldDescrBuilder {

    protected FieldDescrBuilderImpl( String name ) {
        super( new TypeFieldDescr( name ) );
    }

    public AnnotationDescrBuilder newAnnotation( String name ) {
        AnnotationDescrBuilder annotation = new AnnotationDescrBuilderImpl( name );
        descr.addAnnotation( annotation.getDescr() );
        return annotation;
    }

    public FieldDescrBuilder index( int index ) {
        descr.setIndex( index );
        return this;
    }

    public FieldDescrBuilder name( String name ) {
        descr.setFieldName( name );
        return this;
    }

    public FieldDescrBuilder type( String type ) {
        descr.setPattern( new PatternDescr( type ) );
        return this;
    }

    public FieldDescrBuilder initialValue( String value ) {
        descr.setInitExpr( value );
        return this;
    }


    public FieldDescrBuilder processAnnotations() {
        if ( descr.getAnnotations().containsKey( TypeDeclaration.ATTR_FIELD_POSITION ) ) {
             int pos = Integer.valueOf(descr.getAnnotation( TypeDeclaration.ATTR_FIELD_POSITION ).getValue());
             descr.setIndex(pos);
        }
        return this;
    }


}
<commit_msg>JBRULES 2948 - Import PMML files as resources<commit_after>package org.drools.lang.api;

import org.drools.compiler.TypeDeclarationError;
import org.drools.lang.descr.PatternDescr;
import org.drools.lang.descr.TypeDeclarationDescr;
import org.drools.lang.descr.TypeFieldDescr;
import org.drools.rule.TypeDeclaration;

public class FieldDescrBuilderImpl extends BaseDescrBuilderImpl<TypeFieldDescr>
    implements
    FieldDescrBuilder {

    protected FieldDescrBuilderImpl( String name ) {
        super( new TypeFieldDescr( name ) );
    }

    public AnnotationDescrBuilder newAnnotation( String name ) {
        AnnotationDescrBuilder annotation = new AnnotationDescrBuilderImpl( name );
        descr.addAnnotation( annotation.getDescr() );
        return annotation;
    }

    public FieldDescrBuilder index( int index ) {
        descr.setIndex( index );
        return this;
    }

    public FieldDescrBuilder name( String name ) {
        descr.setFieldName( name );
        return this;
    }

    public FieldDescrBuilder type( String type ) {
        descr.setPattern( new PatternDescr( type ) );
        return this;
    }

    public FieldDescrBuilder initialValue( String value ) {
        descr.setInitExpr( value );
        return this;
    }


    public FieldDescrBuilder processAnnotations() {
        if ( descr.getAnnotations().containsKey( TypeDeclaration.ATTR_FIELD_POSITION ) ) {
             int pos = Integer.valueOf(descr.getAnnotation( TypeDeclaration.ATTR_FIELD_POSITION ).getSingleValue());
             descr.setIndex(pos);
        }
        return this;
    }


}

{'fraction_non_alphanumeric': 0.0819620253164557, 'fraction_numerical': 0.0012658227848101266, 'mean_word_length': 3.026751592356688, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1118645', 'n_tokens_mistral': 910, 'n_tokens_neox': 882, 'n_words': 192}