package extend.mj.uitl;

import com.game.Global;
import com.game.Util;
import com.game.data.Player;
import com.taurus.core.entity.ITObject;
import extend.mj.*;

import java.util.*;

public class WinCard {
	
	public List<Integer>		cardList;
	public int 					laizi_count;
	public int 					laizi1_count;
	public int 					laizi2_count;
	public int 					laizi1 = 0;
	public int 					laizi2 = 0;
	public Map<Integer, Integer> cbCardMap;

	public WinCard(List<Integer> cardInhand, int addCard, int laizi1, int laizi2, boolean islaizi, boolean selfCard) {
		this.cardList = new ArrayList<Integer>();
		this.cardList.addAll(cardInhand);
		this.cbCardMap = new HashMap<Integer, Integer>();
		if (selfCard)
		{
			this.cardList.add(addCard);
			if (islaizi) {
				this.laizi1 = laizi1;
				this.laizi2 = laizi2;
				this.laizi1_count = Util.cardNum(laizi1, this.cardList);
				this.laizi2_count = Util.cardNum(laizi2, this.cardList);
				this.laizi_count = this.laizi1_count + this.laizi2_count;
				Util.removeCard(this.cardList, laizi1, this.laizi1_count);
				Util.removeCard(this.cardList, laizi2, this.laizi2_count);
			}
		}
		else {
			if (islaizi) {
				this.laizi1 = laizi1;
				this.laizi2 = laizi2;
				this.laizi1_count = Util.cardNum(laizi1, this.cardList);
				this.laizi2_count = Util.cardNum(laizi2, this.cardList);
				this.laizi_count = this.laizi1_count + this.laizi2_count;
				Util.removeCard(this.cardList, laizi1, this.laizi1_count);
				Util.removeCard(this.cardList, laizi2, this.laizi2_count);
			}
			this.cardList.add(addCard);
		}

		Collections.sort(this.cardList);
		for(int i = 0; i < this.cardList.size(); i++)
		{
			int card = this.cardList.get(i);
			if (this.cbCardMap.containsKey(card))
			{
				int num = this.cbCardMap.get(card);
				this.cbCardMap.put(card, num+1);
			}
			else
			{
				this.cbCardMap.put(card, 1);
			}
		}
	}

	//钓鱼
	static public boolean IsDiaoYu(EXPlayer player, List<Integer> cardInhand, int drawCard, int laizi1, int laizi2, boolean islaizi)
	{
		EXRoom room = player.getRoom();
		WinCard win = new WinCard(cardInhand, laizi1, laizi2, islaizi);
		if (drawCard > 0 && drawCard != laizi1 && drawCard != laizi2 && win.laizi_count == 1)
		{
			ArrayList<Integer> cardList = new ArrayList<Integer>();
			cardList.addAll(cardInhand);

			Util.removeCard(cardList, drawCard, 1);
			for (int index = 1; index <= 9; index++) {
			    for(int index2 = 1; index2 <= 3; index2++)
				{
				    int card = index2 * 100 + index;
				    if (card == laizi1 || card == laizi2)
				    	continue;
					ArrayList<Integer> tempCardList = new ArrayList<Integer>();
					tempCardList.addAll(cardList);
					tempCardList.add(card);
					WinCard temp = new WinCard(tempCardList, laizi1, laizi2, islaizi);
					HashMap<Integer, WinCardType> map = new HashMap<Integer, WinCardType>();
					if (!temp.checkWin(map, player, room, true)) {
					    return false;
					}
				}
			}

			return true;
		}
		return false;
	}

	public WinCard(List<Integer> cardInhand, int laizi1, int laizi2, boolean islaizi) {
		this.cardList = new ArrayList<Integer>();
		this.cardList.addAll(cardInhand);
		this.cbCardMap = new HashMap<Integer, Integer>();
		if (islaizi) {
			this.laizi1 = laizi1;
			this.laizi2 = laizi2;
			this.laizi1_count = Util.cardNum(laizi1, this.cardList);
			this.laizi2_count = Util.cardNum(laizi2, this.cardList);
			this.laizi_count = this.laizi1_count + this.laizi2_count;
			Util.removeCard(this.cardList, laizi1, this.laizi1_count);
			Util.removeCard(this.cardList, laizi2, this.laizi2_count);
		}
		Collections.sort(this.cardList);
		for(int i = 0; i < this.cardList.size(); i++)
		{
			int card = this.cardList.get(i);
			if (this.cbCardMap.containsKey(card))
			{
				int num = this.cbCardMap.get(card);
				this.cbCardMap.put(card, num+1);
			}
			else
			{
				this.cbCardMap.put(card, 1);
			}
		}
	}

	public boolean checkWin(Map<Integer, WinCardType> map, EXPlayer player, EXRoom room, boolean zimo) {
		if (this.cardList.size() == 0) {
			return false;
		}

		if (room.config.getInt(Config.YI_JIAO_LAI_YOU) != 0)
		{
			return false;
		}

		if (room.config.getBoolean(Config.LAIYOU_YILAIDAODI))
		{
			//两个癞子不能胡牌
			if (this.laizi_count >= 2)
			{
				return false;
			}
		}

		long startTime = System.currentTimeMillis();
		int[] intListCard = WinSplitCard.SwitchToCardData(this.cardList);
		List<TagAnalyseItem> tagAnalyseItemList = new ArrayList<TagAnalyseItem>();
		boolean hu = WinSplitCard.AnalyseChiHuCard(map, room.config, intListCard, this.laizi_count, player.opCardList, tagAnalyseItemList);

		if ((System.currentTimeMillis() - startTime) > 10)
			Global.logger.info("get_hu_info use time:" + (System.currentTimeMillis() - startTime));

		if (hu)
		{
			boolean laizi4_hu = room.config.getBoolean(Config.ROOM_CONFIG_LAIZI4_HU);
			if (laizi4_hu)
			{
				if (this.laizi_count >= 4) {
					if (room.config.getBoolean(Config.ROOM_CONFIG_LAIZI4_HU_2BEI))
					{
						putWinCardType(map, WinCardType.LAIZI4_HU, 1,WinCardType.LAIZI4_HU_SCORE * 2, false, "四鬼胡牌");
					}
					else
					{
						putWinCardType(map, WinCardType.LAIZI4_HU, 1,WinCardType.LAIZI4_HU_SCORE, false, "四鬼胡牌");
					}
					return true;
				}
			}

			boolean jiabei = true;
			boolean wuguijiabei = room.config.getBoolean(Config.ROOM_CONFIG_WUGUI_JIABEI);
			if (wuguijiabei && room.config.getInt(Config.ROOM_CONFIG_LAIZI) > 0)
			{
				if (this.laizi_count <= 0)
				{
					putWinCardType(map, WinCardType.WU_GUI_JIABEI, 1,WinCardType.WU_GUI_JIABEI_SCORE, false, "无鬼2倍");
				}
			}

			boolean liuju2bei = room.config.getBoolean(Config.ROOM_CONFIG_LIUJU_2BEI);
			if (liuju2bei)
			{
				if (room.last_liuju)
				{
					putWinCardType(map, WinCardType.LIU_JU_2BEI, 1,WinCardType.LIU_JU_2BEI_SCORE, false, "流局2倍");
				}
			}

			if (zimo)
			{
				boolean tianhu = room.config.getBoolean(Config.ROOM_CONFIG_TIANDIHU);
				if(tianhu) {
					if (room.bankerSeat == player.seat)
					{
						boolean flag = true;
						for (Map.Entry<Integer, Player> entry : room.playerMapById.entrySet()) {
							EXPlayer otherPlayer = (EXPlayer)entry.getValue();
							if(!otherPlayer.outcardList.isEmpty() || !otherPlayer.opCardList.isEmpty()) {
								flag = false;
							}
						}
						if (flag)
						{
							WinCard.putWinCardType(map, WinCardType.TIAN_HU, 1,WinCardType.TIAN_HU_SCORE, true, "天胡");
						}
					}
					else if (player.outcardList.isEmpty() && player.opCardList.isEmpty())
					{
						boolean flag = true;
						for (Map.Entry<Integer, Player> entry : room.playerMapById.entrySet()) {
							EXPlayer otherPlayer = (EXPlayer)entry.getValue();
							if (player.playerid != otherPlayer.playerid)
							{
								if(otherPlayer.outcardList.size() > 1 || !otherPlayer.opCardList.isEmpty()) {
									flag = false;
								}
							}
						}
						if (flag)
						{
							WinCard.putWinCardType(map, WinCardType.DI_HU, 1,WinCardType.DI_HU_SCORE, true, "地胡");
						}
					}
				}

				if (room.card.cardList.size() == 0 && room.config.getBoolean(Config.ROOM_CONFIG_HAI_DI_NAO_YUE))
				{
					WinCard.putWinCardType(map, WinCardType.HAI_DI_NAO_YUE, 1,WinCardType.HAI_DI_NAO_YUE_SCORE, false, "海底捞月");
				}
			}
			else {
			    /*
				boolean tiandihu = room.config.getBoolean(Config.ROOM_CONFIG_TIANDIHU);
				if(tiandihu && room.bankerSeat == room.activeSeat) {
					boolean flag = true;
					for (Map.Entry<Integer, Player> entry : room.playerMapById.entrySet()) {
						EXPlayer otherPlayer = (EXPlayer)entry.getValue();
						if (otherPlayer.seat == room.bankerSeat)
						{
							if(otherPlayer.outcardList.size() != 1 || otherPlayer.outcardList.get(0) != room.activeCard || !otherPlayer.opCardList.isEmpty()) {
								flag = false;
							}
						}
						else
						{
							if(!otherPlayer.outcardList.isEmpty() || !otherPlayer.opCardList.isEmpty()) {
								flag = false;
							}
						}
					}
					if (flag)
					{
						WinCard.putWinCardType(map, WinCardType.REN_HU, 1,WinCardType.TIAN_DI_HU_SCORE);
					}
				}
				*/
			}

			int maxType = 0;
			int maxScore = 0;
			List<Integer> typeList = new ArrayList<Integer>();
			for (Map.Entry<Integer, WinCardType> entry : map.entrySet()) {
				WinCardType cardType = entry.getValue();
				int type = cardType.type;
				if (cardType.IsDaHu())
				{
					if (type == WinCardType.TIAN_HU || type == WinCardType.DI_HU || type == WinCardType.QUAN_FENG || type == WinCardType.YAO_JIU
							|| type == WinCardType.SHI_BA_LUO_HAN || type ==  WinCardType.XIAO_SHAN_YUAN || type ==  WinCardType.DA_SHAN_YUAN
							|| type == WinCardType.XIAO_SI_XI || type == WinCardType.DA_SI_XI || type == WinCardType.ZI_YI_SE)
					{
						if (cardType.score > maxScore)
						{
							maxScore = cardType.score;
							maxType = type;
						}
					}
					typeList.add(type);
				}
			}

			if (maxType > 0)
			{
				for(int i = 0; i < typeList.size(); i++)
				{
					int type = typeList.get(i);
					if (type != maxType)
					{
						map.remove(type);
					}
				}
			}

			if (zimo)
			{

			}
			else {
				if (room.config.getBoolean(Config.ROOM_CONFIG_MENG_QING)) {
					for (Map.Entry<Integer, WinCardType> entry : map.entrySet()) {
						WinCardType cardType = entry.getValue();
						if (cardType.type == WinCardType.JIHU || cardType.type == WinCardType.PINGHU) {
							boolean flag = true;
							for (int i = 0; i < player.opCardList.size(); i++) {
								OpCard op_card = player.opCardList.get(i);
								if (op_card.type != RuleWeight.TYPE_SELF_KONG) {
									flag = false;
								}
							}
							if (flag) {
								WinCard.putWinCardType(map, WinCardType.MEN_QING, 1, WinCardType.MENGQING_SCORE, false, "门清");
							}
							break;
						}
					}
				}

				if (room.config.getBoolean(Config.ROOM_CONFIG_JIHU_NOTCHIHU))
				{
					WinCardType jihuType = map.get(WinCardType.JIHU);
					if (jihuType != null)
					{
						//鸡胡不能吃胡
						return false;
					}
				}

				if (room.config.getBoolean(Config.ROOM_CONFIG_SPECAIL_ZIMO))
				{
					int hu_score = 0;
					if (room.config.getBoolean(Config.ROOM_CONFIG_USE_BASE_HU_SCORE))
					{
						hu_score = WinCardType.BASE_HU_SCORE;
					}
					else
					{
						player.hu_score = room.maxPlayers - 1;
						player.di_score = room.maxPlayers - 1;
					}

					int dahu_score = 0;
					if (room.config.getBoolean(Config.ROOM_CONFIG_DAHU_CHENG))
					{
						dahu_score = 1;
					}
					int cheng_score = 1;
					for (Map.Entry<Integer, WinCardType> entry : map.entrySet()) {
						WinCardType cardType = entry.getValue();
						{
							if (room.config.getBoolean(Config.ROOM_CONFIG_DAHU_CHENG))
							{
								if (cardType.IsDaHu())
								{
									dahu_score *= cardType.score;
								}
								else
								{
									cheng_score *= cardType.score;
								}
							}
							else
							{
								if (cardType.IsDaHu())
								{
									dahu_score += cardType.score*WinCardType.DA_HU_BEI_SCORE;
								}
								else
								{
									cheng_score *=  cardType.score;
								}
							}
						}
					}

					if (dahu_score > 0)
					{
						hu_score *= dahu_score;
					}

					hu_score *= cheng_score;

					if (hu_score < 20)
					{
						return false;
					}
				}
			}

			for (Map.Entry<Integer, WinCardType> entry : map.entrySet()) {
				WinCardType cardType = entry.getValue();
				Global.logger.info("get_hu_info player:" + player.playerid + " hu:" + cardType.toString());
			}
		}

		return hu;
	}

