Esempio n. 1
0
        public StatList <KeyType, ValueType> Union(StatList <KeyType, ValueType> other)
        {
            StatList <KeyType, ValueType> union = new StatList <KeyType, ValueType>(this);

            foreach (ListItemStats <KeyType, ValueType> item in other.AllItems)
            {
                union.Add(item.Key, item.Value);
            }
            return(union);
        }
Esempio n. 2
0
        private void CopyFrom(StatList <KeyType, ValueType> source)
        {
            // figure out who to call for some future data
            this.keyComparer   = source.keyComparer;
            this.valueCombiner = source.valueCombiner;
            // get the appropriate data to add
            List <ListItemStats <KeyType, ValueType> > sourceItems = new List <ListItemStats <KeyType, ValueType> >(source.NumItems);

            if (source.rootNode != null)
            {
                source.GetAllItems(source.rootNode, sourceItems);
                // add the appropriate data
                foreach (ListItemStats <KeyType, ValueType> item in sourceItems)
                {
                    this.Add(item.Key, item.Value);
                }
            }
        }
Esempio n. 3
0
 public StatList(StatList <KeyType, ValueType> original)
 {
     this.CopyFrom(original);
 }