Ejemplo n.º 1
0
 // Methods
 public HashSearchTextStream(Stream stream, HashProviderDelegate hashProvider, MatchProviderDelegate matchProvider)
     : base(stream)
 {
     this._hashProvider  = hashProvider;
     this._matchProvider = matchProvider;
     this.Initialize();
 }
Ejemplo n.º 2
0
 public HashSearchTextStream(string path, HashProviderDelegate hashProvider, MatchProviderDelegate matchProvider)
     : this(new FileStream(path, FileMode.OpenOrCreate), hashProvider, matchProvider)
 {
 }
Ejemplo n.º 3
0
 private static int CompareDirectConfrontationPoints(TeamDayResult a, TeamDayResult b, MatchProviderDelegate matchesProvider)
 {
     return(0);
 }
Ejemplo n.º 4
0
 private static int CompareGamesWon(TeamDayResult a, TeamDayResult b, MatchProviderDelegate p)
 {
     return(b.GamesWon - a.GamesWon);
 }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
 private static int ComparePointDiff(TeamDayResult a, TeamDayResult b, MatchProviderDelegate p)
 {
     return(b.PointDiff - a.PointDiff);
 }
Ejemplo n.º 7
0
        // __ Comparison algorithms ___________________________________________


        private static int CompareTournamentPoints(TeamDayResult a, TeamDayResult b, MatchProviderDelegate p)
        {
            return(b.TournamentPoints - a.TournamentPoints);
        }
Ejemplo n.º 8
0
 public ClassificationSorter(int[] orderCriteria, MatchProviderDelegate matchResultProvider)
 {
     mOrderCriteria = orderCriteria;
     mMatchProvider = matchResultProvider;
 }
Ejemplo n.º 9
0
 private static int ComparePoints(TeamDayResult a, TeamDayResult b, MatchProviderDelegate matchesProvider)
 {
     return(b.Points - a.Points);
 }
Ejemplo n.º 10
0
        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.
        }