Package robocode.control.snapshot
Enum BulletState
- All Implemented Interfaces:
Serializable
,Comparable<BulletState>
,java.lang.constant.Constable
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)
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe bullet currently represents a robot explosion, i.e.The bullet has just been fired this turn and hence just been created.The bullet has hit another bullet.The bullet has hit a robot victim.The bullet has hit the wall, i.e.The bullet is currently inactive.The bullet is now moving across the battlefield, but has not hit anything yet. -
Method Summary
Modifier and TypeMethodDescriptionint
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
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 Details
-
FIRED
The bullet has just been fired this turn and hence just been created. This state only last one turn. -
MOVING
The bullet is now moving across the battlefield, but has not hit anything yet. -
HIT_VICTIM
The bullet has hit a robot victim. -
HIT_BULLET
The bullet has hit another bullet. -
HIT_WALL
The bullet has hit the wall, i.e. one of the four borders of the battlefield. -
EXPLODED
The bullet currently represents a robot explosion, i.e. a robot death. -
INACTIVE
The bullet is currently inactive. Hence, it is not active or visible on the battlefield.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
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 nameNullPointerException
- 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
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:
IllegalArgumentException
- if the specified value does not correspond to a BulletState and hence is invalid.- See Also:
-
isActive
public boolean isActive()
-