예제 #1
0
 public static IEnumerable <Func <Tuple <uint, EntryType> > > MapCalcEntryTypeFunc(
     this IEnumerable <Tuple <uint, string> > source,
     IValueExtractor valueExtractor, Dictionary <uint, EntryType> entryTypes)
 {
     foreach (var(item1, item2) in source)
     {
         yield return(() =>
         {
             var candidates = new List <Tuple <uint, EntryType> > {
                 Tuple.Create(item1, EntryType.Noise())
             };
             foreach (var pair in entryTypes)
             {
                 if (valueExtractor.IsMatchSuccess(pair.Value, item2))
                 {
                     candidates.Add(Tuple.Create <uint, EntryType>(item1, pair.Value));
                 }
             }
             return candidates.OrderBy(x => x.Item2.Priority).First();
         });
     }
 }
예제 #2
0
 public static Func <IValueExtractor, IDataService, INoiseEntry> CreateNoiseEntryFunc(uint lineNumber)
 {
     return((extractor, data) => new NoiseEntry(new Entry(EntryType.Noise(), lineNumber), extractor, data));
 }