	public boolean checkWin2(Map<Integer, WinCardType> map, EXPlayer player, EXRoom room, boolean zimo) {
		if (this.cardList.size() == 0) {
			return false;
		}

		long startTime = System.currentTimeMillis();
		int[] intListCard = WinSplitCard.SwitchToCardData(this.cardList);
		List<TagAnalyseItem> tagAnalyseItemList = new ArrayList<TagAnalyseItem>();
		HashMap<Integer, WinCardType> new_map = new HashMap<Integer, WinCardType>();
		new_map.putAll(map);
		boolean tempHu = WinSplitCard.TempAnalyseChiHuCard(new_map, room.config, intListCard, this.laizi_count, player.opCardList, tagAnalyseItemList);
		if (tempHu)
		{
			for(int i = 0; i < tagAnalyseItemList.size(); i++)
			{
				TagAnalyseItem item = tagAnalyseItemList.get(i);
				if (item.cbOpCard.size() != 4)
				{
					Global.logger.error("Exception cbOpCard.size() != 4");
				}

				Global.logger.info("-------ieye:" + item.cbCardEye);

				for(int j = 0; j < item.cbOpCard.size(); j++)
				{
					OpCard op_card = item.cbOpCard.get(j);
					if (op_card.type == RuleWeight.TYPE_CHOW)
					{
						Global.logger.info("----------chi:" + op_card.card3 + " " + op_card.card2 + " " + op_card.card);
					}
					else {
						Global.logger.info("----------pong:" + op_card.card3 + " " + op_card.card2 + " " + op_card.card);
					}
				}
			}

			for (Map.Entry<Integer, WinCardType> entry :new_map.entrySet()) {
				WinCardType cardType = entry.getValue();
				Global.logger.info("get_hu_info player:" + player.playerid + " hu:" + cardType.toString());
			}
		}
		Global.logger.info("get_hu_info use time:" + (System.currentTimeMillis() - startTime));

		startTime = System.currentTimeMillis();
		boolean hu = AnalyseChiHuCard(map, player.opCardList, room.config);
		Global.logger.info("AnalyseChiHuCard use time:" + (System.currentTimeMillis() - startTime));
		if (tempHu == hu)
		{
			Global.logger.info("AnalyseChiHuCard == get_hu_info");
			if (hu)
			{
				for (Map.Entry<Integer, WinCardType> entry : new_map.entrySet()) {
					if (!map.containsKey(entry.getKey()))
					{
						Global.logger.error("get_hu_info has hu " + entry.getKey() + " AnalyseChiHuCard not has");
					}
				}

				for (Map.Entry<Integer, WinCardType> entry : map.entrySet()) {
					if (!new_map.containsKey(entry.getKey()))
					{
						Global.logger.error("AnalyseChiHuCard has hu " + entry.getKey() + "  get_hu_info not has");
					}
				}
			}
		}
		else {
			Global.logger.error("Exception AnalyseChiHuCard != get_hu_info");
		}

		if (hu)
		{
			boolean laizi4_hu = room.config.getBoolean(Config.ROOM_CONFIG_LAIZI4_HU);
			if (laizi4_hu)
			{
				if (this.laizi_count >= 4) {
					if (room.config.getBoolean(Config.ROOM_CONFIG_LAIZI4_HU_2BEI))
					{
						putWinCardType(map, WinCardType.LAIZI4_HU, 1,WinCardType.LAIZI4_HU_SCORE * 2, false, "四鬼胡牌");
					}
					else
					{
						putWinCardType(map, WinCardType.LAIZI4_HU, 1,WinCardType.LAIZI4_HU_SCORE, false, "四鬼胡牌");
					}
					return true;
				}
			}

			boolean jiabei = true;
			boolean wuguijiabei = room.config.getBoolean(Config.ROOM_CONFIG_WUGUI_JIABEI);
			if (wuguijiabei && room.config.getInt(Config.ROOM_CONFIG_LAIZI) > 0)
			{
				if (this.laizi_count <= 0)
				{
					putWinCardType(map, WinCardType.WU_GUI_JIABEI, 1,WinCardType.WU_GUI_JIABEI_SCORE, false, "无鬼2倍");
				}
			}

			boolean liuju2bei = room.config.getBoolean(Config.ROOM_CONFIG_LIUJU_2BEI);
			if (liuju2bei)
			{
				if (room.last_liuju)
				{
					putWinCardType(map, WinCardType.LIU_JU_2BEI, 1,WinCardType.LIU_JU_2BEI_SCORE, false, "流局2倍");
				}
			}

			if (zimo)
			{
				boolean tianhu = room.config.getBoolean(Config.ROOM_CONFIG_TIANDIHU);
				if(tianhu) {
					if (room.bankerSeat == player.seat)
					{
						boolean flag = true;
						for (Map.Entry<Integer, Player> entry : room.playerMapById.entrySet()) {
							EXPlayer otherPlayer = (EXPlayer)entry.getValue();
							if(!otherPlayer.outcardList.isEmpty() || !otherPlayer.opCardList.isEmpty()) {
								flag = false;
							}
						}
						if (flag)
						{
							WinCard.putWinCardType(map, WinCardType.TIAN_HU, 1,WinCardType.TIAN_HU_SCORE, true, "天胡");
						}
					}
					else if (player.outcardList.isEmpty() && player.opCardList.isEmpty())
					{
						boolean flag = true;
						for (Map.Entry<Integer, Player> entry : room.playerMapById.entrySet()) {
							EXPlayer otherPlayer = (EXPlayer)entry.getValue();
							if (player.playerid != otherPlayer.playerid)
							{
								if(otherPlayer.outcardList.size() > 1 || !otherPlayer.opCardList.isEmpty()) {
									flag = false;
								}
							}
						}
						if (flag)
						{
							WinCard.putWinCardType(map, WinCardType.DI_HU, 1,WinCardType.DI_HU_SCORE, true, "地胡");
						}
					}
				}

				if (room.card.cardList.size() == 0 && room.config.getBoolean(Config.ROOM_CONFIG_HAI_DI_NAO_YUE))
				{
					WinCard.putWinCardType(map, WinCardType.HAI_DI_NAO_YUE, 1,WinCardType.HAI_DI_NAO_YUE_SCORE, false, "海底捞月");
				}
			}
			else {
			    /*
				boolean tiandihu = room.config.getBoolean(Config.ROOM_CONFIG_TIANDIHU);
				if(tiandihu && room.bankerSeat == room.activeSeat) {
					boolean flag = true;
					for (Map.Entry<Integer, Player> entry : room.playerMapById.entrySet()) {
						EXPlayer otherPlayer = (EXPlayer)entry.getValue();
						if (otherPlayer.seat == room.bankerSeat)
						{
							if(otherPlayer.outcardList.size() != 1 || otherPlayer.outcardList.get(0) != room.activeCard || !otherPlayer.opCardList.isEmpty()) {
								flag = false;
							}
						}
						else
						{
							if(!otherPlayer.outcardList.isEmpty() || !otherPlayer.opCardList.isEmpty()) {
								flag = false;
							}
						}
					}
					if (flag)
					{
						WinCard.putWinCardType(map, WinCardType.REN_HU, 1,WinCardType.TIAN_DI_HU_SCORE);
					}
				}
				*/
			}
		}

		int maxType = 0;
		int maxScore = 0;
		List<Integer> typeList = new ArrayList<Integer>();
		for (Map.Entry<Integer, WinCardType> entry : map.entrySet()) {
			WinCardType cardType = entry.getValue();
			int type = cardType.type;
			if (cardType.IsDaHu())
			{
				if (type == WinCardType.TIAN_HU || type == WinCardType.DI_HU || type == WinCardType.QUAN_FENG || type == WinCardType.YAO_JIU
						|| type == WinCardType.SHI_BA_LUO_HAN || type ==  WinCardType.XIAO_SHAN_YUAN || type ==  WinCardType.DA_SHAN_YUAN
						|| type == WinCardType.XIAO_SI_XI || type == WinCardType.DA_SI_XI || type == WinCardType.ZI_YI_SE)
				{
					if (cardType.score > maxScore)
					{
						maxScore = cardType.score;
						maxType = type;
					}
				}
				typeList.add(type);
			}
		}

		if (maxType > 0)
		{
			for(int i = 0; i < typeList.size(); i++)
			{
				int type = typeList.get(i);
				if (type != maxType)
				{
					map.remove(type);
				}
			}
		}

		if (zimo)
		{

		}
		else
		{
			if (room.config.getBoolean(Config.ROOM_CONFIG_MENG_QING))
			{
				for (Map.Entry<Integer, WinCardType> entry : map.entrySet()) {
					WinCardType cardType = entry.getValue();
					if (cardType.type ==  WinCardType.JIHU || cardType.type == WinCardType.PINGHU)
					{
						boolean flag = true;
						for(int i = 0; i < player.opCardList.size(); i++)
						{
							OpCard op_card = player.opCardList.get(i);
							if (op_card.type != RuleWeight.TYPE_SELF_KONG)
							{
							    flag = false;
							}
						}
						if (flag)
						{
							WinCard.putWinCardType(map, WinCardType.MEN_QING, 1,WinCardType.MENGQING_SCORE, false, "门清");
						}
						break;
					}
				}
			}


			if (room.config.getBoolean(Config.ROOM_CONFIG_JIHU_NOTCHIHU))
			{
				WinCardType jihuType = map.get(WinCardType.JIHU);
				if (jihuType != null)
				{
					//鸡胡不能吃胡
					return false;
				}
			}

			if (room.config.getBoolean(Config.ROOM_CONFIG_SPECAIL_ZIMO))
			{
				int hu_score = 0;
				if (room.config.getBoolean(Config.ROOM_CONFIG_USE_BASE_HU_SCORE))
				{
					hu_score = WinCardType.BASE_HU_SCORE;
				}
				else
				{
					player.hu_score = room.maxPlayers - 1;
					player.di_score = room.maxPlayers - 1;
				}

				int dahu_score = 0;
				if (room.config.getBoolean(Config.ROOM_CONFIG_DAHU_CHENG))
				{
					dahu_score = 1;
				}
				int cheng_score = 1;
				for (Map.Entry<Integer, WinCardType> entry : map.entrySet()) {
					WinCardType cardType = entry.getValue();
					{
						if (room.config.getBoolean(Config.ROOM_CONFIG_DAHU_CHENG))
						{
							if (cardType.IsDaHu())
							{
								dahu_score *= cardType.score;
							}
							else
							{
								cheng_score *= cardType.score;
							}
						}
						else
						{
							if (cardType.IsDaHu())
							{
								dahu_score += cardType.score*WinCardType.DA_HU_BEI_SCORE;
							}
							else
							{
								cheng_score *=  cardType.score;
							}
						}
					}
				}

				if (dahu_score > 0)
				{
					hu_score *= dahu_score;
				}

				hu_score *= cheng_score;

				if (hu_score < 20)
				{
					return false;
				}
			}
		}

		return hu;
	}

