コード例 #1
0
    // On new instance, this will fired, which will setup the dictionary
    protected void Initiate(int numberOfMultipliers)
    {
        // Ensure you have an active instance of the dictionary
        if (Multipliers == null)
        {
            Multipliers = new Dictionary <string, float>();
        }

        // Ensurance
        if (numberOfMultipliers > 0)
        {
            MultCount = numberOfMultipliers;
            for (int x = 1; x <= numberOfMultipliers; x++)
            {
                if (!Multipliers.ContainsKey("Mult" + x))
                {
                    Multipliers.Add("Mult" + x, 0);
                }
            }
        }
        else
        {
            throw new ArgumentOutOfRangeException();
        }
    }
コード例 #2
0
        private void AddMultiplier(TransitionMultiplierValue item)
        {
            List <TransitionMultiplierValue> Multipliers = this.GetItemExact(
                item.TransitionGroupId, item.StratumId, item.SecondaryStratumId, item.TertiaryStratumId,
                item.StateClassId, item.Iteration, item.Timestep);

            if (Multipliers == null)
            {
                Multipliers = new List <TransitionMultiplierValue>();

                this.AddItem(item.TransitionGroupId, item.StratumId, item.SecondaryStratumId, item.TertiaryStratumId,
                             item.StateClassId, item.Iteration, item.Timestep, Multipliers);

                this.m_AllLists.Add(Multipliers);
            }

            Multipliers.Add(item);
            base.SetHasItems();
        }