コード例 #1
0
ファイル: InMemoryDb.cs プロジェクト: guyshachar/align
        public void LoadEntities(List <MissionEntity> entities)
        {
            MissionsList.AddRange(entities);

            IsolatedAgents.Clear();
            IsolationsPerCountry.Clear();
            MostIsolatedCountry = null;

            foreach (var entity in entities)
            {
                ParseEntity(entity);
            }

            // Calculate IsolationsPerCountry
            foreach ((string agent, string country) in IsolatedAgents)
            {
                if (!IsolationsPerCountry.ContainsKey(country))
                {
                    IsolationsPerCountry.Add(country, 0);
                }
                IsolationsPerCountry[country]++;

                if (string.IsNullOrWhiteSpace(MostIsolatedCountry) || IsolationsPerCountry[country] > IsolationsPerCountry[MostIsolatedCountry])
                {
                    MostIsolatedCountry = country;
                }
            }
        }