battlecode.common
Enum Team
java.lang.Object
java.lang.Enum<Team>
battlecode.common.Team
- All Implemented Interfaces:
- Serializable, Comparable<Team>
public enum Team
- extends Enum<Team>
This enum represents the team of a GameObject; each GameObject has
exactly one team. Robots are either on team A or B, while objects like
mines are neutral.
Since Team is a Java 1.5 enum, you can use it in switch
statements, it has all the standard enum methods (valueOf
,
values
, etc.), and you can safely use ==
for
equality tests.
Method Summary |
Team |
opponent()
Determines the team that is the opponent of this team. |
static Team |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static Team[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared. |
A
public static final Team A
B
public static final Team B
NEUTRAL
public static final Team NEUTRAL
values
public static Team[] values()
- Returns an array containing the constants of this enum type, in
the order they are declared. This method may be used to iterate
over the constants as follows:
for (Team c : Team.values())
System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in
the order they are declared
valueOf
public static Team valueOf(String name)
- Returns the enum constant of this type with the specified name.
The string must match exactly an identifier used to declare an
enum constant in this type. (Extraneous whitespace characters are
not permitted.)
- Parameters:
name
- the name of the enum constant to be returned.
- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is null
opponent
public Team opponent()
- Determines the team that is the opponent of this team.
- Returns:
- the opponent of this team, or NEUTRAL if this team
is NEUTRAL