<commit_before>﻿using System;
using System.Linq;
using System.Threading.Tasks;
using FftGuitarTuner.Data;
using System.Collections.Generic;

namespace FftGuitarTuner
{
    public class Notes
    {
        private readonly IRepository _noteService = new RepositoryService();
        private static Notes notes;
        private static IRepository _noteRepo = new RepositoryService();
        private IList<FftGuitarTuner.Data.Entities.Notes> _notesList = _noteRepo.GetAll().ToList();
        private static readonly string[] NoteNames = { "A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#" };
       
        protected Notes()
        {
        }

        public static Notes Instance()
        {
            return notes ?? (notes = new Notes());
        }

        public double GetFrequency(string note)
        {
            return _notesList.FirstOrDefault(n => n.Note == note).Frequency;
        }

        public string GetClosestNote(double freq)
        {
            var closest = _notesList.Select(n => n.Frequency).OrderBy(frequency => Math.Abs(freq - frequency)).First();
            return _notesList.FirstOrDefault(n => n.Frequency == closest).Note;
        }

        public string GetClosestNote2(double freq)<commit_msg>Delete unusable property in Notes class<commit_after>﻿using System;
using System.Linq;
using System.Threading.Tasks;
using FftGuitarTuner.Data;
using System.Collections.Generic;

namespace FftGuitarTuner
{
    public class Notes
    {
        private static Notes notes;
        private static IRepository _noteRepo = new RepositoryService();
        private IList<FftGuitarTuner.Data.Entities.Notes> _notesList = _noteRepo.GetAll().ToList();
        private static readonly string[] NoteNames = { "A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#" };
       
        protected Notes()
        {
        }

        public static Notes Instance()
        {
            return notes ?? (notes = new Notes());
        }

        public double GetFrequency(string note)
        {
            return _notesList.FirstOrDefault(n => n.Note == note).Frequency;
        }

        public string GetClosestNote(double freq)
        {
            var closest = _notesList.Select(n => n.Frequency).OrderBy(frequency => Math.Abs(freq - frequency)).First();
            return _notesList.FirstOrDefault(n => n.Frequency == closest).Note;
        }

        public string GetClosestNote2(double freq)
{'fraction_non_alphanumeric': 0.12178177360032694, 'fraction_numerical': 0.0008173273395995096, 'mean_word_length': 2.5426917510853837, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '201251', 'n_tokens_mistral': 720, 'n_tokens_neox': 706, 'n_words': 176}