	public final static WinCardType putWinCardType(Map<Integer, WinCardType> map, int type, int value,int score, boolean isDaHu, String desc) {
		if (map == null)
			return null;
		if (isDaHu)
		{
			map.remove(WinCardType.JIHU);
			map.remove(WinCardType.PINGHU);
		}
		if (map.containsKey(type)) {
			WinCardType wct = map.get(type);
			wct.value += value;
			//Global.logger.info("putWinCardType: " + wct.toString());
			return wct;
		} else {
			WinCardType wct = new WinCardType(type, value,score, isDaHu, desc);
			map.put(type, wct);
			//Global.logger.info("putWinCardType: " + wct.toString());
			return wct;
		}
	}

	//七小对
	public int IsQiXiaoDui(Map<Integer, Integer> tempCardList, List<OpCard> opCards)
	{
		//组合判断
		if (opCards.size() != 0) return -1;

		//麻将判断
		int mCountTmp = 0;
		int mDaDuiNum = 0;

		for (Map.Entry<Integer, Integer> entry : tempCardList.entrySet()) {
			int card = entry.getKey();
			int num = entry.getValue();
			if ((num!=0) && (num!=2) && (num!=4))
			{
			    return -1;
			}
			if (num == 2) {
				mCountTmp++;
			}
			else if (num == 4) {
				mCountTmp += 2;
				mDaDuiNum++;
			}
		}

		if (mCountTmp == 7)
		{
			return mDaDuiNum;
		}

		return -1;
	}

	public boolean IsZiYiSe(Map<Integer, Integer> tempCardList, List<OpCard> opCards)
	{
		for (Map.Entry<Integer, Integer> entry : tempCardList.entrySet()) {
			int card = entry.getKey();
			if (card < 400)
			{
				return false;
			}
		}

		for(int i = 0; i < opCards.size(); i++)
		{
			OpCard op_card = opCards.get(i);
			if (op_card.card < 400)
			{
			    return false;
			}
		}

		return true;
	}

	public boolean IsQingYiSe(Map<Integer, Integer> tempCardList, List<OpCard> opCards)
	{
		int perColor = -1;
		for (Map.Entry<Integer, Integer> entry : tempCardList.entrySet()) {
			int card = entry.getKey();
			int color = card / 100;
			if (color >= 4)
			{
			    return false;
			}
			if (perColor == -1)
			{
				perColor = color;
			}
			else if (perColor != color)
			{
				return false;
			}
			else {
				perColor = color;
			}
		}

		for(int i = 0; i < opCards.size(); i++)
		{
			OpCard op_card = opCards.get(i);
			int color = op_card.card / 100;
			if (color >= 4)
			{
				return false;
			}
			if (perColor == -1)
			{
				perColor = color;
			}
			else if (perColor != color)
			{
				return false;
			}
			else {
				perColor = color;
			}
		}
		return true;
	}

	public boolean IsHunYiSe(Map<Integer, Integer> tempCardList, List<OpCard> opCards)
	{
		int perColor = -1;
		boolean hunyise = false;
		for (Map.Entry<Integer, Integer> entry : tempCardList.entrySet()) {
			int card = entry.getKey();
			int color = card / 100;
			if (card < 400)
			{
				if (perColor == -1)
				{
					perColor = color;
				}
				else if (perColor != color)
				{
					return false;
				}
				else {
					perColor = color;
				}
			}
			else
			{
				hunyise = true;
			}
		}

		for(int i = 0; i < opCards.size(); i++)
		{
			OpCard op_card = opCards.get(i);
			int color = op_card.card / 100;
			if (op_card.card < 400)
			{
				if (perColor == -1)
				{
					perColor = color;
				}
				else if (perColor != color)
				{
					return false;
				}
				else {
					perColor = color;
				}
			}
			else
			{
				hunyise = true;
			}
		}

		if (perColor != -1 && hunyise)
			return true;

		return false;
	}

