Package robocode.control.snapshot
Enum BulletState
- java.lang.Object
-
- java.lang.Enum<BulletState>
-
- robocode.control.snapshot.BulletState
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<BulletState>
public enum BulletState extends java.lang.Enum<BulletState>
Defines a bullet state, which can be: just fired, moving somewhere, hitting a victim, hitting another bullet, hitting the wall, exploded, or inactive.- Since:
- 1.6.2
- Author:
- Flemming N. Larsen (original)
-
-
Enum Constant Summary
Enum Constants Enum Constant Description EXPLODED
The bullet currently represents a robot explosion, i.e.FIRED
The bullet has just been fired this turn and hence just been created.HIT_BULLET
The bullet has hit another bullet.HIT_VICTIM
The bullet has hit a robot victim.HIT_WALL
The bullet has hit the wall, i.e.INACTIVE
The bullet is currently inactive.MOVING
The bullet is now moving across the battlefield, but has not hit anything yet.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getValue()
Returns the state as an integer value.boolean
isActive()
static BulletState
toState(int value)
Returns a BulletState based on an integer value that represents a BulletState.static BulletState
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static BulletState[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
FIRED
public static final BulletState FIRED
The bullet has just been fired this turn and hence just been created. This state only last one turn.
-
MOVING
public static final BulletState MOVING
The bullet is now moving across the battlefield, but has not hit anything yet.
-
HIT_VICTIM
public static final BulletState HIT_VICTIM
The bullet has hit a robot victim.
-
HIT_BULLET
public static final BulletState HIT_BULLET
The bullet has hit another bullet.
-
HIT_WALL
public static final BulletState HIT_WALL
The bullet has hit the wall, i.e. one of the four borders of the battlefield.
-
EXPLODED
public static final BulletState EXPLODED
The bullet currently represents a robot explosion, i.e. a robot death.
-
INACTIVE
public static final BulletState INACTIVE
The bullet is currently inactive. Hence, it is not active or visible on the battlefield.
-
-
Method Detail
-
values
public static BulletState[] 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 (BulletState c : BulletState.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static BulletState valueOf(java.lang.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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getValue
public int getValue()
Returns the state as an integer value.- Returns:
- an integer value representing this state.
- See Also:
toState(int)
-
toState
public static BulletState toState(int value)
Returns a BulletState based on an integer value that represents a BulletState.- Parameters:
value
- the integer value that represents a specific BulletState.- Returns:
- a BulletState that corresponds to the specific integer value.
- Throws:
java.lang.IllegalArgumentException
- if the specified value does not correspond to a BulletState and hence is invalid.- See Also:
getValue()
-
isActive
public boolean isActive()
-
-