<commit_before>﻿using EliteDangerousCore.EDSM;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EliteDangerousCore
{
    public static class SystemCache
    {
        private static Dictionary<long, ISystem> systemsByEdsmId = new Dictionary<long, ISystem>();
        private static Dictionary<string, List<ISystem>> systemsByName = new Dictionary<string, List<ISystem>>(StringComparer.InvariantCultureIgnoreCase);

        public static List<ISystem> GetSystemsByName(string name)
        {
            if (systemsByName.ContainsKey(name))
            {
                return systemsByName[name];
            }
            else
            {
                List<ISystem> systems = DB.SystemClassDB.GetSystemsByName(name);

                if (systems.Count != 0)
                {
                    systemsByName[name] = systems;

                    foreach (ISystem sys in systems)
                    {
                        if (sys.id_edsm > 0)
                        {
                            systemsByEdsmId[sys.id_edsm] = sys;
                        }
                    }
                }

                return systems;
            }
        }

        public static ISystem GetSystemByEdsmId(long id)
        {
            if (systemsByEdsmId.ContainsKey(id))
            {
                return systemsByEdsmId[id];
            }
            else
            {
                ISystem sys = DB.SystemClassDB.GetSystem(id, idtype: DB.SystemClassDB.SystemIDType.EdsmId);
                if (sys != null)
                {
                    systemsByEdsmId[id] = sys;
                }
                return sys;
            }
        }

        private static double SqDist(ISystem a, ISystem b)
        {
            double dx = a.x - b.x;
            double dy = a.y - b.y;
            double dz = a.z - b.z;
            return dx * dx + dy * dy + dz * dz;
        }
<commit_msg>(W3) remove some dead code<commit_after>﻿using EliteDangerousCore.EDSM;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EliteDangerousCore
{
    public static class SystemCache
    {
        private static Dictionary<long, ISystem> systemsByEdsmId = new Dictionary<long, ISystem>();
        private static Dictionary<string, List<ISystem>> systemsByName = new Dictionary<string, List<ISystem>>(StringComparer.InvariantCultureIgnoreCase);

{'fraction_non_alphanumeric': 0.08266773162939298, 'fraction_numerical': 0.0011980830670926517, 'mean_word_length': 1.6396206533192834, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '123204', 'n_tokens_mistral': 681, 'n_tokens_neox': 664, 'n_words': 150}