Class InteractWithOthers

  • All Implemented Interfaces:
    it.unibo.alchemist.model.movestrategies.SpeedSelectionStrategy , java.io.Serializable

    
    public final class InteractWithOthers<T, P extends Position<out P>>
     implements SpeedSelectionStrategy<T, P>
                        

    This strategy slows down nodes depending on how many "interacting" nodes are found in the surroundings. It is an attempt at modeling crowding slow-downs.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

      • InteractWithOthers

        InteractWithOthers(Environment<T, P> environment, Node<T> n, Reaction<T> reaction, Molecule interactingMolecule, double speed, double radius, double interaction)
        Parameters:
        environment - the environment
        n - the node
        reaction - the reaction
        interactingMolecule - the molecule that identifies an interacting node
        speed - the normal speed of the node
        radius - the radius where to search for interacting nodes
        interaction - the interaction factor.
    • Method Detail

      • getNodeMovementLength

         double getNodeMovementLength(P target)
        Parameters:
        target - the Position describing where the Node is directed
        Returns:

        the current node's movement. The returned value represents a length.

      • cloneIfNeeded

         SpeedSelectionStrategy<T, P> cloneIfNeeded(Node<T> destination, Reaction<T> reaction)
        Parameters:
        destination - the Node where the strategy is being cloned
        reaction - the Reaction where strategy is being cloned
        Returns:

        A copy of the strategy if the strategy is stateful, and this object otherwise. The default implementation assumes a stateless strategy.