	boolean IsShiBaLuoHan(Map<Integer, Integer> tempCardList, List<OpCard> opCards)
	{
		int count = 0;
		for(int i = 0; i < opCards.size(); i++)
		{
			OpCard op_card = opCards.get(i);
			if (op_card.type == RuleWeight.TYPE_KONG || op_card.type == RuleWeight.TYPE_SELF_KONG)
			{
			    count++;
			}
		}

		if (count >= 4)
		{
			return true;
		}

		return false;
	}

	//混幺九
	boolean IsHuYaoJiu(TagAnalyseItem item) {
		boolean yaoKeZe = false;
		if (item.cbCardEye < 400) {
			int value = item.cbCardEye % 100;
			if (value != 1 && value != 9) {
				return false;
			}
		}

		for (int i = 0; i < item.cbOpCard.size(); i++) {
			OpCard op_card = item.cbOpCard.get(i);
			if (op_card.type == RuleWeight.TYPE_CHOW) {
				return false;
			} else {
				int card = op_card.card;
				if (card < 400) {
					int value = card % 100;
					if (value != 1 && value != 9) {
						return false;
					} else {
						yaoKeZe = true;
					}
				}
			}
		}

		if (yaoKeZe)
		{
			return true;
		}

		return false;
	}

	//清幺九
	boolean IsQingYaoJiu(TagAnalyseItem item) {
		if (item.cbCardEye < 400) {
			int value = item.cbCardEye % 100;
			if (value != 1 && value != 9) {
				return false;
			}
		}
		else
		{
			return false;
		}

		for (int i = 0; i < item.cbOpCard.size(); i++) {
			OpCard op_card = item.cbOpCard.get(i);
			if (op_card.type == RuleWeight.TYPE_CHOW) {
				return false;
			} else {
				int card = op_card.card;
				if (card < 400) {
					int value = card % 100;
					if (value != 1 && value != 9) {
						return false;
					}
				}
				else
				{
					return false;
				}
			}
		}

		return true;
	}

	boolean IsQuanFeng(TagAnalyseItem item) {
		for (int i = 0; i < item.cbOpCard.size(); i++) {
			OpCard op_card = item.cbOpCard.get(i);
			if (op_card.type == RuleWeight.TYPE_CHOW) {
				return false;
			} else {
				int card = op_card.card;
				if (card < 400) {
				    return false;
				}
			}
		}

		return true;
	}

	int IsDaXiaoSanYuan(Map<Integer, Integer> tempCardList, List<OpCard> opCards)
	{
		byte mKeCount = 0;
		byte mDuiCount = 0;
		//组合判断
		for(int i = 0; i < opCards.size(); i++)
		{
			OpCard op_card = opCards.get(i);
			if (op_card.card == Config.HONGZHONG
				|| op_card.card == Config.FACAI
				|| op_card.card == Config.BAIBAN)
			{
				mKeCount++;
			}
		}

		for (Map.Entry<Integer, Integer> entry : tempCardList.entrySet()) {
			int card = entry.getKey();
			int num = entry.getValue();

			if (card == Config.HONGZHONG
					|| card == Config.FACAI
					|| card == Config.BAIBAN)
			{
			    if (num == 2)
				{
					mDuiCount++;
				}

				if (num == 3)
				{
					mKeCount++;
				}
			}
		}

		//大三元
		if (mKeCount ==3)
		{
		    return 1;
		}

		//小三元
		if ((mKeCount ==2) && (mDuiCount ==1))
		{
			return 2;
		}

		return 0;
	}

	boolean QuanQiuRen(Map<Integer, Integer> tempCardList,  List<OpCard> opCards)
	{
		if (opCards.size() != 4)
		{
			return false;
		}

		for (Map.Entry<Integer, Integer> entry : tempCardList.entrySet()) {
			int card = entry.getKey();
			int num = entry.getValue();
			if (num != 0 && num != 2)
			{
				return false;
			}
		}
		return false;
	}

	boolean ThirteenOne(Map<Integer, Integer> tempCardList,  List<OpCard> opCards)
	{
	    if (opCards.size() > 0)
		{
			return false;
		}

	    List<Integer> tempList = new ArrayList<Integer>();
	    tempList.add(101);
		tempList.add(109);
		tempList.add(201);
		tempList.add(209);
		tempList.add(301);
		tempList.add(309);
		tempList.add(Config.DONGFENG);
		tempList.add(Config.NANFENG);
		tempList.add(Config.XIFENG);
		tempList.add(Config.BEIFENG);
		tempList.add(Config.HONGZHONG);
		tempList.add(Config.FACAI);
		tempList.add(Config.BAIBAN);

		int jiangnum = 0;
		for(int i = 0; i < tempList.size(); i++)
		{
			int card = tempList.get(i);
			if (tempCardList.getOrDefault(card, 0) != 1)
			{
				if (tempCardList.getOrDefault(card, 0) == 2)
				{
					jiangnum++;
					if (jiangnum >= 2)
					{
						return false;
					}
				}
				else {
					return false;
				}
			}
		}

		if (jiangnum == 1)
		{
			return true;
		}
		return false;
	}

	int IsDaXiaoSiXi(Map<Integer, Integer> tempCardList,  List<OpCard> opCards)
	{
	    int keCount = 0;
	    int duiCount = 0;
		for(int i = 0; i < opCards.size(); i++)
		{
			OpCard op_card = opCards.get(i);
			if (op_card.card == Config.DONGFENG
					|| op_card.card == Config.NANFENG
					|| op_card.card == Config.XIFENG
					|| op_card.card == Config.BEIFENG)
			{
				keCount++;
			}
		}

		for (Map.Entry<Integer, Integer> entry : tempCardList.entrySet()) {
			int card = entry.getKey();
			int num = entry.getValue();
			if (card == Config.DONGFENG
					|| card == Config.NANFENG
					|| card == Config.XIFENG
					|| card == Config.BEIFENG)
			{
			    if (num == 3)
				{
					keCount++;
				}

			    if (num == 2)
				{
					duiCount++;
				}
			}
		}

		//大四喜
		if (keCount >= 4)
		{
			return 1;
		}
		//小四喜
		else if (keCount >= 3 && duiCount >= 1)
		{
			return 2;
		}

		return 0;
	}

	boolean DaSiXi(Map<Integer, Integer> tempCardList,  List<OpCard> opCards)
	{
	    int count = 0;
		for(int i = 0; i < opCards.size(); i++)
		{
			OpCard op_card = opCards.get(i);
			if (op_card.card == Config.DONGFENG
					|| op_card.card == Config.NANFENG
					|| op_card.card == Config.XIFENG
					|| op_card.card == Config.BEIFENG)
			{
				count++;
			}
		}

		for (Map.Entry<Integer, Integer> entry : tempCardList.entrySet()) {
			int card = entry.getKey();
			int num = entry.getValue();
			if (num >= 3)
			{
				if (card == Config.DONGFENG
						|| card == Config.NANFENG
						|| card == Config.XIFENG
						|| card == Config.BEIFENG)
				{
					count++;
				}
			}
		}

		if (count >= 4)
		{
			return true;
		}

		return false;
	}

