package org.mahjong4j.yaku.yakuman;

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

import java.util.List;

import static org.mahjong4j.yaku.yakuman.MahjongYakumanEnum.DAISANGEN;

/**
 * 大三元判定クラス
 * 白・發・中の3種類をすべて刻子または槓子にして和了した場合に成立
 *
 * @author yu1ro
 */
public class DaisangenResolver implements YakumanResolver {
    List<Kotsu> kotsuList;
    List<Kantsu> kantsuList;

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

    public MahjongYakumanEnum getYakuman() {
        return DAISANGEN;
    }

    public boolean isMatch() {
        int sangenCount = 0;
        for (Kotsu kotsu : kotsuList) {
            if (kotsu.getTile().getType() == MahjongTileType.SANGEN) {
                sangenCount++;
            }
        }

        for (Kantsu kantsu : kantsuList) {
            if (kantsu.getTile().getType() == MahjongTileType.SANGEN) {
                sangenCount++;
            }
        }
        return sangenCount == 3;
    }
}

@@ -34,43 +34,8 @@
 n;%0A%0A
-import org.mahjong4j.hands.Kantsu;%0A
 impo
@@ -64,16 +64,16 @@
 .Kotsu;%0A
+
 import o
@@ -409,37 +409,8 @@
 ist;
-%0A    List%3CKantsu%3E kantsuList;
 %0A%0A  
@@ -464,18 +464,17 @@
        k
-an
+o
 tsuList 
@@ -488,58 +488,18 @@
 getK
+otsuK
 antsu
-List();%0A        kotsuList = comp.getKotsuList
 ();%0A
@@ -814,178 +814,8 @@
  %7D%0A%0A
-        for (Kantsu kantsu : kantsuList) %7B%0A            if (kantsu.getTile().getType() == MahjongTileType.SANGEN) %7B%0A                sangenCount++;%0A            %7D%0A        %7D%0A
     

refactor DaisangenResolver