Ejemplo n.º 1
0
 public NoSetWinnerException(TMatch.Match match, int set) : base(match)
 {
     this.set = set;
     if (set != 3)
     {
         scoreRequired = 21;
     }
     else
     {
         scoreRequired = 15;
     }
 }
Ejemplo n.º 2
0
 public void AddMatch(TMatch.Match match)
 {
     //this checks whether or not one of the teams specified are already playing someone this round
     for (int i = 0; i < listMatches.Count; i++)
     {
         if (listMatches[i].IsPlaying(match.TeamA))
         {
             throw new AlreadyPlayingInRoundException(CreateCopy(), match, match.TeamA);
         }
         if (listMatches[i].IsPlaying(match.TeamB))
         {
             throw new AlreadyPlayingInRoundException(CreateCopy(), match, match.TeamB);
         }
     }
     listMatches.Add(match);
 }
Ejemplo n.º 3
0
 public TooHighScoreException(TMatch.Match match) : base(match)
 {
 }
Ejemplo n.º 4
0
 public NegativeScoreException(TMatch.Match match) : base(match)
 {
 }
Ejemplo n.º 5
0
 public NonIntScoreException(TMatch.Match match) : base(match)
 {
 }
Ejemplo n.º 6
0
 public ThirdSetException(TMatch.Match match, TTeam.ITeam winner) : base(match)
 {
     this.winner = winner;
 }
Ejemplo n.º 7
0
 public AlreadyPlayingInLeagueException(TRound.League league, TMatch.Match match) : base(league)
 {
     this.match = match;
 }
Ejemplo n.º 8
0
 public NotIntPlayersException(TMatch.Match match) : base(match)
 {
 }
Ejemplo n.º 9
0
 public NegativePlayersNumberException(TMatch.Match match) : base(match)
 {
 }
Ejemplo n.º 10
0
 public NotNumberMatchLengthException(TMatch.Match match) : base(match)
 {
 }
Ejemplo n.º 11
0
 public NegativeMatchLengthException(TMatch.Match match) : base(match)
 {
 }
Ejemplo n.º 12
0
 public SetResultForWalkoverException(TMatch.Match match) : base(match)
 {
 }
Ejemplo n.º 13
0
 public WinnerIsNotPlayingException(TMatch.Match match) : base(match)
 {
 }
Ejemplo n.º 14
0
 public AlreadyPlayingInRoundException(TRound.Round round, TMatch.Match match, TTeam.ITeam team) : base(round)
 {
     this.match = match;
     this.team  = team;
 }
Ejemplo n.º 15
0
 public WrongStatFormatException(TMatch.Match match) : base(match)
 {
 }
Ejemplo n.º 16
0
 public TooHighPlayersLeftException(TMatch.Match match) : base(match)
 {
 }
Ejemplo n.º 17
0
 public WrongWinnerException(TMatch.Match match, TTeam.ITeam winner) : base(match)
 {
     supposedWinner = winner;
 }
Ejemplo n.º 18
0
 public WrongNameInStatException(TMatch.Match match, string name) : base(match)
 {
     this.name = name;
 }
Ejemplo n.º 19
0
 //this is for manual scheduling
 public void ScheduleMatch(TMatch.Match match, int[] date)
 {
     for (int i = 0; i < teams.Count; i++)
     {
         Boolean flagA   = false;
         Boolean flagB   = false;
         Boolean flagAnB = false;
         if (rounds.Capacity >= rounds.Count + 1)
         {
             flagAnB = true;
         }
         if (rounds.Capacity - rounds.Count >= 2)
         {
             flagA = true;
         }
         for (int j = 0; j < rounds.Count; j++)
         {
             /*
              * We have to check 3 things for each team:
              * 1. Is that team one of the teams participating in the match
              * 2. If not, has this team already played against both teams from match
              * 3. If not, can this team play the teams he has not played with in other round(s)
              *
              * Additionally, for both teams participating in the match we have to check n things
              * 1. Have they already played against each other
              * 2. Are they already playing against someone else in that round (checked by round)
              */
             if (rounds[j].IsScheduled(match.TeamA, match.TeamB))
             {
                 throw new AlreadyPlayingInLeagueException(CreateCopy(), match);
             }
             if (!match.IsPlaying(teams[i]))
             {
                 //check if the team from table is already schedule to play a team from this match
                 if (rounds[j].IsScheduled(teams[i], match.TeamA))
                 {
                     flagA = true;
                 }
                 if (rounds[j].IsScheduled(teams[i], match.TeamB))
                 {
                     flagB = true;
                 }
                 //if not, we're checking can still play them, even if we schedule this match
                 if (!rounds[j].IsPlaying(match.TeamA) && !rounds[j].IsPlaying(teams[i]))
                 {
                     if (!rounds[j].IsPlaying(match.TeamB) && !rounds[j].IsPlaying(teams[i]) && flagAnB == false)
                     {
                         flagAnB = true;
                     }
                     else
                     {
                         flagA = true;
                     }
                 }
                 else
                 if (!rounds[j].IsPlaying(match.TeamB) && !rounds[j].IsPlaying(teams[i]))
                 {
                     flagB = true;
                 }
             }
         }
         if (((!flagAnB && !(flagA && flagB)) || !(flagA || flagB)) && !match.IsPlaying(teams[i]))
         {
             throw new ImpossibleScheduleException(CreateCopy());
         }
     }
     //If there exists a round played on this day, match will be added to said round
     for (int i = 0; i < rounds.Count; i++)
     {
         if (rounds[i].Date[0] == date[0] && rounds[i].Date[1] == date[1] && rounds[i].Date[2] == date[2])
         {
             try
             {
                 rounds[i].AddMatch(match);
             }
             catch (RoundRuntimeException e)
             {
                 rounds.Add(e.RecreateRound());
                 throw new ImpossibleScheduleException(CreateCopy());
             }
             return;
         }
     }
     //if not, we're creating a new round
     try
     {
         Round tmp = new Round("round played on " + date[0] + "/" + date[1] + "/" + date[2], date);
         tmp.AddMatch(match);
         rounds.Add(tmp);
     }
     catch (DateException)
     {
         throw new ImpossibleScheduleException(CreateCopy());
     }
 }
Ejemplo n.º 20
0
 public MatchRuntimeException(TMatch.Match match)
 {
     this.match = match;
 }