示例#1
0
        /// <summary>
        /// Determines if an area contains an element.
        /// </summary>
        /// <param name="element">The element to look for.</param>
        /// <param name="location">The location to check.</param>
        /// <returns><see langword="true"/> if the element is in that location.</returns>
        public bool Contains(TElement element, Location location = Location.DrawPile)
        {
            Contract.Requires(Enum.IsDefined(typeof(Location), location));

            switch (location)
            {
            case Location.DiscardPile:
                return(DiscardPile.Contains(element));

            case Location.Hand:
                return(HandSet.Any(hand => hand.Contains(element)));

            case Location.Table:
                return(Table.Contains(element));

            case Location.DrawPile:
                return(DrawPile.Contains(element));

            default:
                throw new NotImplementedException($"The value of {location} wasn't coded for.");
            }
            return(false);
        }