Exemplo n.º 1
0
        public void Add(WeightedList <T> List, bool Overwrite)
        {
            if (List == null)
            {
                return;
            }

            foreach (var item in List.items)
            {
                if (Overwrite || FindIndex(item.value) == -1)
                {
                    Add(item.value, item.weight);
                }
            }
        }
Exemplo n.º 2
0
        public WeightedList <T> Copy(float WeightMultiplier = 1f)
        {
            if (WeightMultiplier <= 0f)
            {
                return(new WeightedList <T>());
            }

            var ret = new WeightedList <T>(items.Capacity);

            foreach (var item in items)
            {
                ret.Add(item.value, item.weight * WeightMultiplier);
            }

            return(ret);
        }