<commit_before>package org.mahjong4j.yaku.normals;


import org.mahjong4j.hands.*;
import org.mahjong4j.tile.MahjongTileType;

import java.util.List;

import static org.mahjong4j.yaku.normals.MahjongYakuEnum.HONITSU;

/**
 * 混一色判定クラス
 * 萬子、索子、筒子のどれか一種と、字牌のみで構成される場合成立
 *
 * @author yu1ro
 */
public class HonitsuResolver implements NormalYakuResolver {
    final int HAN = HONITSU.getHan();

    private List<Toitsu> toitsuList;
    private List<Shuntsu> shuntsuList;
    private List<Kotsu> kotsuList;
    private List<Kantsu> kantsuList;

    private boolean hasJihai = false;
    private MahjongTileType type = null;

    public HonitsuResolver(MentsuComp comp) {
        toitsuList = comp.getToitsuList();
        shuntsuList = comp.getShuntsuList();
        kotsuList = comp.getKotsuList();
        kantsuList = comp.getKantsuList();
    }

    public int getHan() {
        return HAN;
    }

    public MahjongYakuEnum getNormalYaku() {
        return HONITSU;
    }

    public boolean isMatch() {

        for (Toitsu toitsu : toitsuList) {
            if (!hasOnlyOneType(toitsu)) {
                return false;
            }
        }

        for (Shuntsu shuntsu : shuntsuList) {
            if (!hasOnlyOneType(shuntsu)) {
                return false;
            }
        }

        for (Kotsu kotsu : kotsuList) {
            if (!hasOnlyOneType(kotsu)) {
                return false;
            }
        }

        for (Kantsu kantsu : kantsuList) {
            if (!hasOnlyOneType(kantsu)) {
                return false;
            }
        }

        return hasJihai;
    }

    private boolean hasOnlyOneType(MahjongMentsu mentsu) {
        if (mentsu.getTile().getNumber() == 0) {
            hasJihai = true;
        } else if (type == null) {
            type = mentsu.getTile().getType();
        } else if (type != mentsu.getTile().getType()) {
            return false;
        }
        return true;
    }
}<commit_msg>refactor HonitsuResolver<commit_after>package org.mahjong4j.yaku.normals;


import org.mahjong4j.hands.MahjongMentsu;
import org.mahjong4j.hands.MentsuComp;
import org.mahjong4j.tile.MahjongTileType;

import java.util.List;

import static org.mahjong4j.yaku.normals.MahjongYakuEnum.HONITSU;

/**
 * 混一色判定クラス
 * 萬子、索子、筒子のどれか一種と、字牌のみで構成される場合成立
 *
 * @author yu1ro
 */
public class HonitsuResolver implements NormalYakuResolver {
    final int HAN = HONITSU.getHan();

    private List<MahjongMentsu> allMentsu;

    private boolean hasJihai = false;
    private MahjongTileType type = null;

    public HonitsuResolver(MentsuComp comp) {
        allMentsu = comp.getAllMentsu();
    }

    public int getHan() {
        return HAN;
    }

    public MahjongYakuEnum getNormalYaku() {
        return HONITSU;
    }

    public boolean isMatch() {

        for (MahjongMentsu mentsu : allMentsu) {
            if (!hasOnlyOneType(mentsu)) {
                return false;
            }
        }

        return hasJihai;
    }

    private boolean hasOnlyOneType(MahjongMentsu mentsu) {
        if (mentsu.getTile().getNumber() == 0) {
            hasJihai = true;
        } else if (type == null) {
            type = mentsu.getTile().getType();
        } else if (type != mentsu.getTile().getType()) {
            return false;
        }
        return true;
    }
}
{'fraction_non_alphanumeric': 0.10123531184091594, 'fraction_numerical': 0.00391684242241639, 'mean_word_length': 2.1619047619047618, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '5661918', 'n_tokens_mistral': 1231, 'n_tokens_neox': 1182, 'n_words': 214}