手牌 (MahjongHands)

手牌に関するクラスです

概要

public class MahjongHands
extends java.lang.Object

手牌に関する操作全般を扱います
このクラスのインスタンスをMahjongクラスに投げることで役判定を行ないます

このクラス内では
和了の型になっているか
なっているならどの型なのか(国士無双or七対子or通常型)

コンストラクタ

public MahjongHands(

int[] otherTiles,
MahjongTile last,
java.util.List<MahjongMentsu> mentsuList)
throws MahjongTileOverFlowException,
IllegalMentsuSizeException

パラメータ:

TypeNameDescription
int[]otherTiles牌の数の配列
これを面子に変換します
MahjongTilelast和了牌
平和の判定に利用します
java.util.List<MahjongMentsu>mentsuList面子が一部でも決まっている場合はここに入力しても構いません

例外:

public MahjongHands(

int[] otherTiles,
MahjongTile last,
MahjongMentsu... mentsu)
throws MahjongTileOverFlowException,
IllegalMentsuSizeException

パラメータ:

TypeNameDescription
int[]otherTiles牌の数の配列
これを面子に変換します
MahjongTilelast和了牌
平和の判定に利用します
MahjongMentsumentsu面子が一部でも決まっている場合はここに入力して下さい

例外:

public MahjongHands(

int[] allTiles,
MahjongTile last)
throws HandsOverFlowException,
MahjongTileOverFlowException,
IllegalMentsuSizeException

パラメータ:

TypeNameDescription
int[]allTileslastの牌も含めて下さい合計14になるはずです
MahjongTilelastこの牌もotherTilesに含めてください

例外:

メソッド

public java.util.List<MentsuComp> getMentsuCompList()

戻り値:

このインスタンスでありえる全ての手牌を面子に整理したクラスMentsuCompのリストを返します
この考え方はこちらを参考にしました

public boolean getCanWin()

手牌が和了の形になっているかを判定します

戻り値:

和了の形ならtrue 和了の形でなければfalse

public MahjongTile getLast()

戻り値:

最後に引いた牌、すなわち和了牌を返します

public int[] getHandsComp()

各牌の数の配列を返す

戻り値:

各牌の数の配列

public boolean getIsKokushimuso()

国士無双の形か否か

戻り値:

国士無双ならばtrue

public boolean getIsKuisagari()

食い下がりがあるかいなか

戻り値:

食い下がりがあればtrue