Beispiel #1
0
 public Ranking(PointSystem system, Club [] clubs)
 {
     this.system = system;
     this.entries=new RankingEntry[clubs.Length];
     for(int i=0; i<clubs.Length; i++)
         this.entries[i]=new RankingEntry(clubs[i], system.InitialPoints);
 }
Beispiel #2
0
 private RankingEntry EntryFromClub(Club c)
 {
     foreach (RankingEntry entry in entries)
         if (entry.Club == c)
             return entry;
     return null;
 }
Beispiel #3
0
 public Match(Club home, Club away, bool forfeitIsFromHome)
 {
     this.opponents = new Club[] { home, away };
     this.goals = forfeitIsFromHome
         ? new int?[] { null, 0 }
         : new int?[] { 0, null };
 }
 public MatchViewModel(IEnumerable<Club> clubs, Ranking ranking)
 {
     this._clubs = clubs;
     this._home = clubs.ElementAt(0);
     this._away = clubs.ElementAt(1);
     this._ranking = ranking;
     this._hgoals =
     this._agoals = 0;
 }
Beispiel #5
0
        static void Main(string[] args)
        {
            Club fcgb=new Club("FCGB");
            Club psg =new Club("PSG");
            Ranking ranking = new Ranking(FrenchLeague1PointSystem.Instance, new Club[] { fcgb, psg });

            ranking.Register(new Match(fcgb, psg, 2, 0));
            ranking.Register(new Match(psg, fcgb, 3, 0));
            for (int i = 0; i < 2; i++)
                Console.WriteLine("{0} : {1}", ranking.GetClub(i), ranking.GetPoints(i));
        }
Beispiel #6
0
 public PointSystem.ITotal GetPoints(Club club)
 {
     return EntryFromClub(club).Points;
 }
Beispiel #7
0
 public RankingEntry(Club club, PointSystem.ITotal points)
 {
     this.club = club;
     this.points = points;
 }
Beispiel #8
0
 public Match(Club home, Club away, int hgoals, int agoals)
 {
     this.opponents = new Club[] { home, away };
     this.goals = new int?[] { hgoals, agoals };
 }
Beispiel #9
0
 public PointSystem.ITotal GetPoints(Club club)
 {
     return(EntryFromClub(club).Points);
 }
Beispiel #10
0
 public RankingEntry(Club club, PointSystem.ITotal points)
 {
     this.club   = club;
     this.points = points;
 }
Beispiel #11
0
 public Match(Club home, Club away, int hgoals, int agoals)
 {
     this.opponents = new Club[] { home, away };
     this.goals     = new int?[] { hgoals, agoals };
 }