madkit.simulation.activators
Class OneValueArgsMethodActivator

java.lang.Object
  extended by madkit.kernel.Activator<AbstractAgent>
      extended by madkit.simulation.activators.OneValueArgsMethodActivator

public class OneValueArgsMethodActivator
extends Activator<AbstractAgent>

This class implements a one arg method activator.

Version:
1.0 Fabien Michel

Constructor Summary
OneValueArgsMethodActivator(java.lang.String group, java.lang.String role, java.lang.String methodName, java.lang.Class<?>[] argsClass)
           
OneValueArgsMethodActivator(java.lang.String communityName, java.lang.String group, java.lang.String role, java.lang.String methodName, java.lang.Class<?>[] argsClass)
           
 
Method Summary
 java.lang.Object[] execute(java.lang.Object[] args)
           
protected  void findMethods(java.lang.String methodName, java.lang.Class<?>[] parameterTypes)
           
 A getAgentNb(int nb)
           
 java.util.ListIterator<A> getAgentsIterator()
          Deprecated. as of MadKit 4.3 : simply type getCurrentAgentsList().listIterator()
 java.lang.String getCommunity()
           
 java.util.List<A> getCurrentAgentsList()
           
 java.lang.String getGroup()
           
 java.lang.String getRole()
           
 java.util.List<A> getShuffledList()
           
 void initialize()
          this method is automatically invoked the first time the agents variable is updated so it's a good place to initialize activator's parameters like in the SingleMethodActivator for exemple
 int numberOfAgents()
           
 java.lang.String toString()
           
 void update(AbstractAgent theAgent, boolean added)
          this method is automatically invoked when changes occur on the considered group/role couple
 void updateFieldFor(AbstractAgent theAgent)
           
 
Methods inherited from class madkit.kernel.Activator
execute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OneValueArgsMethodActivator

public OneValueArgsMethodActivator(java.lang.String group,
                                   java.lang.String role,
                                   java.lang.String methodName,
                                   java.lang.Class<?>[] argsClass)

OneValueArgsMethodActivator

public OneValueArgsMethodActivator(java.lang.String communityName,
                                   java.lang.String group,
                                   java.lang.String role,
                                   java.lang.String methodName,
                                   java.lang.Class<?>[] argsClass)
Method Detail

initialize

public void initialize()
Description copied from class: Activator
this method is automatically invoked the first time the agents variable is updated so it's a good place to initialize activator's parameters like in the SingleMethodActivator for exemple

Overrides:
initialize in class Activator<AbstractAgent>

findMethods

protected void findMethods(java.lang.String methodName,
                           java.lang.Class<?>[] parameterTypes)

update

public void update(AbstractAgent theAgent,
                   boolean added)
Description copied from class: Activator
this method is automatically invoked when changes occur on the considered group/role couple

Overrides:
update in class Activator<AbstractAgent>
Parameters:
theAgent - is the agent which have been added or removed from the agents collection, the getAgentsList() List)
added - is true if the Agent has been added to the agents collection, false if removed from it

updateFieldFor

public void updateFieldFor(AbstractAgent theAgent)

execute

public java.lang.Object[] execute(java.lang.Object[] args)

getAgentsIterator

public final java.util.ListIterator<A> getAgentsIterator()
Deprecated. as of MadKit 4.3 : simply type getCurrentAgentsList().listIterator()

Returns:
a ListIterator over the agents that handle the group/role couple
Since:
MadKit 3.0

getShuffledList

public final java.util.List<A> getShuffledList()
Returns:
a ListIterator which has been previously shuffled
Since:
MadKit 3.0

getCurrentAgentsList

public final java.util.List<A> getCurrentAgentsList()
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

numberOfAgents

public final int numberOfAgents()
Returns:
the number of the agents that handle the group/role couple

getAgentNb

public final A getAgentNb(int nb)

getCommunity

public final java.lang.String getCommunity()

getGroup

public final java.lang.String getGroup()

getRole

public final java.lang.String getRole()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © Madkit Team (O. Gutknecht, J. Ferber, F. Michel et al.) All Rights Reserved.