public void AddLevel1(string[] match, string[] actual) { var matched = Level1Matches(match[0]).FirstOrDefault(); if (matched != null) { level1Matches.Remove(matched); } Level1Match level1Match = new Level1Match(); level1Match.Level1 = actual[0]; level1Match.AltLevel1 = match[0]; level1Matches.Add(level1Match); }
private Level1Match SavedLevel1Match(CodedLocation location) { IEnumerable <Level1Match> matches = matchProvider.GetMatches(location.Name1).ToList(); int count = matches.Count(); if (count > 1) { // there must only be a max of one saved match for any given input. var msg = string.Format( "[{0}] matched names found for the input [{1}]", count, location.Name1); throw new InvalidOperationException(msg); } Level1Match match = matches.FirstOrDefault(); return(match); }
public MatchResult GetSavedMatchLevel1(string level1) { IEnumerable <Level1Match> matches = matchProvider.GetMatches(level1).ToList(); int count = matches.Count(); if (count > 1) { // there must only be a max of one saved match for any given input. var msg = string.Format( "[{0}] matched names found for the input [{1}]", count, level1); throw new InvalidOperationException(msg); } Level1Match match = matches.FirstOrDefault(); return(match != null ? new MatchResult(match.Level1, DefaultProbability) : null); }