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); }
private RankingEntry EntryFromClub(Club c) { foreach (RankingEntry entry in entries) if (entry.Club == c) return entry; return null; }
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; }
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)); }
public PointSystem.ITotal GetPoints(Club club) { return EntryFromClub(club).Points; }
public RankingEntry(Club club, PointSystem.ITotal points) { this.club = club; this.points = points; }
public Match(Club home, Club away, int hgoals, int agoals) { this.opponents = new Club[] { home, away }; this.goals = new int?[] { hgoals, agoals }; }
public PointSystem.ITotal GetPoints(Club club) { return(EntryFromClub(club).Points); }