1 /** 2 * BaseUnrealEnvironment, an implementation of the environment interface standard that 3 * facilitates the connection between GOAL and the UT2004 engine. 4 * 5 * Copyright (C) 2012 BaseUnrealEnvironment authors. 6 * 7 * This program is free software: you can redistribute it and/or modify it under 8 * the terms of the GNU General Public License as published by the Free Software 9 * Foundation, either version 3 of the License, or (at your option) any later 10 * version. 11 * 12 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15 * details. 16 * 17 * You should have received a copy of the GNU General Public License along with 18 * this program. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 package nl.tudelft.goal.unreal.messages; 21 22 23 /** 24 * Enumerates the available teams. 25 * 26 * @author mpkorstanje 27 * 28 */ 29 public enum Team { 30 31 RED(0), BLUE(1), GREEN(2), GOLD(3), OTHER(255); 32 33 private final int team; 34 35 private Team(int team) { 36 this.team = team; 37 } 38 39 public int id() { 40 return team; 41 } 42 43 public static Team valueOfIgnoresCase(String teamString) { 44 return valueOf(teamString.toUpperCase()); 45 } 46 47 public static Team valueOf(int id) { 48 for (Team team : values()) { 49 if (id == team.id()) { 50 return team; 51 } 52 } 53 return OTHER; 54 } 55 }