Coverage Summary for Class: GameMode (it.polimi.ingsw.model)

Class Class, % Method, % Line, %
GameMode 100% (1/ 1) 100% (5/ 5) 100% (9/ 9)


1 package it.polimi.ingsw.model; 2  3 public enum GameMode { 4  5  /** 6  * Type of game modes 7  */ 8  TWO(2), THREE(3); 9  10  /** 11  * Players'number 12  */ 13  private final int playersNum; 14  15  /** 16  * Set players'number 17  * @param playersNum number of players 18  */ 19  private GameMode(int playersNum) { 20  this.playersNum = playersNum; 21  } 22  23  /** 24  * Get number of players 25  * @return Number of players 26  */ 27  public int getPlayersNum() { 28  return playersNum; 29  } 30  31  /** 32  * @param input the str that needed to be converted 33  * @return converted enum element, null if fail 34  */ 35  public static GameMode strConverter(String input) { 36  try { 37  return Enum.valueOf(GameMode.class, input.toUpperCase()); 38  } catch (Exception e) { 39  return null; 40  } 41  } 42 }