wworld
Class MovingObject

java.lang.Object
  |
  +--wworld.WorldObject
        |
        +--wworld.GridObject
              |
              +--wworld.MovingObject
Direct Known Subclasses:
Actor

public class MovingObject
extends GridObject

The class specifying object MovingObject. This object extends GridObject and additionally specifies the orientation of the object. This class is extended by Agent and Wumpus object classes.


Constructor Summary
MovingObject(int objType, int x, int y, int o)
          Constructor
 
Method Summary
 int getOrientation()
          Returns the current direction of the object as integer.
 Directions getOrientationDirection()
          Returns the current direction of the object as Directions.
 int getOrigOrientation()
          Returns the original direction or facing of the object.
 void move()
          Performs the move action (going forward action).
 void setOrientation(int o)
          Sets the direction or facing of the object.
 void turnLeft()
          Performs the left turn and sets the new location and orientation of the object.
 void turnRight()
          Performs the right turn and sets the new location and orientation of the object.
 
Methods inherited from class wworld.GridObject
getLocation, getOrigLocation, setLocation, setLocation
 
Methods inherited from class wworld.WorldObject
getType, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MovingObject

public MovingObject(int objType,
                    int x,
                    int y,
                    int o)
Constructor

Method Detail

getOrientation

public int getOrientation()
Returns the current direction of the object as integer.


getOrientationDirection

public Directions getOrientationDirection()
Returns the current direction of the object as Directions.


setOrientation

public void setOrientation(int o)
Sets the direction or facing of the object.


getOrigOrientation

public int getOrigOrientation()
Returns the original direction or facing of the object.


turnRight

public void turnRight()
Performs the right turn and sets the new location and orientation of the object.


turnLeft

public void turnLeft()
Performs the left turn and sets the new location and orientation of the object.


move

public void move()
Performs the move action (going forward action). The result of the action is dependent on the current location and the current orientation of the object. Also, sets the new Location of the object after the move.