darwin.domain
Class Operation

java.lang.Object
  extended bydarwin.domain.Operation

public class Operation
extends java.lang.Object

This class represents operations in a Darwin Program. It is an enumeration of all valid operations.


Field Summary
static Operation GO
          Jump to a new address.
static Operation HOP
          Move forward if the space ahead is empty.
static Operation IFEMPTY
          If the square in front of this creature is empty, update the next address.
static Operation IFENEMY
          If the square in front of this creature is occupied by a creature of an enemy species, update the next address.
static Operation IFRANDOM
          Update the address half the time.
static Operation IFSAME
          If the square in front of this creature is occupied by a creature of the same species, update the next address.
static Operation IFWALL
          If the creature is facing the border of the world, update the next address.
static Operation INFECT
          Infect the creature immediately in front of this creature.
static Operation LEFT
          Turn left 90 degrees.
static Operation RIGHT
          Turn right 90 degrees.
 
Method Summary
 boolean equals(java.lang.Object aObject)
          Override-prevention method.
static Operation getOperation(java.lang.String aOperationName)
          Find an Operation by its name.
 int hashCode()
          Override-prevention method.
 java.lang.String toString()
          Return a String representation of this Operation.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

GO

public static final Operation GO
Jump to a new address.


HOP

public static final Operation HOP
Move forward if the space ahead is empty.


IFEMPTY

public static final Operation IFEMPTY
If the square in front of this creature is empty, update the next address.


IFENEMY

public static final Operation IFENEMY
If the square in front of this creature is occupied by a creature of an enemy species, update the next address.


IFRANDOM

public static final Operation IFRANDOM
Update the address half the time.


IFSAME

public static final Operation IFSAME
If the square in front of this creature is occupied by a creature of the same species, update the next address.


IFWALL

public static final Operation IFWALL
If the creature is facing the border of the world, update the next address.


INFECT

public static final Operation INFECT
Infect the creature immediately in front of this creature.


LEFT

public static final Operation LEFT
Turn left 90 degrees.


RIGHT

public static final Operation RIGHT
Turn right 90 degrees.

Method Detail

getOperation

public static Operation getOperation(java.lang.String aOperationName)
Find an Operation by its name.

Parameters:
aOperationName - the name of the Operation. The name is case sensitive. E.g. "go".
Returns:
the Operation with name aOperationName.

equals

public final boolean equals(java.lang.Object aObject)
Override-prevention method.


hashCode

public final int hashCode()
Override-prevention method.


toString

public java.lang.String toString()
Return a String representation of this Operation.

Returns:
the name of this Operation.