battlecode.common
Enum Team

java.lang.Object
  extended by java.lang.Enum<Team>
      extended by 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.


Enum Constant Summary
A
           
B
           
NEUTRAL
           
 
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.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

A

public static final Team A

B

public static final Team B

NEUTRAL

public static final Team NEUTRAL
Method Detail

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