Inheritance: ScoringContext
Beispiel #1
0
 public ISetState GetDecidingSetState(TennisSet set)
 {
     return new SetStateTieBreakScoring(set);
 }
Beispiel #2
0
 public ISetState GetStandardSetState(TennisSet set)
 {
     return new SetStateTieBreakScoring(set);
 }
Beispiel #3
0
        public void AddPoint(Party party)
        {
            if (_matchState.MatchOver)
                throw new InvalidOperationException("Cannot add points to won matches.");

            _currentSet.AddPoint(party);

            if (_currentSet.SetOver)
            {
                IncreaseScore(party);
                _matchState = _matchState.SetAdded(party);

                if (!_matchState.MatchOver)
                    _currentSet = _matchState.GetNextSet(_tournamentRules);
            }
        }
Beispiel #4
0
 public ISetState GetDecidingSetState(TennisSet set)
 {
     return new SetStateAdvantageScoring(set);
 }
Beispiel #5
0
 public TennisMatch(ITournamentRules tournamentRules, Func<TennisMatch, IMatchState> matchStateFactory)
     : base(new Party("A"), new Party("B"))
 {
     _tournamentRules = tournamentRules;
     _matchState = matchStateFactory(this);
     _currentSet = _matchState.GetNextSet(tournamentRules);
 }
Beispiel #6
0
 public SetStateWon(TennisSet set, Party winningParty)
 {
     _set = set;
     _winningParty = winningParty;
 }
Beispiel #7
0
 public SetStateTieBreakScoring(TennisSet set)
     : base(set)
 {
 }
Beispiel #8
0
 protected SetStateBase(TennisSet set)
 {
     Set = set;
 }
Beispiel #9
0
 public SetStateAdvantageScoring(TennisSet set)
     : base(set)
 {
 }