Exemple #1
0
        public QueryId AddQuery(Query <TComponentKindSet> query)
        {
            if (_queryIdByQuery.TryGetValue(query, out var found))
            {
                return(found);
            }

            var queryId = _queryId;

            _queryIdByQuery.Add(query, queryId);
            _queryByQueryId[queryId] = query;
            _queryId++;
            return(queryId);
        }
        public static void AddingBeyondCapacityGrows()
        {
            var dict = new CompactDictionary <string, int>(null, 4)
            {
                { "a", 1 },
                { "b", 2 },
                { "c", 3 },
                { "d", 4 }
            };

            Assert.AreEqual(4, dict.Capacity);
            dict.Add("e", 5);
            Assert.GreaterOrEqual(dict.Capacity, 5);
        }