// Methods public HashSearchTextStream(Stream stream, HashProviderDelegate hashProvider, MatchProviderDelegate matchProvider) : base(stream) { this._hashProvider = hashProvider; this._matchProvider = matchProvider; this.Initialize(); }
public HashSearchTextStream(string path, HashProviderDelegate hashProvider, MatchProviderDelegate matchProvider) : this(new FileStream(path, FileMode.OpenOrCreate), hashProvider, matchProvider) { }
private static int CompareDirectConfrontationPoints(TeamDayResult a, TeamDayResult b, MatchProviderDelegate matchesProvider) { return(0); }
private static int CompareGamesWon(TeamDayResult a, TeamDayResult b, MatchProviderDelegate p) { return(b.GamesWon - a.GamesWon); }
private static int CompareDirectConfrontationPointDiff(TeamDayResult a, TeamDayResult b, MatchProviderDelegate matchesProvider) { if (matchesProvider == null) { throw new Exception("Error.NoMatchComparerProvider"); } var matches = matchesProvider(a.IdTeam, b.IdTeam); if (matches.Count() == 0) { return(0); } // Go through the list of matches, sum points, return diff var teamAPoints = 0; var teamBPoints = 0; foreach (var m in matches) { teamAPoints += (m.IdHomeTeam == a.IdTeam) ? m.HomeScore : m.VisitorScore; teamBPoints += (m.IdHomeTeam == b.IdTeam) ? m.HomeScore : m.VisitorScore; } return(teamBPoints - teamAPoints); }
private static int ComparePointDiff(TeamDayResult a, TeamDayResult b, MatchProviderDelegate p) { return(b.PointDiff - a.PointDiff); }
// __ Comparison algorithms ___________________________________________ private static int CompareTournamentPoints(TeamDayResult a, TeamDayResult b, MatchProviderDelegate p) { return(b.TournamentPoints - a.TournamentPoints); }
public ClassificationSorter(int[] orderCriteria, MatchProviderDelegate matchResultProvider) { mOrderCriteria = orderCriteria; mMatchProvider = matchResultProvider; }
private static int ComparePoints(TeamDayResult a, TeamDayResult b, MatchProviderDelegate matchesProvider) { return(b.Points - a.Points); }
public static IEnumerable <TeamDayResult> SortClassification(IEnumerable <TeamDayResult> accumulatedTeamDays, int[] orderCriteria, MatchProviderDelegate matchProvider = null) { var comparer = new ClassificationSorter(orderCriteria, matchProvider); var result = accumulatedTeamDays.OrderBy <TeamDayResult, TeamDayResult>(t => t, comparer); return(result.ToList()); // Enumerate to execute sorting before returning. }