Class ChangeTargetOnCollision
-
- All Implemented Interfaces:
-
it.unibo.alchemist.model.movestrategies.TargetSelectionStrategy
,java.io.Serializable
public abstract class ChangeTargetOnCollision<T extends Object, P extends Position<P>> implements TargetSelectionStrategy<T, P>
Base class for TargetSelectionStrategy offering automatic target change on collision and utilities for initialization. getCurrentPosition should return the current position of the object to move. P is the position type to use.
-
-
Constructor Summary
Constructors Constructor Description ChangeTargetOnCollision(Function0<P> getCurrentPosition)
-
Method Summary
Modifier and Type Method Description P
getTarget()
abstract ChangeTargetOnCollision<T, P>
cloneIfNeeded(Node<T> destination, Reaction<T> reaction)
-
-
Constructor Detail
-
ChangeTargetOnCollision
ChangeTargetOnCollision(Function0<P> getCurrentPosition)
-
-
Method Detail
-
cloneIfNeeded
abstract ChangeTargetOnCollision<T, P> cloneIfNeeded(Node<T> destination, Reaction<T> reaction)
- Returns:
A copy of the strategy if the strategy is stateful, and this object otherwise. The default implementation assumes a stateless strategy.
-
-
-
-