uk.ac.nott.cs.g54dia.library
Class MoveAction

java.lang.Object
  extended by uk.ac.nott.cs.g54dia.library.MoveAction
All Implemented Interfaces:
Action

public class MoveAction
extends java.lang.Object
implements Action

Action which moves the tanker one cell in a specified direction.


Field Summary
private  int direction
          Direction to move in.
private static java.lang.String[] DIRECTION
           
static int EAST
           
static int NORTH
           
static int NORTHEAST
           
static int NORTHWEST
           
static int SOUTH
           
static int SOUTHEAST
           
static int SOUTHWEST
           
static int WEST
           
 
Constructor Summary
MoveAction(int dir)
           
 
Method Summary
 void execute(Environment env, Tanker tanker)
          Execute the action for this Tanker in this Environment.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

direction

private int direction
Direction to move in.


NORTH

public static final int NORTH
See Also:
Constant Field Values

SOUTH

public static final int SOUTH
See Also:
Constant Field Values

EAST

public static final int EAST
See Also:
Constant Field Values

WEST

public static final int WEST
See Also:
Constant Field Values

NORTHEAST

public static final int NORTHEAST
See Also:
Constant Field Values

NORTHWEST

public static final int NORTHWEST
See Also:
Constant Field Values

SOUTHEAST

public static final int SOUTHEAST
See Also:
Constant Field Values

SOUTHWEST

public static final int SOUTHWEST
See Also:
Constant Field Values

DIRECTION

private static final java.lang.String[] DIRECTION
Constructor Detail

MoveAction

public MoveAction(int dir)
Method Detail

execute

public void execute(Environment env,
                    Tanker tanker)
             throws ActionFailedException
Description copied from interface: Action
Execute the action for this Tanker in this Environment.

Specified by:
execute in interface Action
Parameters:
env - The Environment that the Tanker inhabits.
tanker - The Tanker trying to perform this action.
Throws:
ActionFailedException - The action couldn't be performed.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object