public class MoveAction
extends jadex.commons.SimplePropertyObject
implements jadex.extension.envsupport.environment.ISpaceAction
Modifier and Type | Class and Description |
---|---|
static interface |
MoveAction.IMoveEvaluator
Interface for evaluating moves.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DIRECTION_DOWN
The move direction down.
|
static java.lang.String |
DIRECTION_LEFT
The move direction left.
|
static java.lang.String |
DIRECTION_NONE
Placeholder for "no move" action.
|
static java.lang.String |
DIRECTION_RIGHT
The move direction right.
|
static java.lang.String |
DIRECTION_UP
The move direction up.
|
static java.lang.String |
PARAMETER_DIRECTION
The move direction parameter.
|
static java.lang.String |
PROPERTY_LASTPOS
The last position property (only for hunters).
|
Constructor and Description |
---|
MoveAction() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
evaluateMoves(jadex.extension.envsupport.environment.space2d.Grid2D space,
jadex.extension.envsupport.math.IVector2 sourcepos,
MoveAction.IMoveEvaluator eval)
Get the best move.
|
static java.lang.String |
getAvoidanceDirection(jadex.extension.envsupport.environment.space2d.Grid2D space,
jadex.extension.envsupport.math.IVector2 sourcepos,
jadex.extension.envsupport.environment.ISpaceObject[] objects)
Move to stay away from the given objects.
|
static java.lang.String |
getDirection(jadex.extension.envsupport.environment.space2d.Grid2D space,
jadex.extension.envsupport.math.IVector2 sourcepos,
jadex.extension.envsupport.math.IVector2 targetpos)
Get the best way to go towards a direction.
|
static java.lang.String[] |
getPossibleDirections(jadex.extension.envsupport.environment.space2d.Grid2D space,
jadex.extension.envsupport.math.IVector2 sourcepos)
Get the possible moves.
|
java.lang.Object |
perform(java.util.Map parameters,
jadex.extension.envsupport.environment.IEnvironmentSpace space)
Performs the action.
|
addPropertyChangeListener, getProperties, getProperty, getPropertyNames, hasProperty, removePropertyChangeListener, setProperties, setProperty, toString
public static final java.lang.String PARAMETER_DIRECTION
public static final java.lang.String PROPERTY_LASTPOS
public static final java.lang.String DIRECTION_LEFT
public static final java.lang.String DIRECTION_RIGHT
public static final java.lang.String DIRECTION_UP
public static final java.lang.String DIRECTION_DOWN
public static final java.lang.String DIRECTION_NONE
public java.lang.Object perform(java.util.Map parameters, jadex.extension.envsupport.environment.IEnvironmentSpace space)
perform
in interface jadex.extension.envsupport.environment.ISpaceAction
parameters
- parameters for the actionspace
- the environment spacepublic static java.lang.String getDirection(jadex.extension.envsupport.environment.space2d.Grid2D space, jadex.extension.envsupport.math.IVector2 sourcepos, jadex.extension.envsupport.math.IVector2 targetpos)
space
- The 2D space to move in.sourcepos
- The source position.targetpos
- The target position.public static java.lang.String getAvoidanceDirection(jadex.extension.envsupport.environment.space2d.Grid2D space, jadex.extension.envsupport.math.IVector2 sourcepos, jadex.extension.envsupport.environment.ISpaceObject[] objects)
space
- The 2D space to move in.sourcepos
- The source position.objects
- The objects to avoid.public static java.lang.String evaluateMoves(jadex.extension.envsupport.environment.space2d.Grid2D space, jadex.extension.envsupport.math.IVector2 sourcepos, MoveAction.IMoveEvaluator eval)
space
- The 2D space to move in.sourcepos
- The source position.eval
- The move evaluator.public static java.lang.String[] getPossibleDirections(jadex.extension.envsupport.environment.space2d.Grid2D space, jadex.extension.envsupport.math.IVector2 sourcepos)
space
- The 2D space to move in.sourcepos
- The source position.