MatchList Group::matchList( Player a, Player b ) const { MatchList ml; for ( int i = 0; i < _matches.count(); i ++ ) { Match m = _matches.at( i ); if ( m.participated( a ) && m.participated( b ) ) { if ( !( m.playerA() == a ) ) { // right player order required m.swapPlayers(); } ml << m; } } return ml; }
/** \return earned rating for 'p' player. i.e. the sum of * earned points per each match. */ double Group::earnedRating( Player p ) const { double total = 0.0; for ( int i = 0; i < _matches.count(); i++) { Match m = _matches.at( i ); if ( m.participated( p ) && m.played() ) { total += m.earnedRating( p ); } } return total; }
/** Find all matches which player 'p' is participating. */ MatchList Group::matchList( Player p ) const { MatchList ml; for ( int i = 0; i < _matches.count(); i ++ ) { Match m = _matches.at( i ); if ( m.participated( p ) ) { ml << m; } } return ml; }