// Find the best matches, ensuring one entry for every element in ones public static IEnumerable <PairResult> LeftMatch(IEnumerable <T> ones, IEnumerable <T> twos, MatchScorer scorer, object objshr) { MatchShared shared = new MatchShared(); shared.objshr = objshr; shared.matches = new Memoizer <T, PairResult>(MatchOneRow); shared.comparisons = new Memoizer <TwoTuple <T, T>, double>(MatchComparison); shared.scorer = scorer; shared.ones = ones; shared.twos = twos; foreach (T one in ones) { shared.matches.Evaluate(one, shared); } return(shared.matches.Results.Values); }
private static void ProcessScorers(Match match, HattrickDataMatch htMatch) { foreach (var matchScorer in htMatch.MatchScorers) { int scorerTeamId = int.Parse(matchScorer.ScorerTeamID); bool isHomeScorer = match.MatchHomeTeam.Team.TeamId == scorerTeamId; var scorer = new MatchScorer { OppositionGoals = isHomeScorer ? short.Parse(matchScorer.ScorerAwayGoals) : short.Parse(matchScorer.ScorerHomeGoals), TeamGoals = isHomeScorer ? short.Parse(matchScorer.ScorerHomeGoals) : short.Parse(matchScorer.ScorerAwayGoals), PlayerId = int.Parse(matchScorer.ScorerPlayerID), PlayerName = matchScorer.ScorerPlayerName, ScorerMinute = short.Parse(matchScorer.ScorerMinute) }; if (isHomeScorer) match.AddHomeMatchScorer(scorer); else match.AddAwayMatchScorer(scorer); } }