<commit_before>package wint.mvc.module;

import wint.lang.magic.MagicClass;
import wint.lang.magic.MagicMethod;
import wint.lang.utils.StringUtil;
import wint.mvc.module.annotations.Action;
import wint.mvc.module.annotations.LimitAction;

public class ModuleInfo {

    private MagicClass targetClass;

    private MagicMethod targetMethod;

    private String defaultTarget;

    private boolean useDefaultMethod;

    // 这里没有用Set集合的原因是一般suffix只有1~2个，数组查询起来比较快。用Set内存开销大
    private String[] allowSuffix;

    public ModuleInfo(MagicClass targetClass, MagicMethod targetMethod, boolean useDefaultMethod) {
        super();
        this.targetClass = targetClass;
        this.targetMethod = targetMethod;
        this.useDefaultMethod = useDefaultMethod;

        initLimit();
        initDefaultTarget();
    }

    private void initLimit() {
        LimitAction limitAction = targetMethod.getTargetMethod().getAnnotation(LimitAction.class);
        if (limitAction == null) {

        }
        String[] allowSuffix = limitAction.allowSuffix();
        if (allowSuffix == null || allowSuffix.length == 0) {
            this.allowSuffix = allowSuffix;
            return;
        }
        String[] targetAllowSuffix = new String[allowSuffix.length];
        int i = 0;
        for (String as : allowSuffix) {
            targetAllowSuffix[i] = normalizeSuffix(as);
            i++;
        }
        this.allowSuffix = targetAllowSuffix;
    }
<commit_msg>fixed limit action<commit_after>package wint.mvc.module;

import wint.lang.magic.MagicClass;
import wint.lang.magic.MagicMethod;
import wint.lang.utils.StringUtil;
import wint.mvc.module.annotations.Action;
import wint.mvc.module.annotations.LimitAction;

public class ModuleInfo {

    private MagicClass targetClass;

    private MagicMethod targetMethod;

    private String defaultTarget;

    private boolean useDefaultMethod;

    // 这里没有用Set集合的原因是一般suffix只有1~2个，数组查询起来比较快。用Set内存开销大
    private String[] allowSuffix;

    public ModuleInfo(MagicClass targetClass, MagicMethod targetMethod, boolean useDefaultMethod) {
        super();
        this.targetClass = targetClass;
        this.targetMethod = targetMethod;
        this.useDefaultMethod = useDefaultMethod;

        initLimit();
        initDefaultTarget();
    }

    private void initLimit() {
        LimitAction limitAction = targetMethod.getTargetMethod().getAnnotation(LimitAction.class);
        if (limitAction == null) {
            return;
        }
        String[] allowSuffix = limitAction.allowSuffix();
        if (allowSuffix == null || allowSuffix.length == 0) {
            this.allowSuffix = allowSuffix;
            return;
        }
        String[] targetAllowSuffix = new String[allowSuffix.length];
        int i = 0;
        for (String as : allowSuffix) {
            targetAllowSuffix[i] = normalizeSuffix(as);
            i++;
        }
        this.allowSuffix = targetAllowSuffix;
    }

{'fraction_non_alphanumeric': 0.09007477906186268, 'fraction_numerical': 0.002719238613188307, 'mean_word_length': 2.8270481144343305, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '255660', 'n_tokens_mistral': 880, 'n_tokens_neox': 852, 'n_words': 169}