	boolean AnalyseChiHuCard(Map<Integer, WinCardType> map,  List<OpCard> opCards, ITObject config)
	{
		Map<Integer, Integer> tempCardList = new HashMap<Integer, Integer>();
		tempCardList.putAll(this.cbCardMap);

		List<Integer> tempCardListEx = new ArrayList<Integer>();
		for (int index = 1; index <= 9; index++) {
			boolean nowan = config.getBoolean(Config.ROOM_CONFIG_NO_WAN);
			if (!nowan)
			{
				tempCardListEx.add(100 + index);
			}
			tempCardListEx.add(200 + index);
			tempCardListEx.add(300 + index);
		}

		boolean wufeng = config.getBoolean(Config.ROOM_CONFIG_WU_FENG);
		if (!wufeng)
		{
			tempCardListEx.add(Config.DONGFENG);
			tempCardListEx.add(Config.NANFENG);
			tempCardListEx.add(Config.XIFENG);
			tempCardListEx.add(Config.BEIFENG);
			tempCardListEx.add(Config.HONGZHONG);
			tempCardListEx.add(Config.FACAI);
			tempCardListEx.add(Config.BAIBAN);
		}

		if (this.laizi_count == 1)
		{
			List<Map<Integer, WinCardType>> tempLaiziMapList = new ArrayList<Map<Integer, WinCardType>>();
			for(int i = 0; i < tempCardListEx.size(); i++)
			{
				Map<Integer, WinCardType> tempLaiziMap = new HashMap<Integer, WinCardType>();
			    if (AnalyseChiHuCardEx(tempLaiziMap, tempCardList, tempCardListEx.get(i), opCards, config))
				{
					tempLaiziMapList.add(tempLaiziMap);
				}
			}
			if (tempLaiziMapList.size() > 0)
			{
				int maxValue = 0;
				int maxIndex = 0;
				for(int i_i = 0; i_i < tempLaiziMapList.size(); i_i++)
				{
					Map<Integer, WinCardType> tempLaiziMap = tempLaiziMapList.get(i_i);
					int value = 0;
					for (Map.Entry<Integer, WinCardType> entry : tempLaiziMap.entrySet()) {
						WinCardType cardType = entry.getValue();
						value += cardType.score;
					}
					if (value > maxValue)
					{
						maxValue = value;
						maxIndex = i_i;
					}
				}

				Map<Integer, WinCardType> tempLaiziMap = tempLaiziMapList.get(maxIndex);
				map.putAll(tempLaiziMap);
				return true;
			}
			return false;
		}

		if (this.laizi_count == 2)
		{
			List<Map<Integer, WinCardType>> tempLaiziMapList = new ArrayList<Map<Integer, WinCardType>>();
			for(int x =0; x < tempCardListEx.size(); x++)
			{
				tempCardList.put(tempCardListEx.get(x), tempCardList.getOrDefault(tempCardListEx.get(x), 0) +1);
				for(int i = 0; i < tempCardListEx.size(); i++)
				{
					Map<Integer, WinCardType> tempLaiziMap = new HashMap<Integer, WinCardType>();
					if (AnalyseChiHuCardEx(tempLaiziMap, tempCardList, tempCardListEx.get(i), opCards, config))
					{
						tempLaiziMapList.add(tempLaiziMap);
					}
				}
				tempCardList.put(tempCardListEx.get(x), tempCardList.getOrDefault(tempCardListEx.get(x), 0) -1);
			}
			if (tempLaiziMapList.size() > 0)
			{
				int maxValue = 0;
				int maxIndex = 0;
				for(int i_i = 0; i_i < tempLaiziMapList.size(); i_i++)
				{
					Map<Integer, WinCardType> tempLaiziMap = tempLaiziMapList.get(i_i);
					int value = 0;
					for (Map.Entry<Integer, WinCardType> entry : tempLaiziMap.entrySet()) {
						WinCardType cardType = entry.getValue();
						value += cardType.score;
					}
					if (value > maxValue)
					{
						maxValue = value;
						maxIndex = i_i;
					}
				}

				Map<Integer, WinCardType> tempLaiziMap = tempLaiziMapList.get(maxIndex);
				map.putAll(tempLaiziMap);
				return true;
			}
			return false;
		}

		if (this.laizi_count == 3)
		{
			List<Map<Integer, WinCardType>> tempLaiziMapList = new ArrayList<Map<Integer, WinCardType>>();
		    for(int y = 0; y < tempCardListEx.size(); y++)
			{
				tempCardList.put(tempCardListEx.get(y), tempCardList.getOrDefault(tempCardListEx.get(y), 0) +1);
				for(int x =0; x < tempCardListEx.size(); x++)
				{
					tempCardList.put(tempCardListEx.get(x), tempCardList.getOrDefault(tempCardListEx.get(x), 0) +1);
					for(int i = 0; i < tempCardListEx.size(); i++)
					{
						Map<Integer, WinCardType> tempLaiziMap = new HashMap<Integer, WinCardType>();
						if (AnalyseChiHuCardEx(tempLaiziMap, tempCardList, tempCardListEx.get(i), opCards, config))
						{
							tempLaiziMapList.add(tempLaiziMap);
						}
					}
					tempCardList.put(tempCardListEx.get(x), tempCardList.getOrDefault(tempCardListEx.get(x), 0) -1);
				}
				tempCardList.put(tempCardListEx.get(y), tempCardList.getOrDefault(tempCardListEx.get(y), 0) -1);
			}
			if (tempLaiziMapList.size() > 0)
			{
				int maxValue = 0;
				int maxIndex = 0;
				for(int i_i = 0; i_i < tempLaiziMapList.size(); i_i++)
				{
					Map<Integer, WinCardType> tempLaiziMap = tempLaiziMapList.get(i_i);
					int value = 0;
					for (Map.Entry<Integer, WinCardType> entry : tempLaiziMap.entrySet()) {
						WinCardType cardType = entry.getValue();
						value += cardType.score;
					}
					if (value > maxValue)
					{
						maxValue = value;
						maxIndex = i_i;
					}
				}

				Map<Integer, WinCardType> tempLaiziMap = tempLaiziMapList.get(maxIndex);
				map.putAll(tempLaiziMap);
				return true;
			}
			return false;
		}

		if (this.laizi_count == 4)
		{
			List<Map<Integer, WinCardType>> tempLaiziMapList = new ArrayList<Map<Integer, WinCardType>>();
			for(int z = 0; z < tempCardListEx.size(); z++)
			{
				tempCardList.put(tempCardListEx.get(z), tempCardList.getOrDefault(tempCardListEx.get(z), 0) +1);
				for(int y = 0; y < tempCardListEx.size(); y++)
				{
					tempCardList.put(tempCardListEx.get(y), tempCardList.getOrDefault(tempCardListEx.get(y), 0) +1);
					for(int x =0; x < tempCardListEx.size(); x++)
					{
						tempCardList.put(tempCardListEx.get(x), tempCardList.getOrDefault(tempCardListEx.get(x), 0) +1);
						for(int i = 0; i < tempCardListEx.size(); i++)
						{
							Map<Integer, WinCardType> tempLaiziMap = new HashMap<Integer, WinCardType>();
							if (AnalyseChiHuCardEx(tempLaiziMap, tempCardList, tempCardListEx.get(i), opCards, config))
							{
								tempLaiziMapList.add(tempLaiziMap);
							}
						}
						tempCardList.put(tempCardListEx.get(x), tempCardList.getOrDefault(tempCardListEx.get(x), 0) -1);
					}
					tempCardList.put(tempCardListEx.get(y), tempCardList.getOrDefault(tempCardListEx.get(y), 0) -1);
				}
				tempCardList.put(tempCardListEx.get(z), tempCardList.getOrDefault(tempCardListEx.get(z), 0) -1);
			}
			if (tempLaiziMapList.size() > 0)
			{
				int maxValue = 0;
				int maxIndex = 0;
				for(int i_i = 0; i_i < tempLaiziMapList.size(); i_i++)
				{
					Map<Integer, WinCardType> tempLaiziMap = tempLaiziMapList.get(i_i);
					int value = 0;
					for (Map.Entry<Integer, WinCardType> entry : tempLaiziMap.entrySet()) {
						WinCardType cardType = entry.getValue();
						value += cardType.score;
					}
					if (value > maxValue)
					{
						maxValue = value;
						maxIndex = i_i;
					}
				}

				Map<Integer, WinCardType> tempLaiziMap = tempLaiziMapList.get(maxIndex);
				map.putAll(tempLaiziMap);
				return true;
			}
			return false;
		}

		if (this.laizi_count == 5)
		{
			List<Map<Integer, WinCardType>> tempLaiziMapList = new ArrayList<Map<Integer, WinCardType>>();
			for(int a = 0; a < tempCardListEx.size(); a++)
			{
				tempCardList.put(tempCardListEx.get(a), tempCardList.getOrDefault(tempCardListEx.get(a), 0) +1);
				for(int z = 0; z < tempCardListEx.size(); z++)
				{
					tempCardList.put(tempCardListEx.get(z), tempCardList.getOrDefault(tempCardListEx.get(z), 0) +1);
					for(int y = 0; y < tempCardListEx.size(); y++)
					{
						tempCardList.put(tempCardListEx.get(y), tempCardList.getOrDefault(tempCardListEx.get(y), 0) +1);
						for(int x =0; x < tempCardListEx.size(); x++)
						{
							tempCardList.put(tempCardListEx.get(x), tempCardList.getOrDefault(tempCardListEx.get(x), 0) +1);
							for(int i = 0; i < tempCardListEx.size(); i++)
							{
								Map<Integer, WinCardType> tempLaiziMap = new HashMap<Integer, WinCardType>();
								if (AnalyseChiHuCardEx(tempLaiziMap, tempCardList, tempCardListEx.get(i), opCards, config))
								{
									tempLaiziMapList.add(tempLaiziMap);
								}
							}
							tempCardList.put(tempCardListEx.get(x), tempCardList.getOrDefault(tempCardListEx.get(x), 0) -1);
						}
						tempCardList.put(tempCardListEx.get(y), tempCardList.getOrDefault(tempCardListEx.get(y), 0) -1);
					}
					tempCardList.put(tempCardListEx.get(z), tempCardList.getOrDefault(tempCardListEx.get(z), 0) -1);
				}
				tempCardList.put(tempCardListEx.get(a), tempCardList.getOrDefault(tempCardListEx.get(a), 0) -1);
			}

			if (tempLaiziMapList.size() > 0)
			{
				int maxValue = 0;
				int maxIndex = 0;
				for(int i_i = 0; i_i < tempLaiziMapList.size(); i_i++)
				{
					Map<Integer, WinCardType> tempLaiziMap = tempLaiziMapList.get(i_i);
					int value = 0;
					for (Map.Entry<Integer, WinCardType> entry : tempLaiziMap.entrySet()) {
						WinCardType cardType = entry.getValue();
						value += cardType.score;
					}
					if (value > maxValue)
					{
						maxValue = value;
						maxIndex = i_i;
					}
				}

				Map<Integer, WinCardType> tempLaiziMap = tempLaiziMapList.get(maxIndex);
				map.putAll(tempLaiziMap);
				return true;
			}
			return false;
		}

		if (this.laizi_count == 6)
		{
			List<Map<Integer, WinCardType>> tempLaiziMapList = new ArrayList<Map<Integer, WinCardType>>();
			for(int b = 0; b < tempCardListEx.size(); b++)
			{
				tempCardList.put(tempCardListEx.get(b), tempCardList.getOrDefault(tempCardListEx.get(b), 0) +1);
				for(int a = 0; a < tempCardListEx.size(); a++)
				{
					tempCardList.put(tempCardListEx.get(a), tempCardList.getOrDefault(tempCardListEx.get(a), 0) +1);
					for(int z = 0; z < tempCardListEx.size(); z++)
					{
						tempCardList.put(tempCardListEx.get(z), tempCardList.getOrDefault(tempCardListEx.get(z), 0) +1);
						for(int y = 0; y < tempCardListEx.size(); y++)
						{
							tempCardList.put(tempCardListEx.get(y), tempCardList.getOrDefault(tempCardListEx.get(y), 0) +1);
							for(int x =0; x < tempCardListEx.size(); x++)
							{
								tempCardList.put(tempCardListEx.get(x), tempCardList.getOrDefault(tempCardListEx.get(x), 0) +1);
								for(int i = 0; i < tempCardListEx.size(); i++)
								{
									Map<Integer, WinCardType> tempLaiziMap = new HashMap<Integer, WinCardType>();
									if (AnalyseChiHuCardEx(tempLaiziMap, tempCardList, tempCardListEx.get(i), opCards, config))
									{
										tempLaiziMapList.add(tempLaiziMap);
									}
								}
								tempCardList.put(tempCardListEx.get(x), tempCardList.getOrDefault(tempCardListEx.get(x), 0) -1);
							}
							tempCardList.put(tempCardListEx.get(y), tempCardList.getOrDefault(tempCardListEx.get(y), 0) -1);
						}
						tempCardList.put(tempCardListEx.get(z), tempCardList.getOrDefault(tempCardListEx.get(z), 0) -1);
					}
					tempCardList.put(tempCardListEx.get(a), tempCardList.getOrDefault(tempCardListEx.get(a), 0) -1);
				}

				tempCardList.put(tempCardListEx.get(b), tempCardList.getOrDefault(tempCardListEx.get(b), 0) -1);
			}

			if (tempLaiziMapList.size() > 0)
			{
				int maxValue = 0;
				int maxIndex = 0;
				for(int i_i = 0; i_i < tempLaiziMapList.size(); i_i++)
				{
					Map<Integer, WinCardType> tempLaiziMap = tempLaiziMapList.get(i_i);
					int value = 0;
					for (Map.Entry<Integer, WinCardType> entry : tempLaiziMap.entrySet()) {
						WinCardType cardType = entry.getValue();
						value += cardType.score;
					}
					if (value > maxValue)
					{
						maxValue = value;
						maxIndex = i_i;
					}
				}

				Map<Integer, WinCardType> tempLaiziMap = tempLaiziMapList.get(maxIndex);
				map.putAll(tempLaiziMap);
				return true;
			}
			return false;
		}

		if (this.laizi_count == 7)
		{
			List<Map<Integer, WinCardType>> tempLaiziMapList = new ArrayList<Map<Integer, WinCardType>>();
			for(int c = 0; c < tempCardListEx.size(); c++)
			{
				tempCardList.put(tempCardListEx.get(c), tempCardList.getOrDefault(tempCardListEx.get(c), 0) +1);
				for(int b = 0; b < tempCardListEx.size(); b++)
				{
					tempCardList.put(tempCardListEx.get(b), tempCardList.getOrDefault(tempCardListEx.get(b), 0) +1);
					for(int a = 0; a < tempCardListEx.size(); a++)
					{
						tempCardList.put(tempCardListEx.get(a), tempCardList.getOrDefault(tempCardListEx.get(a), 0) +1);
						for(int z = 0; z < tempCardListEx.size(); z++)
						{
							tempCardList.put(tempCardListEx.get(z), tempCardList.getOrDefault(tempCardListEx.get(z), 0) +1);
							for(int y = 0; y < tempCardListEx.size(); y++)
							{
								tempCardList.put(tempCardListEx.get(y), tempCardList.getOrDefault(tempCardListEx.get(y), 0) +1);
								for(int x =0; x < tempCardListEx.size(); x++)
								{
									tempCardList.put(tempCardListEx.get(x), tempCardList.getOrDefault(tempCardListEx.get(x), 0) +1);
									for(int i = 0; i < tempCardListEx.size(); i++)
									{
										Map<Integer, WinCardType> tempLaiziMap = new HashMap<Integer, WinCardType>();
										if (AnalyseChiHuCardEx(tempLaiziMap, tempCardList, tempCardListEx.get(i), opCards, config))
										{
											tempLaiziMapList.add(tempLaiziMap);
										}
									}
									tempCardList.put(tempCardListEx.get(x), tempCardList.getOrDefault(tempCardListEx.get(x), 0) -1);
								}
								tempCardList.put(tempCardListEx.get(y), tempCardList.getOrDefault(tempCardListEx.get(y), 0) -1);
							}
							tempCardList.put(tempCardListEx.get(z), tempCardList.getOrDefault(tempCardListEx.get(z), 0) -1);
						}
						tempCardList.put(tempCardListEx.get(a), tempCardList.getOrDefault(tempCardListEx.get(a), 0) -1);
					}

					tempCardList.put(tempCardListEx.get(b), tempCardList.getOrDefault(tempCardListEx.get(b), 0) -1);
				}

				tempCardList.put(tempCardListEx.get(c), tempCardList.getOrDefault(tempCardListEx.get(c), 0) -1);
			}

			if (tempLaiziMapList.size() > 0)
			{
				int maxValue = 0;
				int maxIndex = 0;
				for(int i_i = 0; i_i < tempLaiziMapList.size(); i_i++)
				{
					Map<Integer, WinCardType> tempLaiziMap = tempLaiziMapList.get(i_i);
					int value = 0;
					for (Map.Entry<Integer, WinCardType> entry : tempLaiziMap.entrySet()) {
						WinCardType cardType = entry.getValue();
						value += cardType.score;
					}
					if (value > maxValue)
					{
						maxValue = value;
						maxIndex = i_i;
					}
				}

				Map<Integer, WinCardType> tempLaiziMap = tempLaiziMapList.get(maxIndex);
				map.putAll(tempLaiziMap);
				return true;
			}
			return false;
		}

		if (this.laizi_count == 8)
		{
			List<Map<Integer, WinCardType>> tempLaiziMapList = new ArrayList<Map<Integer, WinCardType>>();
			for(int d = 0; d < tempCardListEx.size(); d++)
			{
				tempCardList.put(tempCardListEx.get(d), tempCardList.getOrDefault(tempCardListEx.get(d), 0) +1);
				for(int c = 0; c < tempCardListEx.size(); c++)
				{
					tempCardList.put(tempCardListEx.get(c), tempCardList.getOrDefault(tempCardListEx.get(c), 0) +1);
					for(int b = 0; b < tempCardListEx.size(); b++)
					{
						tempCardList.put(tempCardListEx.get(b), tempCardList.getOrDefault(tempCardListEx.get(b), 0) +1);
						for(int a = 0; a < tempCardListEx.size(); a++)
						{
							tempCardList.put(tempCardListEx.get(a), tempCardList.getOrDefault(tempCardListEx.get(a), 0) +1);
							for(int z = 0; z < tempCardListEx.size(); z++)
							{
								tempCardList.put(tempCardListEx.get(z), tempCardList.getOrDefault(tempCardListEx.get(z), 0) +1);
								for(int y = 0; y < tempCardListEx.size(); y++)
								{
									tempCardList.put(tempCardListEx.get(y), tempCardList.getOrDefault(tempCardListEx.get(y), 0) +1);
									for(int x =0; x < tempCardListEx.size(); x++)
									{
										tempCardList.put(tempCardListEx.get(x), tempCardList.getOrDefault(tempCardListEx.get(x), 0) +1);
										for(int i = 0; i < tempCardListEx.size(); i++)
										{
											Map<Integer, WinCardType> tempLaiziMap = new HashMap<Integer, WinCardType>();
											if (AnalyseChiHuCardEx(tempLaiziMap, tempCardList, tempCardListEx.get(i), opCards, config))
											{
												tempLaiziMapList.add(tempLaiziMap);
											}
										}
										tempCardList.put(tempCardListEx.get(x), tempCardList.getOrDefault(tempCardListEx.get(x), 0) -1);
									}
									tempCardList.put(tempCardListEx.get(y), tempCardList.getOrDefault(tempCardListEx.get(y), 0) -1);
								}
								tempCardList.put(tempCardListEx.get(z), tempCardList.getOrDefault(tempCardListEx.get(z), 0) -1);
							}
							tempCardList.put(tempCardListEx.get(a), tempCardList.getOrDefault(tempCardListEx.get(a), 0) -1);
						}

						tempCardList.put(tempCardListEx.get(b), tempCardList.getOrDefault(tempCardListEx.get(b), 0) -1);
					}

					tempCardList.put(tempCardListEx.get(c), tempCardList.getOrDefault(tempCardListEx.get(c), 0) -1);
				}

				tempCardList.put(tempCardListEx.get(d), tempCardList.getOrDefault(tempCardListEx.get(d), 0) -1);
			}

			if (tempLaiziMapList.size() > 0)
			{
				int maxValue = 0;
				int maxIndex = 0;
				for(int i_i = 0; i_i < tempLaiziMapList.size(); i_i++)
				{
					Map<Integer, WinCardType> tempLaiziMap = tempLaiziMapList.get(i_i);
					int value = 0;
					for (Map.Entry<Integer, WinCardType> entry : tempLaiziMap.entrySet()) {
						WinCardType cardType = entry.getValue();
						value += cardType.score;
					}
					if (value > maxValue)
					{
						maxValue = value;
						maxIndex = i_i;
					}
				}

				Map<Integer, WinCardType> tempLaiziMap = tempLaiziMapList.get(maxIndex);
				map.putAll(tempLaiziMap);
				return true;
			}
			return false;
		}

		if (AnalyseChiHuCardEx(map, tempCardList, 0, opCards, config))
		{
			return true;
		}

		return false;
	}

