| 
									
										
										
										
											2010-08-28 22:05:41 -04:00
										 |  |  | <?php | 
					
						
							|  |  |  | namespace Moserware\Skills; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  | require_once(dirname(__FILE__) . "/HashMap.php"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-28 22:05:41 -04:00
										 |  |  | class RatingContainer | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |     private $_playerToRating; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function __construct() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-09-25 18:25:56 -04:00
										 |  |  |         $this->_playerToRating = new HashMap(); | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-08-28 22:05:41 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     public function getRating($player) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |         return $this->_playerToRating->getValue($player); | 
					
						
							| 
									
										
										
										
											2010-08-28 22:05:41 -04:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function setRating($player, $rating) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |         return $this->_playerToRating->setValue($player, $rating); | 
					
						
							| 
									
										
										
										
											2010-08-28 22:05:41 -04:00
										 |  |  |     } | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     public function getAllPlayers() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |         return $this->_playerToRating->getAllKeys(); | 
					
						
							| 
									
										
										
										
											2010-08-28 22:05:41 -04:00
										 |  |  |     } | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     public function getAllRatings() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |         return $this->_playerToRating->getAllValues(); | 
					
						
							| 
									
										
										
										
											2010-08-28 22:05:41 -04:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function count() | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |         return \count($this->_playerToRating->count()); | 
					
						
							|  |  |  |     }     | 
					
						
							| 
									
										
										
										
											2010-08-28 22:05:41 -04:00
										 |  |  | } | 
					
						
							|  |  |  | ?>
 |