java.lang.Object | |
↳ | uk.ac.imperial.presage2.util.location.MoveHandler |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
environment | |||||||||||
serviceProvider | |||||||||||
sharedState |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Check if this Handler can handle the given action.
| |||||||||||
Processes a
Move action. |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
uk.ac.imperial.presage2.core.environment.ActionHandler
|
UnavailableServiceException |
---|
Check if this Handler can handle the given action.
action | Action to handle |
---|
Processes a Move
action.
In the case of a basic Move
we do a vector addition of the
agent's current location with the move to determine a resultant location.
This is then passed to the LocationService
to update the agent's
location. If the resultant location is not in the simulation Area
we ask the area for a valid version of the move and apply that instead.
In the case of a CellMove
we simply check the destination cell,
and if it's empty we set the new location through the
LocationService
. Otherwise we throw an
ActionHandlingException
.
action | action to handle |
---|---|
actor | actor performing this action |
ActionHandlingException |
---|