	boolean AnalyseChiHuCardEx(Map<Integer, WinCardType> map, Map<Integer, Integer> cardListParam, int curCard, List<OpCard> opCards, ITObject config)
	{
		Map<Integer, Integer> tempCardList = new HashMap<>();
		tempCardList.putAll(cardListParam);

		if (curCard > 0)
		{
			tempCardList.put(curCard, tempCardList.getOrDefault(curCard, 0)+1);
		}

		List<Integer> clearCardList = new ArrayList<>();
		for (Map.Entry<Integer, Integer> entry : tempCardList.entrySet()) {
			if (entry.getValue() == 0)
			{
				clearCardList.add(entry.getKey());
			}
		}

		for(int i = 0; i < clearCardList.size(); i++)
		{
			tempCardList.remove(clearCardList.get(i));
		}

		//变量定义
		List<TagAnalyseItem> tagAnalyseItemList = new ArrayList<TagAnalyseItem>();
		List<Integer> wChiHuKind = new ArrayList<Integer>();

		//分析麻将
		AnalyseCard(tempCardList, opCards, tagAnalyseItemList);

		//胡牌分析
		if (tagAnalyseItemList.size() > 0)
		{
			//牌型分析
			for (int i = 0;i < tagAnalyseItemList.size();i++)
			{
				//变量定义
				boolean bLianCard=false,bPengCard=false,b258Card=false;
				TagAnalyseItem pAnalyseItem= tagAnalyseItemList.get(i);

				//牌型分析
				for (int j = 0;j < pAnalyseItem.cbOpCard.size(); j++) {
					OpCard cbWeaveKind = pAnalyseItem.cbOpCard.get(j);
					if (cbWeaveKind.type == RuleWeight.TYPE_PONG
							|| cbWeaveKind.type == RuleWeight.TYPE_KONG
							|| cbWeaveKind.type == RuleWeight.TYPE_SELF_KONG
							|| cbWeaveKind.type == RuleWeight.TYPE_PONG_KONG) {
						bPengCard = true;
					}

					if (cbWeaveKind.type == RuleWeight.TYPE_CHOW) {
						bLianCard = true;
					}
				}

				//牌型判断
				if (bLianCard==false && bPengCard==false)
				{
					return false;
				}

				if (bLianCard && bPengCard == false)
				{
					wChiHuKind.add(WinCardType.PINGHU);
					putWinCardType(map, WinCardType.PINGHU, 1,WinCardType.PINGHU_SCORE, true, "平胡");
				}
				else if (bLianCard && bPengCard)
				{
					if (config.getBoolean(Config.ROOM_CONFIG_JIHU_SHI_PINGHU))
					{
						wChiHuKind.add(WinCardType.PINGHU);
						putWinCardType(map, WinCardType.PINGHU, 1,WinCardType.PINGHU_SCORE, true, "平胡");
					}
					else
					{
						wChiHuKind.add(WinCardType.JIHU);
						putWinCardType(map, WinCardType.JIHU, 1,WinCardType.JIHU_SCORE, false, "鸡胡");
					}
				}

				//特殊--碰碰胡
				if ((bLianCard==false)&&(bPengCard==true))
				{
					if (config.getBoolean(Config.ROOM_CONFIG_PENGPENGHU))
					{
						wChiHuKind.add(WinCardType.PENGPENGHU);
						putWinCardType(map, WinCardType.PENGPENGHU, 1,WinCardType.PENGPENGHU_SCORE, true, "碰碰胡");
					}
					else {
						if (config.getBoolean(Config.ROOM_CONFIG_JIHU_SHI_PINGHU))
						{
							wChiHuKind.add(WinCardType.PINGHU);
							putWinCardType(map, WinCardType.PINGHU, 1,WinCardType.PINGHU_SCORE, true, "平胡");
						}
						else
						{
							wChiHuKind.add(WinCardType.JIHU);
							putWinCardType(map, WinCardType.JIHU, 1,WinCardType.JIHU_SCORE, false, "鸡胡");
						}
					}
				}

				if (config.getBoolean(Config.ROOM_CONFIG_YAO_JIU))
				{
					if (config.getBoolean(Config.ROOM_CONFIG_han19))
					{
						if (IsHuYaoJiu(pAnalyseItem))
						{
							wChiHuKind.add(WinCardType.YAO_JIU);
							putWinCardType(map, WinCardType.YAO_JIU, 1,WinCardType.YAO_JIU_SCORE, true, "混幺九");
						}
					}
					else
					{
						if (IsQingYaoJiu(pAnalyseItem))
						{
							wChiHuKind.add(WinCardType.YAO_JIU);
							putWinCardType(map, WinCardType.YAO_JIU, 1,WinCardType.YAO_JIU_SCORE, true, "清幺九");
						}
					}
				}

				if (config.getBoolean(Config.ROOM_CONFIG_QING_YAO_JIU))
				{
					if (IsQingYaoJiu(pAnalyseItem))
					{
						wChiHuKind.add(WinCardType.YAO_JIU);
						putWinCardType(map, WinCardType.QING_YAO_JIU, 1,WinCardType.QING_YAO_JIU_SCORE, true, "清幺九");
					}
				}

				if (config.getBoolean(Config.ROOM_CONFIG_QUAN_FENG))
				{
					if (IsQuanFeng(pAnalyseItem))
					{
						wChiHuKind.add(WinCardType.QUAN_FENG);
						putWinCardType(map, WinCardType.QUAN_FENG, 1,WinCardType.QUAN_FENG_SCORE, true, "全风");
					}
				}
			}
		}

		//特殊胡牌
		if (config.getBoolean(Config.ROOM_CONFIG_QIDUI))
		{
			int DaDuiNum = IsQiXiaoDui(tempCardList, opCards);
			if (DaDuiNum >= 0)
			{
				wChiHuKind.add(WinCardType.QIXIAODUI);
				if (config.getBoolean(Config.ROOM_CONFIG_HAOHUA_QIDUI))
				{
					if (DaDuiNum == 0)
					{
						if (config.getBoolean(Config.ROOM_CONFIG_QIDUI))
						{
							if (config.getBoolean(Config.ROOM_CONFIG_QIDUI_JIA_FAN))
							{
								putWinCardType(map, WinCardType.QIXIAODUI, 1,  WinCardType.QIXIAODUI_SOCRE * 2, true, "七对加番");
							}
							else if (config.getBoolean(Config.ROOM_CONFIG_QIDUI_4BEI))
							{
								putWinCardType(map, WinCardType.QIXIAODUI, 1,  WinCardType.QIXIAODUI_SOCRE * 4, true, "七对四倍");
							}
							else {
								putWinCardType(map, WinCardType.QIXIAODUI, 1, WinCardType.QIXIAODUI_SOCRE, true, "七小对");
							}
						}
					}
					else if (DaDuiNum == 1)
					{
						if (config.getBoolean(Config.ROOM_CONFIG_HAOHUA_QIDUI))
							putWinCardType(map, WinCardType.HAOHUA_QIXIAODUI, 1, WinCardType.HAOHUA_QIXIAODUI_SCORE, true, "豪华七小对");
					}
					else if (DaDuiNum == 2)
					{
						if (config.getBoolean(Config.ROOM_CONFIG_HAOHUA2_QIDUI))
							putWinCardType(map, WinCardType.HAOHUA2_QIXIAODUI, 1, WinCardType.HAOHUA2_QIXIAODUI_SCORE, true, "双豪华七小对");
					}
					else if (DaDuiNum == 3)
					{
						if (config.getBoolean(Config.ROOM_CONFIG_HAOHUA3_QIDUI))
							putWinCardType(map, WinCardType.HAOHUA3_QIXIAODUI, 1, WinCardType.HAOHUA3_QIXIAODUI_SCORE, true, "三豪华七小对");
					}
				}
				else {
					if (config.getBoolean(Config.ROOM_CONFIG_QIDUI))
					{
						if (config.getBoolean(Config.ROOM_CONFIG_QIDUI_JIA_FAN))
						{
							putWinCardType(map, WinCardType.QIXIAODUI, 1, WinCardType.QIXIAODUI_SOCRE * 2, true, "七对加番");
						}
						else if (config.getBoolean(Config.ROOM_CONFIG_QIDUI_4BEI))
						{
							putWinCardType(map, WinCardType.QIXIAODUI, 1, WinCardType.QIXIAODUI_SOCRE * 4, true, "七对四倍");
						}
						else {
							putWinCardType(map, WinCardType.QIXIAODUI, 1, WinCardType.QIXIAODUI_SOCRE, true, "七小对");
						}
					}
				}
			}
		}

		if (config.getBoolean(Config.ROOM_CONFIG_SHISHANGYAO))
		{
			if (ThirteenOne(tempCardList, opCards))
			{
				wChiHuKind.add(WinCardType.SHI_SHAN_YAO);
				putWinCardType(map, WinCardType.SHI_SHAN_YAO, 1, WinCardType.SHI_SHAN_YAO_SCORE, true, "十三幺");
			}
		}

		//结果判断
		if (wChiHuKind.size() > 0)
		{
			if (config.getBoolean(Config.ROOM_CONFIG_QINGYISE))
			{
				if (IsQingYiSe(tempCardList, opCards))
				{
					wChiHuKind.add(WinCardType.QINGYISE);
					putWinCardType(map, WinCardType.QINGYISE, 1,WinCardType.QINGYISE_SCORE, true, "清一色");
				}
			}

			if (config.getBoolean(Config.ROOM_CONFIG_ZIYISE))
			{
				if (IsZiYiSe(tempCardList, opCards))
				{
					wChiHuKind.add(WinCardType.ZI_YI_SE);
					putWinCardType(map, WinCardType.ZI_YI_SE, 1,WinCardType.ZI_YI_SE_SCORE, true, "字一色");
				}
			}

			if (config.getBoolean(Config.ROOM_CONFIG_HUNYISE))
			{
				if (IsHunYiSe(tempCardList, opCards))
				{
					wChiHuKind.add(WinCardType.HUN_YI_SE);
					putWinCardType(map, WinCardType.HUN_YI_SE, 1,WinCardType.HUN_YI_SE_SCORE, true, "混一色");
				}
			}

			if (config.getBoolean(Config.ROOM_CONFIG_DASHANYUAN) || config.getBoolean(Config.ROOM_CONFIG_XIAOSHANYUAN))
			{
				int sanyuan = IsDaXiaoSanYuan(tempCardList, opCards);
				if (sanyuan > 0)
				{
					//大三元
					if (sanyuan == 1)
					{
						if (config.getBoolean(Config.ROOM_CONFIG_DASHANYUAN))
						{
							wChiHuKind.add(WinCardType.DA_SHAN_YUAN);
							putWinCardType(map, WinCardType.DA_SHAN_YUAN, 1, WinCardType.DA_SHAN_YUAN_SCORE, true, "大三元");
						}
					}
					//小山元
					else if (sanyuan == 2)
					{
						if (config.getBoolean(Config.ROOM_CONFIG_XIAOSHANYUAN))
						{
							wChiHuKind.add(WinCardType.XIAO_SHAN_YUAN);
							putWinCardType(map, WinCardType.XIAO_SHAN_YUAN, 1, WinCardType.XIAO_SHAN_YUAN_SCORE, true, "小三元");
						}
					}
				}
			}

			if (config.getBoolean(Config.ROOM_CONFIG_DASIXI) || config.getBoolean(Config.ROOM_CONFIG_XIAOSIXI))
			{
				int sixi = IsDaXiaoSiXi(tempCardList, opCards);
				if (sixi > 0)
				{
					//大四喜
					if (sixi == 1)
					{
						if (config.getBoolean(Config.ROOM_CONFIG_DASIXI))
						{
							wChiHuKind.add(WinCardType.XIAO_SHAN_YUAN);
							putWinCardType(map, WinCardType.DA_SI_XI, 1, WinCardType.DA_SI_XI_SCORE, true, "大四喜");
						}
					}
					//小四喜
					else if (sixi == 2)
					{
						if (config.getBoolean(Config.ROOM_CONFIG_XIAOSIXI))
						{
							wChiHuKind.add(WinCardType.XIAO_SHAN_YUAN);
							putWinCardType(map, WinCardType.XIAO_SI_XI, 1, WinCardType.XIAO_SI_XI_SCORE, true, "小四喜");
						}
					}
				}
			}

			if (config.getBoolean(Config.ROOM_CONFIG_SHIBALUOHAN))
			{
				if (IsShiBaLuoHan(tempCardList, opCards))
				{
					wChiHuKind.add(WinCardType.SHI_BA_LUO_HAN);
					putWinCardType(map, WinCardType.SHI_BA_LUO_HAN, 1, WinCardType.SHI_BA_LUO_HAN_SCORE, true, "十八罗汉");
				}
			}

			if (config.getBoolean(Config.ROOM_CONFIG_QUAN_FENG_SCORE))
			{
				if (QuanQiuRen(tempCardList, opCards))
				{
					wChiHuKind.add(WinCardType.QUAN_QIU_REN);
					putWinCardType(map, WinCardType.QUAN_QIU_REN, 1, WinCardType.QUAN_QIU_REN_SCORE, true, "全求人");
				}
			}

			return true;
		}

		return false;
	}

