Example #1
0
        /// <summary>
        /// Checks if specific omaha hole cards pass the filter
        /// </summary>
        /// <param name="cards">omaha hole cards</param>
        /// <param name="collection">collection of items that contains filter description</param>
        /// <returns></returns>
        public static bool CheckOmahaHoleCards(string cards, IEnumerable <OmahaHandGridItem> collection)
        {
            var cardsList = CardGroup.Parse(cards);
            var analyzers = OmahaHoleCardsAnalyzer.GetDefaultOmahaHoleCardsAnalyzers();

            return(collection.All(item => analyzers.First(a => a.GetRank() == item.HoleCards).Analyze(cardsList, item)));
        }
        public Expression <Func <Playerstatistic, bool> > GetFilterPredicate()
        {
            Expression <Func <Playerstatistic, bool> > resultPredicate = null;
            var analyzers = OmahaHoleCardsAnalyzer.GetDefaultOmahaHoleCardsAnalyzers();

            if (HandGridCollection.Any(x => x.IsChecked))
            {
                var collection = HandGridCollection.Where(x => x.IsChecked);
                resultPredicate = PredicateBuilder.Create <Playerstatistic>(p => FilterHelpers.CheckOmahaHoleCards(p.Cards, collection));
            }

            return(resultPredicate);
        }