<commit_before>package com.bloatit.data;

import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;

import com.bloatit.data.DaoKudosable.PopularityState;

class DaoKudosableListFactory<T extends DaoKudosable> extends DaoUserContentListFactory<T> {

    protected DaoKudosableListFactory(Criteria criteria) {
        super(criteria);
    }

    public DaoKudosableListFactory() {
        super(SessionManager.getSessionFactory().getCurrentSession().createCriteria(DaoKudosable.class));
    }

    public void orderByPopularity(DaoAbstractListFactory.OrderType order) {
        if (order == OrderType.ASC) {
            addOrder(Order.asc("popularity"));
        } else {
            addOrder(Order.desc("popularity"));
        }
    }

    public void popularity(Comparator cmp, int value) {
        add(createNbCriterion(cmp, "popularity", value));
    }

    public void stateEquals(PopularityState state) {
        add(Restrictions.eq("state", state));
    }
    
    public void kudosSize(Comparator cmp, int number){
        add(createNbCriterion(cmp, "kudos", number));
    }

}<commit_msg>introduce constants<commit_after>package com.bloatit.data;

import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;

import com.bloatit.data.DaoKudosable.PopularityState;

class DaoKudosableListFactory<T extends DaoKudosable> extends DaoUserContentListFactory<T> {

    private static final String KUDOS = "kudos";
    private static final String STATE = "state";
    private static final String POPULARITY = "popularity";

    protected DaoKudosableListFactory(Criteria criteria) {
        super(criteria);
    }

    public DaoKudosableListFactory() {
        super(SessionManager.getSessionFactory().getCurrentSession().createCriteria(DaoKudosable.class));
    }

    public void orderByPopularity(DaoAbstractListFactory.OrderType order) {
        if (order == OrderType.ASC) {
            addOrder(Order.asc(POPULARITY));
        } else {
            addOrder(Order.desc(POPULARITY));
        }
    }

    public void popularity(Comparator cmp, int value) {
        add(createNbCriterion(cmp, POPULARITY, value));
    }

    public void stateEquals(PopularityState state) {
        add(Restrictions.eq(STATE, state));
    }

    public void kudosSize(Comparator cmp, int number) {
        add(createNbCriterion(cmp, KUDOS, number));
    }

}
{'fraction_non_alphanumeric': 0.1010183299389002, 'fraction_numerical': 0.0, 'mean_word_length': 3.6603415559772294, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3019449', 'n_tokens_mistral': 767, 'n_tokens_neox': 749, 'n_words': 133}