Example #1
0
        public void AddAgent(Agent pAgent)
        {
            int id       = pAgent.GetId();
            int priority = pAgent.GetPriority();
            int num      = -1;

            for (int i = 0; i < this.Agents.get_Count(); i++)
            {
                if (this.Agents.get_Item(i).priority == priority)
                {
                    num = i;
                    break;
                }
            }
            if (num == -1)
            {
                World.HeapItem_t heapItem_t = default(World.HeapItem_t);
                heapItem_t.agents   = new DictionaryView <int, Agent>();
                heapItem_t.priority = priority;
                heapItem_t.agents.set_Item(id, pAgent);
                this.Agents.Add(heapItem_t);
            }
            else
            {
                this.Agents.get_Item(num).agents.set_Item(id, pAgent);
            }
        }
Example #2
0
        public void LogCurrentStates()
        {
            string text = string.Format("LogCurrentStates {0} {1}", base.GetClassTypeName(), this.Agents.get_Count());

            using (List <World.HeapItem_t> .Enumerator enumerator = this.Agents.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    World.HeapItem_t current = enumerator.get_Current();
                    using (DictionaryView <int, Agent> .Enumerator enumerator2 = current.agents.GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            KeyValuePair <int, Agent> current2 = enumerator2.get_Current();
                            if (current2.get_Value().IsMasked())
                            {
                                current2.get_Value().LogVariables(true);
                            }
                        }
                    }
                }
            }
            if (base.IsMasked())
            {
                base.LogVariables(true);
            }
        }