Package it.unibo.alchemist.model.actions
Class MoveForwardAndTeleport
-
- All Implemented Interfaces:
-
it.unibo.alchemist.model.Action
,java.io.Serializable
public final class MoveForwardAndTeleport<T, P extends Position2D<P>> extends AbstractMoveNode<T, P>
Moves the node along the x axis up to coordinate getMaxX, with steps of size getDeltaX. Once getMaxX is reached, the nodes gets teleported back to getMinX. Somewhat, it mimics the movement a node would have in a cylindrical environment.
-
-
Constructor Summary
Constructors Constructor Description MoveForwardAndTeleport(Environment<T, P> environment, Node<T> node, double deltaX, double minX, double maxX)
-
Method Summary
Modifier and Type Method Description MoveForwardAndTeleport<T, P>
cloneAction(Node<T> node, Reaction<T> reaction)
P
getNextPosition()
double
getMaxX()
double
getMinX()
double
getDeltaX()
-
Methods inherited from class it.unibo.alchemist.model.actions.AbstractMoveNode
execute, getContext
-
Methods inherited from class it.unibo.alchemist.model.actions.AbstractAction
getOutboundDependencies, toString
-
Methods inherited from class it.unibo.alchemist.model.Action
execute, getContext, getOutboundDependencies
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
MoveForwardAndTeleport
MoveForwardAndTeleport(Environment<T, P> environment, Node<T> node, double deltaX, double minX, double maxX)
- Parameters:
environment
- the environmentnode
- the nodedeltaX
- how far along the x axis the node should move each time the action is triggeredminX
- minimum x pointmaxX
- maximum x point
-
-
Method Detail
-
cloneAction
MoveForwardAndTeleport<T, P> cloneAction(Node<T> node, Reaction<T> reaction)
-
getNextPosition
P getNextPosition()
- Returns:
The next position where to move, in absolute or relative coordinates depending on the value of isAbsolute.
-
getMinX
double getMinX()
- Returns:
the minimum x coordinate, namely the teleport destination
-
getDeltaX
double getDeltaX()
- Returns:
the step size
-
-
-
-