<commit_before>package com.appolica.sample.ui.editor.pager.settings;

import com.appolica.flubber.AnimationBody;
import com.appolica.sample.utils.StringUtils;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

public class AnimationBodyDataGenerator {

    private static final List<FieldConfiguration> fieldsConfig;

    static {
        fieldsConfig = new ArrayList<>();

        fieldsConfig.add(FieldConfiguration.create("duration", 100L, 5000L));
        fieldsConfig.add(FieldConfiguration.create("delay", 0L, 5000L));
        fieldsConfig.add(FieldConfiguration.create("force", 1f, 5f));
        fieldsConfig.add(FieldConfiguration.create("velocity", 0f, 1f));
        fieldsConfig.add(FieldConfiguration.create("damping", 0f, 1f));
        fieldsConfig.add(FieldConfiguration.create("scale", 0f, 1f));
    }

    private static class FieldConfiguration<ValueT extends Number> {
        private String name;
        private ValueT minValue;
        private ValueT maxValue;

        public static<ValueT extends Number> FieldConfiguration<ValueT> create(String name, ValueT minValue, ValueT maxValue) {
            return new FieldConfiguration<>(name, minValue, maxValue);
        }

        public FieldConfiguration(String name, ValueT minValue, ValueT maxValue) {
            this.name = name;
            this.minValue = minValue;
            this.maxValue = maxValue;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public ValueT getMinValue() {
            return minValue;
        }

        public void setMinValue(ValueT minValue) {
            this.minValue = minValue;
        }

        public ValueT getMaxValue() {
            return maxValue;
        }

        public void setMaxValue(ValueT maxValue) {
            this.maxValue = maxValue;
        }
    }

    public static List<SeekBarModel> generateFor(AnimationBody body) {
        final List<SeekBarModel> data = new ArrayList<>();

        for (FieldConfiguration config : fieldsConfig) {

            try {
                String fieldName = config.getName();
                if (fieldName.equals("scale")) {
                    fieldName = fieldName.concat("X");
                }

                final Field field = AnimationBody.class.getDeclaredField(fieldName);
                final String getterName = "get" + StringUtils.getCapitalizedString(fieldName);

                final Method getter = AnimationBody.class.getDeclaredMethod(getterName);
                final String fieldType = field.getType().getName();

                Number value = null;
                if (fieldType.equals(long.class.getName())) {
                    value = (Long) getter.invoke(body);

                } else if (fieldType.equals(float.class.getName())) {
                    value = (Float) getter.invoke(body);
                }

                final SeekBarModel model =
                        SeekBarModel.create(config.getName(), value, config.minValue, config.maxValue);

                data.add(model);

            } catch (NoSuchFieldException e) {
                e.printStackTrace();
            } catch (NoSuchMethodException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                e.printStackTrace();
            }

        }

        return data;
    }
}<commit_msg>Edit: Changed AnimationBodyDataGenerator.java to use an enum for fields configuration.<commit_after>package com.appolica.sample.ui.editor.pager.settings;

import com.appolica.flubber.AnimationBody;
import com.appolica.sample.utils.StringUtils;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

public class AnimationBodyDataGenerator {

    public enum FieldConfiguration {
        DURATION("duration", 100L, 5000L),
        DELAY("delay", 0L, 5000L),
        FORCE("force", 1f, 5f),
        VELOCITY("velocity", 0f, 1f),
        DAMPING("damping", 0f, 1f),
        SCALE("scaleX", 0f, 1f);

        private final String name;
        private Number min;
        private Number max;

        FieldConfiguration(String name, Number min, Number max) {
            this.name = name;
            this.min = min;
            this.max = max;
        }
    }

    public static List<SeekBarModel> generateFor(AnimationBody body) {
        final List<SeekBarModel> data = new ArrayList<>();

        try {

            final FieldConfiguration[] fieldConfigurations = FieldConfiguration.values();
            for (int i = 0; i < fieldConfigurations.length; i++) {
                FieldConfiguration config = fieldConfigurations[i];

                final Field field = AnimationBody.class.getDeclaredField(config.name);
                final String getterName = "get" + StringUtils.getCapitalizedString(config.name);

                final Method getter = AnimationBody.class.getDeclaredMethod(getterName);
                final String fieldType = field.getType().getName();

                Number value = null;
                if (fieldType.equals(long.class.getName())) {
                    value = (Long) getter.invoke(body);

                } else if (fieldType.equals(float.class.getName())) {
                    value = (Float) getter.invoke(body);
                }

                final SeekBarModel model =
                        SeekBarModel.create(config.name, value, config.min, config.max);

                data.add(model);
            }


        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }

        return data;
    }
}
{'fraction_non_alphanumeric': 0.09844307492701913, 'fraction_numerical': 0.006649367499189101, 'mean_word_length': 2.1209514170040484, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 15, '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': '4235994', 'n_tokens_mistral': 1680, 'n_tokens_neox': 1554, 'n_words': 355}