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

java.lang.Object
  extended by edu.columbia.cs.coms4701.agent.environments.robot.RoombaSuccessPercept
All Implemented Interfaces:
AgentPercept, RobotPercept, RobotSuccessPercept

public class RoombaSuccessPercept
extends java.lang.Object
implements RobotSuccessPercept

Represents a success-or-not percept received by the Roomba robot from its environment.

The percept is a simple indication of success or failure of the last attempted action. If the action succeeded, you can assume that your robot successfully changed position. If the action failed, you can obtain additional information about

Version:
0.1

User: aaron Date: Aug 25, 2006 Time: 1:47:43 PM

Author:
aaron@cs

Nested Class Summary
 
Nested classes/interfaces inherited from interface edu.columbia.cs.coms4701.agent.environments.robot.RobotSuccessPercept
RobotSuccessPercept.ReasonForFailure
 
Constructor Summary
RoombaSuccessPercept()
          Constructs a new percept of success.
RoombaSuccessPercept(java.lang.Boolean success, RobotSuccessPercept.ReasonForFailure reasonForFailure)
          Constructs a new percept with the given success and reason for failure (possibly null).
 
Method Summary
 RobotSuccessPercept.ReasonForFailure getReasonForFailure()
          Indicates the reason for the failure of an attempted move.
 java.lang.String toString()
           
 java.lang.Boolean wasSuccessful()
          Indicates whether the last action attempted by the robot was successful or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RoombaSuccessPercept

public RoombaSuccessPercept(java.lang.Boolean success,
                            RobotSuccessPercept.ReasonForFailure reasonForFailure)
Constructs a new percept with the given success and reason for failure (possibly null).

Parameters:
success - whether the last action was successful
reasonForFailure - if not, why. (will be null if success is true)

RoombaSuccessPercept

public RoombaSuccessPercept()
Constructs a new percept of success.

Method Detail

wasSuccessful

public java.lang.Boolean wasSuccessful()
Indicates whether the last action attempted by the robot was successful or not.

Specified by:
wasSuccessful in interface RobotSuccessPercept
Returns:
true if the robot's last chosen action succeeded, i.e. the robot can assume it has moved squares; false otherwise.

getReasonForFailure

public RobotSuccessPercept.ReasonForFailure getReasonForFailure()
Indicates the reason for the failure of an attempted move.

Should return null if the move was *not* a failure

Specified by:
getReasonForFailure in interface RobotSuccessPercept
Returns:
HitObstacle if the destination square contained an obstacle, and IllegalMove if the move was invalid (e.g. would go beyond boundaries)

toString

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