Beispiel #1
0
        public bool IntersectsWith([NotNull] TokenSet other)
        {
            if (other == null)
            {
                throw new ArgumentNullException("other", "Cannot intersect with null");
            }

            var i = 0;
            var j = 0;

            while (i < _tokens.Count && j < other._tokens.Count)
            {
                var comparison = SortOrder.Compare(_tokens[i], other._tokens[j]);
                if (comparison < 0)
                {
                    i++;
                }
                else if (comparison > 0)
                {
                    j++;
                }
                else
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #2
0
        /// <summary>
        /// Tests if the local player knows has knowledge of *any* of the tokens in the given set
        /// </summary>
        /// <param name="tokens"></param>
        /// <returns></returns>
        public bool HasAnyToken([NotNull] TokenSet tokens)
        {
            if (tokens == null)
            {
                throw new ArgumentNullException("tokens", "Cannot intersect with a null set");
            }

            return(_tokens.IntersectsWith(tokens));
        }