	boolean AnalyseCard(Map<Integer, Integer> tempCardList, List<OpCard> opCards, List<TagAnalyseItem> tagAnalyseItemList)
	{
		//计算数目
		int cbCardCount = 0;
		for (Map.Entry<Integer, Integer> entry : tempCardList.entrySet()) {
			cbCardCount += entry.getValue();
		}

		//效验数目
		if ((cbCardCount<2)||(cbCardCount>14)||((cbCardCount-2)%3!=0)) {
			return false;
		}

		//变量定义
		List<TagKindItem>  tagKindList = new ArrayList<TagKindItem>();

		//需求判断
		int cbLessKindItem=(cbCardCount-2)/3;
		if (cbLessKindItem+opCards.size()!=4)
		{
			return false;
		}

		//单吊判断
		if (cbLessKindItem==0)
		{
			//效验参数
			if (!((cbCardCount==2)&&(opCards.size()==4)))
			{
				return false;
			}

			//牌眼判断
			for (Map.Entry<Integer, Integer> entry : tempCardList.entrySet()) {
				int card = entry.getKey();
				int num = entry.getValue();
				if (num == 2)
				{
					//变量定义
					TagAnalyseItem AnalyseItem = new TagAnalyseItem();

					//设置结果
					for (int i = 0; i < opCards.size(); i++)
					{
						OpCard src_card = opCards.get(i);
						OpCard op_card = new OpCard(src_card.type, src_card.card);
						AnalyseItem.cbOpCard.add(src_card);
					}
					AnalyseItem.cbCardEye = card;

					//插入结果
					tagAnalyseItemList.add(AnalyseItem);

					return true;
				}
			}

			return false;
		}

		//拆分分析
		if (cbCardCount>=3)
		{
			for (Map.Entry<Integer, Integer> entry : tempCardList.entrySet()) {
				int card = entry.getKey();
				int num = entry.getValue();
				//同牌判断
				if (num >= 3)
				{
					TagKindItem kindItem = new TagKindItem();
					kindItem.type = RuleWeight.TYPE_PONG;
					kindItem.card = card;
					kindItem.cbCardList[0] = card;
					kindItem.cbCardList[1] = card;
					kindItem.cbCardList[2] = card;
					tagKindList.add(kindItem);
				}

				//连牌判断
				if (card < 400 && card % 100 <= 7 && num >0)
				{
					for(int i = 1; i <= num; i++)
					{
						if (tempCardList.getOrDefault(card + 1, 0) >= i && tempCardList.getOrDefault(card + 2, 0) >= i)
						{
							TagKindItem kindItem = new TagKindItem();
							kindItem.type = RuleWeight.TYPE_CHOW;
							kindItem.card = card;
							kindItem.cbCardList[0] = card;
							kindItem.cbCardList[1] = card + 1;
							kindItem.cbCardList[2] = card + 2;
							tagKindList.add(kindItem);
						}
					}
				}
			}
		}

		//组合分析
		if (tagKindList.size() >= cbLessKindItem)
		{
			//变量定义
			Integer[] cbIndex = new Integer[4]; //{0,1,2,3};
			cbIndex[0] = 0;
			cbIndex[1] = 1;
			cbIndex[2] = 2;
			cbIndex[3] = 3;

			TagKindItem[] pKindItem = new TagKindItem[4];
			pKindItem[0] = null;
			pKindItem[1] = null;
			pKindItem[2] = null;
			pKindItem[3] = null;

			//开始组合
			do
			{
				//设置变量
				Map<Integer, Integer> cbCardMap_temp = new HashMap<Integer, Integer>();
				cbCardMap_temp.putAll(tempCardList);

				for (int i = 0;i < cbLessKindItem; i++) {
					pKindItem[i] = tagKindList.get(cbIndex[i]);
				}

				//数量判断
				boolean bEnoughCard=true;
				for (int i = 0; i < cbLessKindItem * 3; i++)
				{
					//存在判断
					int cbCardIndex = pKindItem[i/3].cbCardList[i%3];
					if (cbCardMap_temp.getOrDefault(cbCardIndex, 0) <= 0)
					{
						bEnoughCard=false;
						break;
					}
					else
					{
						if (cbCardMap_temp.containsKey(cbCardIndex))
						{
							cbCardMap_temp.put(cbCardIndex, cbCardMap_temp.get(cbCardIndex)-1);
						}
					}
				}

				//胡牌判断
				if (bEnoughCard == true)
				{
					//牌眼判断
					int cbCardEye = 0;
					for (Map.Entry<Integer, Integer> entry : cbCardMap_temp.entrySet()) {
						int card = entry.getKey();
						int num = entry.getValue();
						if (num == 2)
						{
							cbCardEye = card;
							break;
						}
					}

					//组合类型
					if (cbCardEye != 0)
					{
						//变量定义
						TagAnalyseItem AnalyseItem = new TagAnalyseItem();

						//设置组合
						for (int i = 0; i < opCards.size(); i++)
						{
							OpCard src_card = opCards.get(i);
							OpCard op_card = new OpCard(src_card.type, src_card.card);
							AnalyseItem.cbOpCard.add(op_card);
						}

						//设置牌型
						for (int i = 0; i < cbLessKindItem; i++)
						{
							OpCard op_card = new OpCard(pKindItem[i].type, pKindItem[i].card);
							AnalyseItem.cbOpCard.add(op_card);
						}

						//设置牌眼
						AnalyseItem.cbCardEye = cbCardEye;

						//插入结果
						tagAnalyseItemList.add(AnalyseItem);
					}
				}

				//设置索引
				if (cbIndex[cbLessKindItem-1] == (tagKindList.size()-1))
				{
					int i = cbLessKindItem-1;
					for (;i>0;i--)
					{
						if ((cbIndex[i-1]+1) != cbIndex[i])
						{
							int cbNewIndex=cbIndex[i-1];
							for (int j=(i-1);j<cbLessKindItem;j++) {
								cbIndex[j]=cbNewIndex+j-i+2;
							}
							break;
						}
					}
					if (i==0) break;
				}
				else {
					cbIndex[cbLessKindItem-1]++;
				}

			} while (true);

		}

		return (tagAnalyseItemList.size() > 0);
	}
}
