pacworld
Class Pickup

java.lang.Object
  extended by agent.Action
      extended by pacworld.Pickup

public class Pickup
extends Action

A package delivery agent action that causes the agent to pickup a package that is located next to the agent in the specified direction.


Constructor Summary
Pickup(int d)
           
 
Method Summary
 State execute(Agent agent, State s)
          Return the state that results from the agent picking up a package in the given direction.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pickup

public Pickup(int d)
Method Detail

execute

public State execute(Agent agent,
                     State s)
Return the state that results from the agent picking up a package in the given direction. In order to avoid creating unnecessary objects, we do not create a new state, but instead modify the old one. This would have to change if the Environment needs to maintain a history of states.

Specified by:
execute in class Action

toString

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