Package components.program
Enum Class Program.Instruction
- All Implemented Interfaces:
Serializable
,Comparable<Program.Instruction>
,Constable
- Enclosing interface:
Program
BugsWorld virtual machine instructions and "byte codes".
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionByte code = 5.Byte code = 3.Byte code = 6.Byte code = 7.Byte code = 13.Byte code = 11.Byte code = 8.Byte code = 14.Byte code = 12.Byte code = 10.Byte code = 9.Byte code = 15.Byte code = 16.Byte code = 0.Byte code = 4.Byte code = 1.Byte code = 2. -
Method Summary
Modifier and TypeMethodDescriptionint
byteCode()
Returns the instruction byte code.static Program.Instruction
Returns the enum constant of this class with the specified name.static Program.Instruction[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
MOVE
Byte code = 0. -
TURNLEFT
Byte code = 1. -
TURNRIGHT
Byte code = 2. -
INFECT
Byte code = 3. -
SKIP
Byte code = 4. -
HALT
Byte code = 5. -
JUMP
Byte code = 6. -
JUMP_IF_NOT_NEXT_IS_EMPTY
Byte code = 7. -
JUMP_IF_NOT_NEXT_IS_NOT_EMPTY
Byte code = 8. -
JUMP_IF_NOT_NEXT_IS_WALL
Byte code = 9. -
JUMP_IF_NOT_NEXT_IS_NOT_WALL
Byte code = 10. -
JUMP_IF_NOT_NEXT_IS_FRIEND
Byte code = 11. -
JUMP_IF_NOT_NEXT_IS_NOT_FRIEND
Byte code = 12. -
JUMP_IF_NOT_NEXT_IS_ENEMY
Byte code = 13. -
JUMP_IF_NOT_NEXT_IS_NOT_ENEMY
Byte code = 14. -
JUMP_IF_NOT_RANDOM
Byte code = 15. -
JUMP_IF_NOT_TRUE
Byte code = 16.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException
- if the argument is null
-
byteCode
Returns the instruction byte code.- Returns:
- the instruction byte code
-