package org.mahjong4j.yaku.normals;


import org.mahjong4j.hands.Kantsu;
import org.mahjong4j.hands.Kotsu;
import org.mahjong4j.hands.MentsuComp;
import org.mahjong4j.tile.MahjongTile;

import java.util.List;

/**
 * 發判定クラス
 * 發の刻子もしくは槓子が含まれる場合成立
 *
 * @author yu1ro
 */
public class HatsuResolver implements NormalYakuResolver {
    private final int HAN = MahjongYakuEnum.HATSU.getHan();
    List<Kotsu> kotsuList;
    List<Kantsu> kantsuList;

    public HatsuResolver(MentsuComp comp) {
        kotsuList = comp.getKotsuList();
        kantsuList = comp.getKantsuList();
    }

    public int getHan() {
        return HAN;
    }

    public MahjongYakuEnum getNormalYaku() {
        return MahjongYakuEnum.HATSU;
    }

    public boolean isMatch() {
        for (Kotsu kotsu : kotsuList) {
            if (kotsu.getTile() == MahjongTile.HAT){
                return true;
            }
        }

        for (Kantsu kantsu : kantsuList) {
            if(kantsu.getTile() == MahjongTile.HAT) {
                return true;
            }
        }

        return false;
    }
}

@@ -35,43 +35,8 @@
 ;%0A%0A%0A
-import org.mahjong4j.hands.Kantsu;%0A
 impo
@@ -65,16 +65,16 @@
 .Kotsu;%0A
+
 import o
@@ -378,37 +378,8 @@
 ist;
-%0A    List%3CKantsu%3E kantsuList;
 %0A%0A  
@@ -457,55 +457,14 @@
 otsu
-List();%0A        kantsuList = comp.get
 Kantsu
-List
 ();%0A
@@ -676,32 +676,32 @@
  : kotsuList) %7B%0A
+
             if (
@@ -795,159 +795,8 @@
  %7D%0A%0A
-        for (Kantsu kantsu : kantsuList) %7B%0A            if(kantsu.getTile() == MahjongTile.HAT) %7B%0A                return true;%0A            %7D%0A        %7D%0A%0A
     

refactor hatsu resolver