Class DiscreteEventAgentsActivator

All Implemented Interfaces:
Comparable<Activator>

public class DiscreteEventAgentsActivator extends DateBasedDiscreteEventActivator
An activator that works using a discrete-event simulation scheme.
  • Field Details

    • activationList

      protected PriorityQueue<SimuAgent> activationList
      The priority queue that holds the simulated agents based on their next event date.
  • Constructor Details

    • DiscreteEventAgentsActivator

      public DiscreteEventAgentsActivator(String group, String role, String theBehaviorToActivate)
      Constructs a new DiscreteEventAgentsActivator with the specified group, role, and behavior to activate.
      Parameters:
      group - the group of the agents
      role - the role of the agents
      theBehaviorToActivate - the behavior to activate
  • Method Details

    • onAdding

      protected void onAdding(Agent agent)
      Called when an agent is added to the activator. Updates the activation list and the next activation date.
      Parameters:
      agent - the agent being added
    • getNextActivationDate

      public LocalDateTime getNextActivationDate()
      Returns the next activation date based on the activation list.
      Overrides:
      getNextActivationDate in class DateBasedDiscreteEventActivator
      Returns:
      the next activation date
    • onRemoving

      protected void onRemoving(Agent agent)
      Called when an agent is removed from the activator. Updates the activation list and the next activation date.
      Parameters:
      agent - the agent being removed
    • execute

      public void execute(Object... args)
      Executes the behavior of the next agent in the activation list.
      Overrides:
      execute in class DateBasedDiscreteEventActivator
      Parameters:
      args - the arguments to pass to the behavior
      See Also:
    • toString

      public String toString()
      Returns a string representation of the activator, including the next activation date.
      Overrides:
      toString in class DateBasedDiscreteEventActivator
      Returns:
      a string representation of the activator
    • getCommunity

      public String getCommunity()
      Gets the community to which this activator/probe is binded to.
      Returns:
      a string representing the community's name
    • getGroup

      public String getGroup()
      Gets the group to which this activator/probe is binded to.
      Returns:
      a string representing the group's name
    • getRole

      public String getRole()
      Gets the role to which this activator/probe is binded to.
      Returns:
      a string representing the role's name
    • size

      public int size()
      Returns the number of targeted agents.
      Returns:
      the number of targeted agents
    • isEmpty

      public boolean isEmpty()
      Checks if there is no agent in the group/role couple
      Returns:
      true, if no agent is handling the group/role couple
    • getAgents

      public <A extends Agent> List<A> getAgents()
      Returns a snapshot at moment t of the agents handling the group/role couple
      Returns:
      a list view (a snapshot at moment t) of the agents that handle the group/role couple (in proper sequence)
      Since:
      MaDKit 3.0
    • getName

      public String getName()
      Gets the name.
      Returns:
      the name
    • killAgents

      public void killAgents()
      Kills all the agents which are monitored.
    • allAgentsLeaveRole

      public void allAgentsLeaveRole()
      Makes all the agents leave the corresponding role at once.