Class AbstractNeighborCondition

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

    
    public abstract class AbstractNeighborCondition<T>
    extends AbstractCondition<T>
                        

    Represents a condition on a neighbor. Formally this conditions is satisfied if at least one neighbor satisfy the condition.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final Node<T> node
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract AbstractNeighborCondition<T> cloneCondition(Node<T> node, Reaction<T> reaction)
      final Context getContext()
      double getPropensityContribution() Override if desired behavior differs.
      final Map<Node<T>, Double> getValidNeighbors() Searches in the given neighborhood which nodes satisfy the condition, and returns a list of valid neighbors.
      • Methods inherited from class it.unibo.alchemist.model.conditions.AbstractCondition

        getInboundDependencies, getNode, toString
      • Methods inherited from class it.unibo.alchemist.model.Condition

        isValid, reactionReady
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • getPropensityContribution

         double getPropensityContribution()

        Override if desired behavior differs. Default is returning the sum of the neighbor's propensities

        Returns:

        the sum of the neighbor's propensities

      • getValidNeighbors

         final Map<Node<T>, Double> getValidNeighbors()

        Searches in the given neighborhood which nodes satisfy the condition, and returns a list of valid neighbors. NOTE, it is NOT guaranteed that this method checks if the passed neighborhood is the actual neighborhood of the node. Make sure the passed neighborhood is up to date for avoid problems.

        Returns:

        a map of neighbors which satisfy the condition and their propensity