edu.columbia.cs.coms4701.agent.environments.robot
Class RoombaAction

java.lang.Object
  extended by edu.columbia.cs.coms4701.agent.environments.robot.RoombaAction
All Implemented Interfaces:
AgentAction, RobotAction

public class RoombaAction
extends java.lang.Object
implements RobotAction

Represents available actions for a RoombaAgent.

The nine possible actions are available as static fields, named NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, NORTHWEST and STOP.

For your convenience, an additional field ACTIONS contains an array of the eight ordinary actions, to make it easier to iterate over the possibilities.

You may also specify an action by using the public constructor, e.g. calling new RoombaAction(0,-1) to go south.

Each action can be inspected by the #getVector() method, which specifies the x- and y-delta (via GeometricVector#getComponent(X_DIM) etc.)

Version:
0.1

User: aaron Date: Aug 25, 2006 Time: 1:21:42 PM

Author:
aaron@cs

Field Summary
static RobotAction[] ACTIONS
           
static RobotAction EAST
           
static RobotAction NORTH
           
static RobotAction NORTHEAST
           
static RobotAction NORTHWEST
           
static RobotAction SOUTH
           
static RobotAction SOUTHEAST
           
static RobotAction SOUTHWEST
           
static RobotAction STOP
           
static RobotAction WEST
           
 
Constructor Summary
RoombaAction(int x, int y)
          Creates a new RoombaAction for a move with the specified x- and y- delta.
 
Method Summary
 DiscreteVector getVector()
          Returns the 2-D vector specifying the chosen motion.
 boolean shouldStop()
          Indicates whether the robot wants to stop.
 java.lang.String toString()
          AgentActions should override toString() to provide a reasonable short description.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NORTH

public static final RobotAction NORTH

NORTHEAST

public static final RobotAction NORTHEAST

EAST

public static final RobotAction EAST

SOUTHEAST

public static final RobotAction SOUTHEAST

SOUTH

public static final RobotAction SOUTH

SOUTHWEST

public static final RobotAction SOUTHWEST

WEST

public static final RobotAction WEST

NORTHWEST

public static final RobotAction NORTHWEST

STOP

public static final RobotAction STOP

ACTIONS

public static final RobotAction[] ACTIONS
Constructor Detail

RoombaAction

public RoombaAction(int x,
                    int y)
Creates a new RoombaAction for a move with the specified x- and y- delta.

For example, to go north, call new RoombaAction(0,1).

Parameters:
x - direction delta (-1,0, or 1)
y - direction delta (-1,0, or 1)
Method Detail

toString

public java.lang.String toString()
Description copied from interface: AgentAction
AgentActions should override toString() to provide a reasonable short description.

Specified by:
toString in interface AgentAction
Overrides:
toString in class java.lang.Object
Returns:
a simple description of the action

getVector

public DiscreteVector getVector()
Returns the 2-D vector specifying the chosen motion.

Specified by:
getVector in interface RobotAction
Returns:
the vector (which should be 2D)

shouldStop

public boolean shouldStop()
Indicates whether the robot wants to stop.

Specified by:
shouldStop in interface RobotAction
Returns:
true if the robot thinks it's done.